InvalidDateFormat::forIncomingDate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
ccs 0
cts 2
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Chemaclass\StockTicker\Domain\Crawler\Site\Barrons\Exception;
6
7
use RuntimeException;
8
9
final class InvalidDateFormat extends RuntimeException
10
{
11
    public static function forIncomingDate(string $incomingDate): self
12
    {
13
        return new self(sprintf(
14
            'Format not found for the incomingDate: "%s"',
15
            $incomingDate,
16
        ));
17
    }
18
19
    public static function couldNotCreateDateTime(string $incomingDate, string $incomingFormat): self
20
    {
21
        return new self(sprintf(
22
            'Could not create a dateTime for incomingDate: "%s" to this format: "%s"',
23
            $incomingDate,
24
            $incomingFormat,
25
        ));
26
    }
27
}
28