Slash::getNamespace()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 2
ccs 1
cts 1
cp 1
crap 1
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexendrie\Rss\Extensions;
5
6
use Nexendrie\Rss\Generator;
7
use Symfony\Component\OptionsResolver\OptionsResolver;
8
9
/**
10
 * Slash
11
 *
12
 * @author Jakub Konečný
13
 */
14 1
final class Slash extends BaseExtension {
15
  public const ELEMENT_SECTION = "section";
16
  public const ELEMENT_DEPARTMENT = "department";
17
  public const ELEMENT_COMMENTS = "comments";
18
  public const ELEMENT_HIT_PARADE = "hit_parade";
19
20
  public function getName(): string {
21 1
    return "slash";
22
  }
23
24
  public function getNamespace(): string {
25 1
    return "http://purl.org/rss/1.0/modules/slash/";
26
  }
27
28
  public function configureChannelOptions(OptionsResolver $resolver, Generator $generator): void {
29 1
  }
30
31
  public function configureItemOptions(OptionsResolver $resolver, Generator $generator): void {
32 1
    $this->registerElements($resolver);
33 1
    $resolver->setAllowedTypes($this->getElementName(self::ELEMENT_SECTION), "string");
34 1
    $resolver->setAllowedTypes($this->getElementName(self::ELEMENT_DEPARTMENT), "string");
35 1
    $resolver->setAllowedTypes($this->getElementName(self::ELEMENT_COMMENTS), "int");
36 1
    $resolver->setAllowedTypes($this->getElementName(self::ELEMENT_HIT_PARADE), "string");
37 1
    $resolver->setAllowedValues($this->getElementName(self::ELEMENT_HIT_PARADE), function(string $value): bool {
38 1
      return (preg_match('#^\d(,\d)*$#', $value) === 1);
39 1
    });
40 1
  }
41
}
42
43
?>