VoucherIsInvalid::getVoucherCode()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace BeyondCode\Vouchers\Exceptions;
4
5
class VoucherIsInvalid extends \Exception
6
{
7
    protected $code;
8
9
    public static function withCode(string $code)
10
    {
11
        return new static('The provided code '.$code.' is invalid.', $code);
12
    }
13
14
    public function __construct($message, $code)
15
    {
16
        $this->message = $message;
17
        $this->code = $code;
18
    }
19
20
    /**
21
     * @return mixed
22
     */
23
    public function getVoucherCode()
24
    {
25
        return $this->code;
26
    }
27
}