Completed
Push — master ( 90bd67...742cd1 )
by Matthew
18:25
created

Model/MicrotimeTrait.php (1 issue)

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
Bug Best Practice introduced by
The expression return Dtc\QueueBundle\U...mDecimalFormat($whenUs) could also return false which is incompatible with the documented return type DateTime|null. Did you maybe forget to handle an error condition?

If the returned type also contains false, it is an indicator that maybe an error condition leading to the specific return statement remains unhandled.

Loading history...
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