UnsupportedHistoricalDateException::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 0
cts 8
cp 0
rs 9.6666
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Jarobe\HistoricalMoney\Exception;
4
5
use Money\Exception as MoneyException;
6
7
/**
8
 * Throws when a currency pair is requested for an unsupported historical date.
9
 */
10
class UnsupportedHistoricalDateException extends \InvalidArgumentException implements MoneyException
11
{
12
    /**
13
     * @param \DateTimeInterface $dateTime
14
     *
15
     * @return UnsupportedHistoricalDateException
16
     */
17
    public static function create(\DateTimeInterface $dateTime)
18
    {
19
        $message = sprintf(
20
            'No rate provided for date: %s',
21
            $dateTime->format('Y-m-d G:i:s')
22
        );
23
24
        return new self($message);
25
    }
26
}
27