Category   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 9
c 1
b 0
f 1
dl 0
loc 15
ccs 7
cts 7
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A appendToXml() 0 4 2
A __construct() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexendrie\Rss;
5
6
/**
7
 * Category
8
 *
9
 * @author Jakub Konečný
10
 */
11 1
final class Category implements IXmlConvertible {
12
  use \Nette\SmartObject;
13
14
  public string $identifier;
15
  public string $domain;
16
17
  public function __construct(string $identifier, string $domain = "") {
18 1
    $this->identifier = $identifier;
19 1
    $this->domain = $domain;
20 1
  }
21
22
  public function appendToXml(\SimpleXMLElement &$parent): void {
23 1
    $categoryElement = $parent->addChild("category", $this->identifier);
24 1
    if($this->domain !== "") {
25 1
      $categoryElement->addAttribute("domain", $this->domain);
26
    }
27 1
  }
28
}
29
?>