DateCell::position()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types = 1);
3
4
namespace Spreadsheet\Cell;
5
6
use Spreadsheet\{
7
    CellInterface,
8
    Position
9
};
10
11
final class DateCell implements CellInterface
12
{
13
    private $position;
14
    private $date;
15
    private $string;
16
17 3
    public function __construct(
18
        Position $position,
19
        \DateTimeImmutable $date
20
    ) {
21 3
        $this->position = $position;
22 3
        $this->date = $date;
23 3
        $this->string = $date->format(\DateTime::ISO8601);
24 3
    }
25
26 2
    public function position(): Position
27
    {
28 2
        return $this->position;
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34 3
    public function value()
35
    {
36 3
        return $this->date;
37
    }
38
39 1
    public function __toString(): string
40
    {
41 1
        return $this->string;
42
    }
43
}
44