We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Conditions | 4 |
Paths | 4 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4.0218 |
Changes | 0 |
1 | <?php |
||
34 | 21 | public function validate($input) |
|
35 | { |
||
36 | 21 | if (!is_string($input)) { |
|
37 | 4 | return false; |
|
38 | } |
||
39 | |||
40 | 17 | $emailValidator = $this->getEmailValidator(); |
|
41 | 17 | if (!$emailValidator instanceof EmailValidator) { |
|
42 | 16 | return (bool) filter_var($input, FILTER_VALIDATE_EMAIL); |
|
43 | } |
||
44 | |||
45 | 1 | if (!class_exists('Egulias\\EmailValidator\\Validation\\RFCValidation')) { |
|
46 | return $emailValidator->isValid($input); |
||
47 | } |
||
48 | |||
49 | 1 | return $emailValidator->isValid($input, new RFCValidation()); |
|
50 | } |
||
51 | } |
||
52 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: