Completed
Push — master ( 092da6...b7a681 )
by Jakub
02:00
created

Source::getTitle()   A

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 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
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;
5
6
/**
7
 * Source
8
 *
9
 * @author Jakub Konečný
10
 * @property string $url
11
 * @property string $title
12
 */
13 1
final class Source extends \stdClass implements IXmlConvertible {
14 1
  use \Nette\SmartObject;
15
16
  /** @var string */
17
  protected $url;
18
  /** @var string */
19
  protected $title;
20
21
  public function __construct(string $url = "", string $title = "") {
22 1
    $this->url = $url;
23 1
    $this->title = $title;
24 1
  }
25
26
  protected function getUrl(): string {
27 1
    return $this->url;
28
  }
29
30
  protected function setUrl(string $url): void {
31 1
    $this->url = $url;
32 1
  }
33
34
  protected function getTitle(): string {
35 1
    return $this->title;
36
  }
37
38
  protected function setTitle(string $title): void {
39 1
    $this->title = $title;
40 1
  }
41
42
  public function appendToXml(\SimpleXMLElement &$parent): void {
43 1
    if($this->url !== "") {
44 1
      $element = $parent->addChild("source", $this->title);
45 1
      $element->addAttribute("url", $this->url);
46
    }
47 1
  }
48
}
49
?>