1 | <?php |
||
33 | class ProcessCollection extends \ArrayObject |
||
34 | { |
||
35 | |||
36 | /** |
||
37 | * Method to retrieve an element from the collection. |
||
38 | * |
||
39 | * @throws \Exception |
||
40 | * @return Process |
||
41 | */ |
||
42 | public function offsetGet($index) |
||
43 | { |
||
44 | if (! parent::offsetExists($index)) { |
||
|
|||
45 | throw new \Exception('Index "' . var_export($index, true) . '" for \AOE\Crawler\Domain\Model\Process are not available'); |
||
46 | } |
||
47 | return parent::offsetGet($index); |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * Method to add an element to the collection- |
||
52 | * |
||
53 | * @param mixed $index |
||
54 | * @param Process $subject |
||
55 | * @throws \InvalidArgumentException |
||
56 | * @return void |
||
57 | */ |
||
58 | 7 | public function offsetSet($index, $subject) |
|
59 | { |
||
60 | 7 | if (! $subject instanceof Process) { |
|
61 | throw new \InvalidArgumentException('Wrong parameter type given, "\AOE\Crawler\Domain\Model\Process" expected!'); |
||
62 | } |
||
63 | 7 | parent::offsetSet($index, $subject); |
|
64 | 7 | } |
|
65 | |||
66 | /** |
||
67 | * Method to append an element to the collection |
||
68 | * @param Process $subject |
||
69 | * @throws \InvalidArgumentException |
||
70 | * @return void |
||
71 | */ |
||
72 | 7 | public function append($subject) |
|
73 | { |
||
74 | 7 | if (! $subject instanceof Process) { |
|
75 | throw new \InvalidArgumentException('Wrong parameter type given, "\AOE\Crawler\Domain\Model\Process" expected!'); |
||
76 | } |
||
77 | 7 | parent::append($subject); |
|
78 | 7 | } |
|
79 | |||
80 | /** |
||
81 | * returns array of process ids of the current collection |
||
82 | * @return array |
||
83 | */ |
||
84 | 7 | public function getProcessIds() |
|
92 | } |
||
93 |
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.