| Total Complexity | 10 |
| Total Lines | 105 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 18 | class Search |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * @var Coin[] |
||
| 22 | */ |
||
| 23 | private $currencies = []; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * @var Exchange[] |
||
| 27 | */ |
||
| 28 | private $exchanges = []; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @var Ico[] |
||
| 32 | */ |
||
| 33 | private $icos = []; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @var Person[] |
||
| 37 | */ |
||
| 38 | private $people = []; |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @var Tag[] |
||
| 42 | */ |
||
| 43 | private $tags = []; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * @return Coin[] |
||
| 47 | */ |
||
| 48 | 2 | public function getCurrencies(): array |
|
| 49 | { |
||
| 50 | 2 | return $this->currencies; |
|
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @param Coin[] $currencies |
||
| 55 | */ |
||
| 56 | 1 | public function setCurrencies(array $currencies): void |
|
| 59 | 1 | } |
|
| 60 | |||
| 61 | /** |
||
| 62 | * @return Exchange[] |
||
| 63 | */ |
||
| 64 | 1 | public function getExchanges(): array |
|
| 65 | { |
||
| 66 | 1 | return $this->exchanges; |
|
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @param Exchange[] $exchanges |
||
| 71 | */ |
||
| 72 | 1 | public function setExchanges(array $exchanges): void |
|
| 73 | { |
||
| 74 | 1 | $this->exchanges = $exchanges; |
|
| 75 | 1 | } |
|
| 76 | |||
| 77 | /** |
||
| 78 | * @return Ico[] |
||
| 79 | */ |
||
| 80 | 2 | public function getIcos(): array |
|
| 81 | { |
||
| 82 | 2 | return $this->icos; |
|
| 83 | } |
||
| 84 | |||
| 85 | /** |
||
| 86 | * @param Ico[] $icos |
||
| 87 | */ |
||
| 88 | 1 | public function setIcos(array $icos): void |
|
| 89 | { |
||
| 90 | 1 | $this->icos = $icos; |
|
| 91 | 1 | } |
|
| 92 | |||
| 93 | /** |
||
| 94 | * @return Person[] |
||
| 95 | */ |
||
| 96 | 3 | public function getPeople(): array |
|
| 97 | { |
||
| 98 | 3 | return $this->people; |
|
| 99 | } |
||
| 100 | |||
| 101 | /** |
||
| 102 | * @param Person[] $people |
||
| 103 | */ |
||
| 104 | 3 | public function setPeople(array $people): void |
|
| 105 | { |
||
| 106 | 3 | $this->people = $people; |
|
| 107 | 3 | } |
|
| 108 | |||
| 109 | /** |
||
| 110 | * @return Tag[] |
||
| 111 | */ |
||
| 112 | 2 | public function getTags(): array |
|
| 115 | } |
||
| 116 | |||
| 117 | /** |
||
| 118 | * @param Tag[] $tags |
||
| 119 | */ |
||
| 120 | 2 | public function setTags(array $tags): void |
|
| 123 | 2 | } |
|
| 124 | } |
||
| 125 |
Let?s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let?s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: