| Conditions | 7 |
| Paths | 8 |
| Total Lines | 15 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 7.0283 |
| Changes | 2 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 9 | 34 | public function run(): string |
|
| 10 | 34 | { |
|
| 11 | 34 | $date = $this->value(); |
|
| 12 | 34 | $format = empty($this->args[0]) ? 'Y-m-d H:i:s' : $this->args[0]; |
|
| 13 | 24 | if (glsr(Date::class)->isDate($date, $format)) { |
|
| 14 | return $date; |
||
| 15 | 34 | } |
|
| 16 | 34 | if (glsr(Date::class)->isTimestamp($date)) { |
|
| 17 | 34 | return wp_date($format, (int) $date) ?: ''; |
|
| 18 | } |
||
| 19 | 1 | $timestamp = strtotime($date); |
|
| 20 | 1 | if (false === $timestamp) { |
|
| 21 | return ''; |
||
| 22 | } |
||
| 23 | 1 | return wp_date($format, $timestamp) ?: ''; |
|
| 24 | } |
||
| 26 |