private $plane; public function __constract() { $this->boat = new SimpleBoat(); $this->plane = new SimplePlane(); } public function sail() { return $this->boat->sail(); } public function fly() { return $this->plane->fly(); } } $seaPlane = new SeaPlane(); $seaPlane->sail(); // ! $seaPlane->fly(); // ✈ 128݄9༵
/** * Updates createdAt and updatedAt timestamps. */ public function updateTimestamps() { if (null === $this->createdAt) { $this->createdAt = new \DateTime('now'); } $this->updatedAt = new \DateTime('now'); } } 128݄9༵