ObtainBankAccount::obtain()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PH\Bundle\PayumBundle\Request;
6
7
use Payum\Core\Exception\LogicException;
8
use Payum\Core\Model\BankAccountInterface;
9
use Payum\Core\Request\Generic;
10
11
class ObtainBankAccount extends Generic
12
{
13
    /**
14
     * @var BankAccountInterface
15
     */
16
    protected $bankAccount;
17
18
    /**
19
     * @param BankAccountInterface $bankAccount
20
     */
21
    public function set(BankAccountInterface $bankAccount): void
22
    {
23
        $this->bankAccount = $bankAccount;
24
    }
25
26
    /**
27
     * @return BankAccountInterface
28
     */
29
    public function obtain(): BankAccountInterface
30
    {
31
        if (false == $this->bankAccount) {
32
            throw new LogicException('Bank Account could not be obtained. It has to be set before obtain.');
33
        }
34
35
        return $this->bankAccount;
36
    }
37
}
38