We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Conditions | 5 |
Paths | 5 |
Total Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 5.2742 |
Changes | 0 |
1 | <?php |
||
34 | 17 | public function validate($input) |
|
35 | { |
||
36 | 17 | if (!is_scalar($input)) { |
|
37 | return false; |
||
38 | } |
||
39 | |||
40 | 17 | $emailValidator = $this->getEmailValidator(); |
|
41 | 17 | if (!$emailValidator instanceof EmailValidator) { |
|
42 | 16 | return is_string($input) && filter_var($input, FILTER_VALIDATE_EMAIL); |
|
43 | } |
||
44 | |||
45 | 1 | if (!class_exists('Egulias\\EmailValidator\\Validation\\RFCValidation')) { |
|
46 | 1 | return $emailValidator->isValid($input); |
|
47 | } |
||
48 | |||
49 | 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: