| Conditions | 3 |
| Paths | 4 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function fromString(string $value): \DateTimeInterface |
||
| 26 | { |
||
| 27 | try { |
||
| 28 | if ((string)(int)$value === $value) { |
||
| 29 | return Carbon::createFromTimestamp((int)$value); |
||
| 30 | } |
||
| 31 | |||
| 32 | return Carbon::parse($value); |
||
| 33 | } catch (\Throwable $e) { |
||
| 34 | $error = 'Unknown or unsupported input CarbonDateTime format "%s"'; |
||
| 35 | throw new InvalidDateTimeFormat(\sprintf($error, $value)); |
||
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 59 |