CartCurrencyMismatchException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 6
nc 1
nop 3
1
<?php
2
3
declare(strict_types = 1);
4
5
namespace SyliusCart\Domain\Exception;
6
7
use Money\Currency;
8
9
/**
10
 * @author Arkadiusz Krakowiak <[email protected]>
11
 */
12
final class CartCurrencyMismatchException extends \DomainException
13
{
14
    /**
15
     * @param Currency $expectedCurrency
16
     * @param Currency $unExpectedCurrency
17
     * @param \Exception|null $previousException
18
     */
19
    public function __construct(Currency $expectedCurrency, Currency $unExpectedCurrency, \Exception $previousException = null)
20
    {
21
        $message = sprintf(
22
            'Trying to add cart item in different currency. Expected: "%s", got "%s"',
23
            $expectedCurrency->getCode(),
24
            $unExpectedCurrency->getCode()
25
        );
26
27
        parent::__construct($message, 0, $previousException);
28
    }
29
}
30