AmountMismatchException   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
1
<?php
2
3
namespace Pagantis\ModuleUtils\Exception;
4
5
/**
6
 * Class AmountMismatchException
7
 *
8
 * @package Pagantis\ModuleUtils\Exception
9
 */
10
class AmountMismatchException extends AbstractException
11
{
12
    /**
13
     * ERROR_MESSAGE
14
     */
15
    const ERROR_MESSAGE = 'Amount mismatch error, expected %s and received %s';
16
17
    /**
18
     * ERROR_CODE
19
     */
20
    const ERROR_CODE = 409;
21
22
    /**
23
     * AmountMismatchException constructor.
24
     *
25
     * @param $expectedAmount
26
     * @param $currentAmount
27
     */
28
    public function __construct($expectedAmount, $currentAmount)
29
    {
30
        $this->code = self::ERROR_CODE;
31
        $this->message = sprintf(self::ERROR_MESSAGE, $expectedAmount, $currentAmount);
32
33
        return parent::__construct($this->getMessage(), $this->getCode());
34
    }
35
}
36