December 2016
Beginner to intermediate
238 pages
6h 10m
English
© Kelt Dockins 2017
Kelt Dockins, Design Patterns in PHP and Laravel, 10.1007/978-1-4842-2451-9_9
Kelt Dockins1
(1)Dolph, Arkansas, USA
$> git checkout adapterConvert the interface of a class into another interface that the clients expect. Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces.1
Sometimes you want to use existing code but the interface does not match what you need. For example, you want to utilize vendor/outside code without rewriting all of your existing code. It is analogous to fitting a square peg in round hole. A square peg can fit inside any round hole, provided the peg is small enough. You should take care to adapt what is needed because the more methods ...
Read now
Unlock full access