DateCell   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 33
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A position() 0 4 1
A value() 0 4 1
A __toString() 0 4 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