Exchange   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 46
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getFactory() 0 8 2
A setFactory() 0 4 1
A __callStatic() 0 4 1
1
<?php
2
3
namespace CryptoMarkets;
4
5
use CryptoMarkets\Common\GatewayFactory;
6
7
class Exchange
8
{
9
    /**
10
     * The gateway factory instance.
11
     *
12
     * @var GatewayFactory
13
     */
14
    private static $factory;
15
16
    /**
17
     * Get the gateway factory instance.
18
     *
19
     * @return GatewayFactory
20
     */
21
    public static function getFactory()
22
    {
23
        if (is_null(self::$factory)) {
24
            self::$factory = new GatewayFactory;
25
        }
26
27
        return self::$factory;
28
    }
29
30
    /**
31
     * Set the gateway factory instance.
32
     *
33
     * @param  GatewayFactory
34
     * @return void
35
     */
36
    public static function setFactory(GatewayFactory $factory = null)
37
    {
38
        self::$factory = $factory;
39
    }
40
41
    /**
42
     * Handle dynamic static method calls into the method.
43
     *
44
     * @param  string  $method
45
     * @param  array  $parameters
46
     * @return mixed
47
     */
48
    public static function __callStatic($method, $parameters)
49
    {
50
        return (self::getFactory())->$method(...$parameters);
51
    }
52
}
53