DateTimeType   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A setValue() 0 9 2
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of Wszetko Sitemap.
7
 *
8
 * (c) Paweł Kłopotek-Główczewski <[email protected]>
9
 *
10
 * This source file is subject to the MIT license that is bundled
11
 * with this source code in the file LICENSE.
12
 */
13
14
namespace Wszetko\Sitemap\Items\DataTypes;
15
16
use Wszetko\Sitemap\Interfaces\DataType;
17
use Wszetko\Sitemap\Traits\DateTime;
18
19
/**
20
 * Class DateTimeType.
21
 *
22
 * @package Wszetko\Sitemap\Items\DataTypes
23
 */
24
class DateTimeType extends AbstractDataType
25
{
26
    use DateTime;
27
28
    /**
29
     * @inheritDoc
30
     *
31
     * @throws \InvalidArgumentException
32
     */
33 82
    public function setValue($value, $parameters = []): DataType
34
    {
35 82
        $value = $this->processDateTime($value, $this->isRequired());
36
37 78
        if (is_string($value)) {
38 70
            $this->value = $value;
39
        }
40
41 78
        return $this;
42
    }
43
}
44