Passed
Push — master ( 7ddfc7...8dcdb6 )
by Jakub
01:29
created

SkipDaysCollection::appendToXml()   A

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 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 4
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexendrie\Rss;
5
6
/**
7
 * SkipDaysCollection
8
 *
9
 * @author Jakub Konečný
10
 * @internal
11
 */
12 1
final class SkipDaysCollection implements IXmlConvertible {
13
  /** @var string[] */
14
  protected $days = [];
15
16
  /**
17
   * @param string[] $days
18
   */
19
  public function __construct(array $days) {
20 1
    $this->days = array_unique($days);
21 1
  }
22
23
  public function appendToXml(\SimpleXMLElement &$parent): void {
24 1
    $element = $parent->addChild("skipDays");
25 1
    array_walk($this->days, function(string $value) use($element) {
26 1
      $element->addChild("day", $value);
27 1
    });
28 1
  }
29
}
30
?>