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...
6
{
7
/**
8
* @var Terminal[]
9
*/
10
protected $terminals;
11
12
/**
13
* @return Terminal[]
14
*/
15
15
public function getTerminals(): array
16
{
17
15
$this->initializeTerminals();
18
19
15
return $this->terminals;
20
}
21
22
/**
23
* @param array $terminals
24
*/
25
3
public function setTerminals(array $terminals)
26
{
27
3
$this->terminals = $terminals;
28
3
}
29
30
/**
31
* @param Terminal $terminal
32
*/
33
3
public function addTerminal(Terminal $terminal)
34
{
35
3
$this->initializeTerminals();
36
37
3
$this->terminals[] = $terminal;
38
3
}
39
40
9
public function hydrateTerminals(\SimpleXMLElement $xml)
41
{
42
9
if (!isset($xml->Terminals) || !isset($xml->Terminals->Terminal) || empty($xml->Terminals->Terminal)) {
43
3
return;
44
}
45
46
6
$this->initializeTerminals();
47
48
6
foreach ($xml->Terminals->Terminal as $terminalXml) {
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.