Enclosure   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 12
c 1
b 0
f 1
dl 0
loc 18
ccs 9
cts 9
cp 1
rs 10
wmc 2

2 Methods

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