Conditions | 5 |
Paths | 6 |
Total Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
59 | public function setTs($ts) |
||
60 | { |
||
61 | if ($ts === null) { |
||
62 | $this->ts = null; |
||
63 | return $this; |
||
64 | } |
||
65 | |||
66 | if (is_string($ts)) { |
||
67 | try { |
||
68 | $ts = new DateTime($ts); |
||
69 | } catch (Exception $e) { |
||
70 | throw new InvalidArgumentException($e->getMessage()); |
||
71 | } |
||
72 | } |
||
73 | |||
74 | if (!($ts instanceof DateTimeInterface)) { |
||
75 | throw new InvalidArgumentException( |
||
76 | 'Invalid "Send Date" value. Must be a date/time string or a DateTime object.' |
||
77 | ); |
||
78 | } |
||
79 | |||
80 | $this->ts = $ts; |
||
81 | return $this; |
||
82 | } |
||
83 | |||
110 |