We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 6 | 
| Paths | 6 | 
| Total Lines | 25 | 
| Code Lines | 14 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 13 | 
| CRAP Score | 6.0131 | 
| Changes | 0 | ||
| 1 | <?php  | 
            ||
| 25 | 27 | public function validate($input)  | 
            |
| 26 |     { | 
            ||
| 27 | 27 | var_dump($input);  | 
            |
| 
                                                                                                    
                        
                         | 
                |||
| 28 | 27 |         if ($input instanceof DateTimeInterface) { | 
            |
| 29 | 2 | return true;  | 
            |
| 30 | }  | 
            ||
| 31 | |||
| 32 | 25 |         if (!is_scalar($input)) { | 
            |
| 33 | 1 | return false;  | 
            |
| 34 | }  | 
            ||
| 35 | |||
| 36 | 24 | $allowedFormat = '/[djSFmMnYy\W]+$/';  | 
            |
| 37 | 24 |         if(!preg_match($allowedFormat, $this->format)) { | 
            |
| 38 | 20 | return false;  | 
            |
| 39 | }  | 
            ||
| 40 | |||
| 41 | 4 | $inputString = (string) $input;  | 
            |
| 42 | 4 |         if (is_null($this->format)) { | 
            |
| 43 | return false !== strtotime($inputString);  | 
            ||
| 44 | }  | 
            ||
| 45 | |||
| 46 | 4 | $info = date_parse_from_format($this->format, $inputString);  | 
            |
| 47 | |||
| 48 | 4 | return $info['error_count'] === 0 && $info['warning_count'] === 0;  | 
            |
| 49 | }  | 
            ||
| 50 | }  | 
            ||
| 51 |