BaseExtension   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 11
ccs 5
cts 5
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getElementName() 0 2 1
A registerElements() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexendrie\Rss\Extensions;
5
6
use Nexendrie\Rss\IRssExtension;
7
use Nexendrie\Utils\Constants;
8
use Symfony\Component\OptionsResolver\OptionsResolver;
9
10 1
abstract class BaseExtension implements IRssExtension {
11
  use \Nette\SmartObject;
12
13
  protected function getElementName(string $baseName): string {
14 1
    return $this->getName() . ":" . $baseName;
15
  }
16
17
  protected function registerElements(OptionsResolver $resolver): void {
18 1
    $elements = Constants::getConstantsValues(static::class, "ELEMENT_");
19 1
    array_walk($elements, function(string $value) use ($resolver): void {
20 1
      $resolver->setDefined($this->getElementName($value));
21 1
    });
22 1
  }
23
}
24
25
?>