Hoa central
Timestamp.php
Go to the documentation of this file.
1 <?php
2 
37 namespace Hoa\Realdom;
38 
39 use Hoa\Math;
40 
49 class Timestamp extends Constinteger
50 {
56  const NAME = 'timestamp';
57 
63  protected $_arguments = [
64  'Conststring date' => 'now'
65  ];
66 
67 
68 
75  protected function _predicate($q)
76  {
77  return $q == $this->getConstantValue();
78  }
79 
86  protected function _sample(Math\Sampler $sampler)
87  {
88  return $this->getConstantValue();
89  }
90 
96  public function getConstantValue()
97  {
98  $datetime = new \DateTime($this['date']->getConstantValue());
99 
100  return (int) $datetime->format('U');
101  }
102 }
_sample(Math\Sampler $sampler)
Definition: Timestamp.php:86