1 | <?php |
||
24 | class Domain |
||
25 | { |
||
26 | |||
27 | /** |
||
28 | * Domain name. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $domain; |
||
33 | |||
34 | /** |
||
35 | * Instantiate a Domain object. |
||
36 | * |
||
37 | * @param Domain|string $domain |
||
38 | * |
||
39 | * @throws InvalidDomain If the domain is not valid. |
||
40 | */ |
||
41 | 9 | public function __construct($domain) |
|
49 | |||
50 | /** |
||
51 | * Return the domain name. |
||
52 | * |
||
53 | * @return string |
||
54 | */ |
||
55 | 3 | public function getDomain() |
|
59 | |||
60 | /** |
||
61 | * Reutrn a string representation of the Domain object. |
||
62 | * |
||
63 | * @return string |
||
64 | */ |
||
65 | 3 | public function __toString() |
|
69 | |||
70 | /** |
||
71 | * @param $domain |
||
72 | * |
||
73 | * @return bool |
||
74 | */ |
||
75 | 9 | protected function isValid($domain) |
|
80 | } |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.