Date::toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
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