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 Currency[]
9
*/
10
protected $currencies;
11
12
/**
13
* @return Currency[]
14
*/
15
15
public function getCurrencies(): array
16
{
17
15
$this->initializeCurrencies();
18
19
15
return $this->currencies;
20
}
21
22
/**
23
* @param array $currencies
24
*/
25
3
public function setCurrencies(array $currencies)
26
{
27
3
$this->currencies = $currencies;
28
3
}
29
30
/**
31
* @param Currency $currency
32
*/
33
3
public function addCurrency(Currency $currency)
34
{
35
3
$this->initializeCurrencies();
36
37
3
$this->currencies[] = $currency;
38
3
}
39
40
12
public function hydrateCurrencies(\SimpleXMLElement $xml)
41
{
42
12
if (!isset($xml->Currencies) || !isset($xml->Currencies->Currency) || empty($xml->Currencies->Currency)) {
43
3
return;
44
}
45
46
9
$this->initializeCurrencies();
47
48
9
foreach ($xml->Currencies->Currency as $currencyXml) {
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.