1 | <?php |
||
2 | |||
3 | namespace Dtc\QueueBundle\Model; |
||
4 | |||
5 | use Dtc\QueueBundle\Util\Util; |
||
6 | |||
7 | trait MicrotimeTrait |
||
8 | { |
||
9 | 34 | public function setWhenAt(\DateTime $whenAt) |
|
10 | { |
||
11 | 34 | parent::setWhenAt($whenAt); |
|
12 | |||
13 | 34 | return $this->setWhenUs(Util::getMicrotimeIntegerFormat($whenAt)); |
|
14 | } |
||
15 | |||
16 | /** |
||
17 | * @return \DateTime|null |
||
18 | */ |
||
19 | 50 | public function getWhenAt() |
|
20 | { |
||
21 | 50 | $whenUs = isset($this->whenUs) ? $this->whenUs : null; |
|
22 | 50 | if ($whenUs) { |
|
23 | 33 | return Util::getDateTimeFromDecimalFormat($whenUs); |
|
0 ignored issues
–
show
|
|||
24 | } |
||
25 | |||
26 | 47 | return null; |
|
27 | } |
||
28 | |||
29 | /** |
||
30 | * @param string |
||
31 | */ |
||
32 | 36 | public function setWhenUs($whenUs) |
|
33 | { |
||
34 | 36 | $this->whenUs = $whenUs; |
|
35 | |||
36 | 36 | return $this; |
|
37 | } |
||
38 | |||
39 | /** |
||
40 | * @param string |
||
41 | */ |
||
42 | 46 | public function getWhenUs() |
|
43 | { |
||
44 | 46 | return isset($this->whenUs) ? $this->whenUs : null; |
|
45 | } |
||
46 | } |
||
47 |
If the returned type also contains false, it is an indicator that maybe an error condition leading to the specific return statement remains unhandled.