Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Timestamp
- {
- private $value;
- public function __construct($value)
- {
- $this->value = $value;
- }
- public function updateTimestamps()
- {
- $this->value = new DateTime();
- $this->touch();
- }
- public function touch()
- {
- $this->value = new DateTime();
- }
- public function getValue()
- {
- return $this->value;
- }
- }
- class User
- {
- /**
- * @var Timestamp
- */
- protected $createdAt;
- /**
- * @var Timestamp
- */
- protected $updatedAt;
- public function setCreateAt(Timestamp $timestamp)
- {
- $this->createdAt = $timestamp;
- }
- poublic function getCreateAt()
- {
- return $this->createdA;
- }
- }
- $user = new User();
- $user->setCreateAt(new Timestamp(3123121));
- echo $user->getCreateAt()->touch()->getValue();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement