We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| 1 | <?php |
||
| 16 | class Domain extends AbstractComposite |
||
| 17 | { |
||
| 18 | protected $tld; |
||
| 19 | protected $checks = []; |
||
| 20 | protected $otherParts; |
||
| 21 | |||
| 22 | 30 | public function __construct($tldCheck = true) |
|
| 34 | |||
| 35 | 30 | public function tldCheck($do = true) |
|
| 51 | |||
| 52 | 14 | public function validate($input) |
|
| 53 | { |
||
| 54 | 14 | foreach ($this->checks as $chk) { |
|
| 55 | 14 | if (!$chk->validate($input)) { |
|
| 56 | 14 | return false; |
|
| 57 | } |
||
| 58 | } |
||
| 59 | |||
| 60 | 14 | if (count($parts = explode('.', $input)) < 2 |
|
| 61 | 14 | || !$this->tld->validate(array_pop($parts))) { |
|
| 62 | return false; |
||
| 63 | } |
||
| 64 | |||
| 65 | 14 | foreach ($parts as $p) { |
|
| 66 | 14 | if (!$this->otherParts->validate($p)) { |
|
| 67 | 14 | return false; |
|
| 68 | } |
||
| 69 | } |
||
| 70 | |||
| 71 | 14 | return true; |
|
| 72 | } |
||
| 73 | |||
| 74 | 15 | public function assert($input) |
|
| 95 | |||
| 96 | 15 | protected function collectAssertException(&$exceptions, $validator, $input) |
|
| 104 | |||
| 105 | 15 | public function check($input) |
|
| 121 | } |
||
| 122 |