Completed
Push — master ( f18332...65e840 )
by Gabriel
03:52
created

RequestFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A set() 0 4 1
A create() 0 11 1
1
<?php
2
3
namespace ThreePlCentral;
4
5
class RequestFactory
6
{
7
    private static $class = Request::class;
8
9
    public static function set(string $class)
10
    {
11
        self::$class = $class;
12
    }
13
14
    public static function create(ThreePlCentral $threepl, string $method, string $url): RequestInterface
15
    {
16
        $classname = self::$class;
17
        $instance = new $classname($method, $url);
18
        $instance->setId($threepl->getId());
19
        $instance->setCustomerId($threepl->getCustomerId());
20
        $instance->setFacilityId($threepl->getFacilityId());
21
        $instance->setLogin($threepl->getLogin());
22
        $instance->setPassword($threepl->getPassword());
23
        return $instance;
24
    }
25
}
26