InvalidDateFormat   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 8
c 1
b 0
f 0
dl 0
loc 16
ccs 0
cts 4
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A forIncomingDate() 0 5 1
A couldNotCreateDateTime() 0 6 1
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