1
|
|
|
<?php |
2
|
|
|
namespace AOE\Crawler\Domain\Model; |
3
|
|
|
|
4
|
|
|
/*************************************************************** |
5
|
|
|
* Copyright notice |
6
|
|
|
* |
7
|
|
|
* (c) 2017 AOE GmbH <[email protected]> |
8
|
|
|
* |
9
|
|
|
* All rights reserved |
10
|
|
|
* |
11
|
|
|
* This script is part of the TYPO3 project. The TYPO3 project is |
12
|
|
|
* free software; you can redistribute it and/or modify |
13
|
|
|
* it under the terms of the GNU General Public License as published by |
14
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
15
|
|
|
* (at your option) any later version. |
16
|
|
|
* |
17
|
|
|
* The GNU General Public License can be found at |
18
|
|
|
* http://www.gnu.org/copyleft/gpl.html. |
19
|
|
|
* |
20
|
|
|
* This script is distributed in the hope that it will be useful, |
21
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
22
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
23
|
|
|
* GNU General Public License for more details. |
24
|
|
|
* |
25
|
|
|
* This copyright notice MUST APPEAR in all copies of the script! |
26
|
|
|
***************************************************************/ |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Class ProcessCollection |
30
|
|
|
* |
31
|
|
|
* @package AOE\Crawler\Domain\Model |
32
|
|
|
*/ |
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
|
|
|
public function offsetSet($index, $subject) |
59
|
|
|
{ |
60
|
|
|
if (! $subject instanceof Process) { |
61
|
|
|
throw new \InvalidArgumentException('Wrong parameter type given, "\AOE\Crawler\Domain\Model\Process" expected!'); |
62
|
|
|
} |
63
|
|
|
parent::offsetSet($index, $subject); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Method to append an element to the collection |
68
|
|
|
* @param Process $subject |
69
|
|
|
* @throws \InvalidArgumentException |
70
|
|
|
* @return void |
71
|
|
|
*/ |
72
|
|
|
public function append($subject) |
73
|
|
|
{ |
74
|
|
|
if (! $subject instanceof Process) { |
75
|
|
|
throw new \InvalidArgumentException('Wrong parameter type given, "\AOE\Crawler\Domain\Model\Process" expected!'); |
76
|
|
|
} |
77
|
|
|
parent::append($subject); |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* returns array of process ids of the current collection |
82
|
|
|
* @return array |
83
|
|
|
*/ |
84
|
|
|
public function getProcessIds() |
85
|
|
|
{ |
86
|
|
|
$result = []; |
87
|
|
|
foreach ($this->getIterator() as $value) { |
88
|
|
|
$result[] = $value->getProcess_id(); |
89
|
|
|
} |
90
|
|
|
return $result; |
91
|
|
|
} |
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.