Date::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
crap 1
1
<?php declare(strict_types=1);
2
3
namespace Bigwhoop\Trumpet\Config;
4
5
final class Date
6
{
7
    /** @var \DateTime */
8
    public $date;
9
10
    /** @var string */
11
    public $format = '';
12
13 2
    public function __construct(\DateTime $date, string $format = 'l, F j Y')
14
    {
15 2
        $this->date = $date;
16 2
        $this->format = $format;
17 2
    }
18
19
    public function toString(): string
20
    {
21
        return $this->date->format($this->format);
22
    }
23
24
    public function __toString(): string
25
    {
26
        return $this->toString();
27
    }
28
}
29