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

RequestFactory::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 11
rs 9.4285
cc 1
eloc 9
nc 1
nop 3
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