1 | <?php |
||
53 | class IsObjectOfType implements Check, ListCheck |
||
54 | { |
||
55 | // saves us having to implement inspectList() ourselves |
||
56 | use ListCheckHelper; |
||
57 | |||
58 | /** |
||
59 | * what type of object are we looking for? |
||
60 | * @var string |
||
61 | */ |
||
62 | private $expectedType; |
||
63 | |||
64 | /** |
||
65 | * create a new check |
||
66 | * |
||
67 | * @param string $expectedType |
||
68 | * the class or interface that we want to check against |
||
69 | */ |
||
70 | public function __construct($expectedType) |
||
74 | |||
75 | /** |
||
76 | * do we have something that is a specific type of object? |
||
77 | * |
||
78 | * @param mixed $fieldOrVar |
||
79 | * the item to be checked |
||
80 | * @param string $expectedType |
||
81 | * the class or interface that we want to check against |
||
82 | * @return bool |
||
83 | * TRUE if the item is the requested type |
||
84 | * FALSE otherwise |
||
85 | */ |
||
86 | public static function check($fieldOrVar, $expectedType) |
||
99 | |||
100 | /** |
||
101 | * do we have something that is a specific type of object? |
||
102 | * |
||
103 | * @param mixed $fieldOrVar |
||
104 | * the item to be checked |
||
105 | * @return bool |
||
106 | * TRUE if the item is the requested type |
||
107 | * FALSE otherwise |
||
108 | */ |
||
109 | public function inspect($fieldOrVar) |
||
113 | |||
114 | /** |
||
115 | * is every entry in $list an object of a given type? |
||
116 | * |
||
117 | * @param mixed $list |
||
118 | * the list of items to be checked |
||
119 | * @param string $expectedType |
||
120 | * the class or interface that we want to check against |
||
121 | * @return bool |
||
122 | * TRUE if every item in $list is an object of a given type |
||
123 | * FALSE otherwise |
||
124 | */ |
||
125 | public static function checkList($list, $expectedType) |
||
130 | } |
||
131 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.