June 2017
Intermediate to advanced
536 pages
9h 49m
English
The builder pattern is quite a handy one, especially when it comes to large applications. It separates the construction of a complex object from its representation. This makes it possible for the same construction process to create numerous representations.
The following example demonstrates a possible builder pattern implementation using the Image class as an example:
<?phpclass Image{ private $width; private $height; public function getWidth() { return $this->width; } public function setWidth($width) { $this->width = $width; return $this; } public function getHeight() { return $this->height; } public function setHeight($height) { $this->height = $height; return $this; }}interface ImageBuilderInterface{ public function ...