ObtainBankAccount   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 27
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A set() 0 4 1
A obtain() 0 8 2
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