Conditions | 5 |
Paths | 7 |
Total Lines | 18 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 5.2 |
Changes | 0 |
1 | <?php |
||
52 | 3 | public function lastPerformanceDate(string $timezone = 'America/New_York'): DateTime|bool |
|
53 | { |
||
54 | try { |
||
55 | 3 | $timezone = new DateTimeZone($timezone); |
|
56 | 1 | } catch (Exception $e) { |
|
57 | 1 | throw new InvalidArgumentException($e->getMessage()); |
|
58 | } |
||
59 | |||
60 | 2 | $date = isset($this->response()['LastPerformanceDate']) ? $this->response()['LastPerformanceDate'] : false; |
|
61 | 2 | if ($date) { |
|
62 | try { |
||
63 | 1 | return DateTime::createFromFormat(' Y-m-d\TG:i:sp', $date, $timezone); |
|
64 | } catch (Exception $e) { |
||
65 | trigger_error($e->getMessage(), E_USER_ERROR); |
||
66 | } |
||
67 | } |
||
68 | |||
69 | 1 | return false; |
|
70 | } |
||
80 |