Enclosure::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 3
c 1
b 0
f 1
nc 1
nop 3
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
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
?>