class Car { private $speed; private $color; private $doors; public function setSpeed($speed){ $this->speed = $speed; return $this; } public function setColor($color) { $this->color = $color; return $this; } public function setDoors($doors) { $this->doors = $doors; return $this; } } // Fluent interface $myCar = new Car(); $myCar->setSpeed(100)->setColor('blue')->setDoors(5); // Example without fluent interface $myCar2 = new Car(); $myCar2->setSpeed(100); $myCar2->setColor('blue'); $myCar2->setDoors(5);
Tuesday, September 21, 2010
PHP The following is an example of a class with a fluent interface implemented in PHP:
Subscribe to:
Post Comments (Atom)
How to revert comments Youtube layout?
#see video for details https://www.youtube.com/watch?v=J0L_nYtNlqs #uBlock Origin https://chrome.google.com/webstore/detail/ublock-o...
-
sh -c 'xfce4-screenshooter --fullscreen --save "$HOME/Pictures/Screenshots/Screenshot_$(date +%Y-%m-%d_%H:%M:%S).png"' s...
-
Known Issues Firefox 3.5 will only support color profiles as specified by ICC v2, later versions will add su...
No comments:
Post a Comment