Passed
Push — master ( e9f6a4...7ddfc7 )
by Jakub
01:51
created

Enclosure::getLength()   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 0
Metric Value
cc 1
dl 0
loc 2
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
eloc 1
nc 1
nop 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexendrie\Rss;
5
6
/**
7
 * Enclosure
8
 *
9
 * @author Jakub Konečný
10
 * @property string $url
11
 * @property int $length
12
 * @property string $type
13
 */
14 1
final class Enclosure implements IXmlConvertible {
15 1
  use \Nette\SmartObject;
16
17
  /** @var string */
18
  protected $url;
19
  /** @var int */
20
  protected $length;
21
  /** @var string */
22
  protected $type;
23
24
  public function __construct(string $url, int $length, string $type) {
25 1
    $this->url = $url;
26 1
    $this->length = $length;
27 1
    $this->type = $type;
28 1
  }
29
30
  public function getUrl(): string {
31 1
    return $this->url;
32
  }
33
34
  public function setUrl(string $url): void {
35 1
    $this->url = $url;
36 1
  }
37
38
  public function getLength(): int {
39 1
    return $this->length;
40
  }
41
42
  public function setLength(int $length): void {
43 1
    $this->length = $length;
44 1
  }
45
46
  public function getType(): string {
47 1
    return $this->type;
48
  }
49
50
  public function setType(string $type): void {
51 1
    $this->type = $type;
52 1
  }
53
54
  public function appendToXml(\SimpleXMLElement &$parent): void {
55 1
    $enclosureElement = $parent->addChild("enclosure");
56 1
    $enclosureElement->addAttribute("url", $this->url);
57 1
    $enclosureElement->addAttribute("length", (string) $this->length);
58 1
    $enclosureElement->addAttribute("type", $this->type);
59 1
  }
60
}
61
?>