What you cite as an example is often called the Fluent Interface design pattern. The implementation is trivial: you need to return $this from methods that change the internal state of the object. For example:
class Human { private $firstName = ''; private $lastName = ''; public function setFirstName($first_name) { $this->firstName = $first_name; retrun $this; } public function setLastName($last_name) { $this->lastName = $last_name; retrun $this; } public function getFullName() { retrun $this->first_name . ' ' . $this->last_name; } } $john = new Human(); $john->setFirstName('John') ->setLastName('Doe') ->getFullName(); // 'John Doe'
лапшу- Vasily Barbashev