| Conditions | 4 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public function registerBadges(BadgeEvaluatorInterface $evaluator) |
||
| 25 | { |
||
| 26 | $namespace = $evaluator->getName(); |
||
| 27 | if (!array_key_exists($namespace, $this->badges)) { |
||
| 28 | $this->badges[$namespace] = $evaluator->getAvailableBadges(); |
||
| 29 | } else { |
||
| 30 | foreach ($evaluator->getAvailableBadges() as $name => $badge) { |
||
| 31 | if (array_key_exists($name, $this->badges[$namespace])) { |
||
| 32 | throw new BadgesNameCollisionException("There is another badge named '{$namespace}.{$name}'."); |
||
| 33 | } |
||
| 34 | $this->badges[$namespace][$name] = $badge; |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | return $this; |
||
| 39 | } |
||
| 46 |