Completed
Push — master ( 2ed5ca...76d54c )
by Joachim
04:02
created

UnexpectedStatusException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 11
c 1
b 0
f 0
dl 0
loc 33
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getActualStatus() 0 3 1
A __construct() 0 12 1
A getExpectedStatus() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Setono\SyliusStockMovementPlugin\Exception;
6
7
use InvalidArgumentException;
8
use Safe\Exceptions\StringsException;
9
use function Safe\sprintf;
10
11
final class UnexpectedStatusException extends InvalidArgumentException implements ExceptionInterface
12
{
13
    /** @var string */
14
    private $actualStatus;
15
16
    /** @var string */
17
    private $expectedStatus;
18
19
    /**
20
     * @throws StringsException
21
     */
22
    public function __construct(string $actualStatus, string $expectedStatus)
23
    {
24
        $this->actualStatus = $actualStatus;
25
        $this->expectedStatus = $expectedStatus;
26
27
        $message = sprintf(
28
            'Unexpected status. Status was "%s". Expected status was "%s"',
29
            $this->actualStatus,
30
            $this->expectedStatus
31
        );
32
33
        parent::__construct($message);
34
    }
35
36
    public function getActualStatus(): string
37
    {
38
        return $this->actualStatus;
39
    }
40
41
    public function getExpectedStatus(): string
42
    {
43
        return $this->expectedStatus;
44
    }
45
}
46