CartCurrencyMismatchException   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 18
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
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