GatewayFactory   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 0
loc 19
ccs 6
cts 6
cp 1
rs 10
c 1
b 1
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A factory() 0 10 3
1
<?php
2
namespace Elastification\Client\Serializer\Gateway;
3
4
/**
5
 * @package Elastification\Client\Serializer\Gateway
6
 * @author  Mario Mueller
7
 */
8
abstract class GatewayFactory
9
{
10
    /**
11
     * @param mixed $value
12
     *
13
     * @return GatewayInterface|mixed
14
     * @author Mario Mueller
15
     */
16 276
    public static function factory($value)
17
    {
18 276
        if (is_array($value)) {
19 94
            return new NativeArrayGateway($value);
20 199
        } elseif (is_object($value)) {
21 11
            return new NativeObjectGateway($value);
22
        }
23
24 193
        return $value;
25
    }
26
}
27