RecurringPaymentID::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 9
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Skrill\ValueObject;
6
7
use Skrill\ValueObject\Traits\ValueToStringTrait;
8
use Skrill\Exception\InvalidRecurringPaymentIDException;
9
10
/**
11
 * Value object for Skrill recurring payment id (rec_payment_id).
12
 *
13
 * @see https://www.skrill.com/fileadmin/content/pdf/Skrill_Wallet_Checkout_Guide.pdf
14
 */
15
final class RecurringPaymentID
16
{
17
    use ValueToStringTrait;
18
19
    /**
20
     * @param string $value
21
     *
22
     * @throws InvalidRecurringPaymentIDException
23
     */
24
    public function __construct(string $value)
25
    {
26
        $value = trim($value);
27
28
        if (empty($value)) {
29
            throw InvalidRecurringPaymentIDException::emptyTransactionID();
30
        }
31
32
        $this->value = $value;
33
    }
34
}
35