This class seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
7
{
8
public $responses = [];
9
10
public function getIterator()
11
{
12
return new \ArrayIterator($this->responses);
13
}
14
15
public function count()
16
{
17
return count($this->responses);
18
}
19
20
public function add($id = null, RpcResponseInterface $response)
21
{
22
unset($this->responses[$id]);
23
24
$this->responses[$id] = $response;
25
}
26
public function all()
27
{
28
return $this->responses;
29
}
30
31
32
public function get($id)
33
{
34
if (isset($this->responses[$id])) {
35
return $this->responses[$id];
36
}
37
38
return null;
39
}
40
41
public function remove($id)
42
{
43
unset($this->responses[$id]);
44
}
45
46
public function addCollection(JsonRpcResponseCollection $collection)
47
{
48
foreach ($collection->all() as $id => $response) {
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.