Conditions | 5 |
Paths | 7 |
Total Lines | 18 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 5.2 |
Changes | 0 |
1 | <?php |
||
29 | 4 | public function firstPerformanceDate(string $timezone = 'America/New_York'): DateTime|bool |
|
30 | { |
||
31 | try { |
||
32 | 4 | $timezone = new DateTimeZone($timezone); |
|
33 | 1 | } catch (Exception $e) { |
|
34 | 1 | throw new InvalidArgumentException($e->getMessage()); |
|
35 | } |
||
36 | |||
37 | 3 | $date = isset($this->response()['FirstPerformanceDate']) ? $this->response()['FirstPerformanceDate'] : false; |
|
38 | 3 | if ($date) { |
|
39 | try { |
||
40 | 2 | return DateTime::createFromFormat(' Y-m-d\TG:i:sp', $date, $timezone); |
|
41 | } catch (Exception $e) { |
||
42 | trigger_error($e->getMessage(), E_USER_ERROR); |
||
43 | } |
||
44 | } |
||
45 | |||
46 | 1 | return false; |
|
47 | } |
||
80 |