| Conditions | 3 |
| Paths | 4 |
| Total Lines | 21 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 29 | 12 | public static function ObtainFromString( |
|
| 30 | string $value, |
||
| 31 | DateTimeZone $tz = null |
||
| 32 | ) : DateTimeInterface { |
||
| 33 | 12 | $out = new static($value); |
|
| 34 | 6 | $format = static::ObtainFormat(); |
|
| 35 | |||
| 36 | 6 | if ( ! is_null($tz)) { |
|
| 37 | 3 | $out = $out->setTimezone($tz); |
|
| 38 | } |
||
| 39 | |||
| 40 | 6 | $out = new static($out->format($format)); |
|
| 41 | |||
| 42 | 6 | if ( ! is_null($tz)) { |
|
| 43 | /** |
||
| 44 | * @var DateTimeInterface |
||
| 45 | */ |
||
| 46 | 3 | $out = $out->setTimezone($tz); |
|
| 47 | } |
||
| 48 | |||
| 49 | 6 | return $out; |
|
|
|
|||
| 50 | } |
||
| 54 |