Source::appendToXml()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 2
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexendrie\Rss;
5
6
/**
7
 * Source
8
 *
9
 * @author Jakub Konečný
10
 */
11 1
final class Source extends \stdClass implements IXmlConvertible {
12
  use \Nette\SmartObject;
13
14
  public string $url;
15
  public string $title;
16
17
  public function __construct(string $url = "", string $title = "") {
18 1
    $this->url = $url;
19 1
    $this->title = $title;
20 1
  }
21
22
  public function appendToXml(\SimpleXMLElement &$parent): void {
23 1
    if($this->url !== "") {
24 1
      $element = $parent->addChild("source", $this->title);
25 1
      $element->addAttribute("url", $this->url);
26
    }
27 1
  }
28
}
29
?>