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)
systemd-timesyncd
sudo apt update && sudo apt install systemd-timesyncd && sudo systemctl enable --now systemd-timesyncd
-
sudo -u www-data /usr/local/bin/composer install --no-ansi --no-dev --no-interaction --no-progress --no-scripts --optimize-autoloader
-
find . ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD fdupes -r / linux_czkawka_gui.AppImage
No comments:
Post a Comment