| Total Complexity | 7 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | class DeploymentMappings extends \ArrayObject |
||
| 6 | { |
||
| 7 | protected $overallIdCount; |
||
| 8 | |||
| 9 | public static function of(DeploymentMapping $mapping): DeploymentMappings |
||
| 10 | { |
||
| 11 | $mappings = new DeploymentMappings(); |
||
| 12 | $mappings->add($mapping); |
||
| 13 | return $mappings; |
||
| 14 | } |
||
| 15 | |||
| 16 | public function add(DeploymentMapping $mapping): bool |
||
| 17 | { |
||
| 18 | $this->overallIdCount += $mapping->getCount(); |
||
| 19 | $this[] = $mapping; |
||
| 20 | return true; |
||
| 21 | } |
||
| 22 | |||
| 23 | public function get(int $mappingIndex) |
||
|
|
|||
| 24 | { |
||
| 25 | if (isset($this[$index])) { |
||
| 26 | return $this[$index]; |
||
| 27 | } else { |
||
| 28 | throw new \Exception(sprintf("Undefined array key %d", $index)); |
||
| 29 | } |
||
| 30 | } |
||
| 31 | |||
| 32 | public function remove(int $mappingIndex): bool |
||
| 33 | { |
||
| 34 | if (isset($this[$mappingIndex])) { |
||
| 35 | $this->overallIdCount -= $this[$mappingIndex]->getCount(); |
||
| 36 | unset($this[$mappingIndex]); |
||
| 37 | return true; |
||
| 38 | } else { |
||
| 39 | return false; |
||
| 40 | } |
||
| 41 | } |
||
| 42 | |||
| 43 | public function getOverallIdCount(): int |
||
| 46 | } |
||
| 47 | } |
||
| 48 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.