Completed
Push — master ( 189007...259fd8 )
by Dmitry
08:51
created

OmnipayFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 12
ccs 1
cts 1
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A build() 0 9 1
1
<?php
2
3
namespace hiqdev\php\merchant\factories;
4
5
use Omnipay\Common\GatewayInterface;
6
use Omnipay\Common\Helper;
7
8
/**
9
 * Class OmnipayFactory
10
 *
11
 * @author Dmytro Naumenko <[email protected]>
12
 */
13
class OmnipayFactory implements GatewayFactoryInterface
14
{
15
    public function build(string $type, $parameters): GatewayInterface
16
    {
17
        $className = Helper::getGatewayClassName($type);
18
        /** @var GatewayInterface $gateway */
19
        $gateway = new $className();
20
        $gateway->initialize($parameters);
21
22
        return $gateway;
23 2
    }
24
}
25