Completed
Pull Request — master (#20)
by Steven
07:01 queued 05:18
created

ClientFactory   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A makeWith() 0 15 4
1
<?php namespace Stevenmaguire\Yelp;
2
3
class ClientFactory
4
{
5
    public static function makeWith(array $options = array(), $version = null)
6
    {
7
        if (is_null($version)) {
8
            $version = Version::TWO;
9
        }
10
11
        switch ($version) {
12
            case Version::TWO:
13
                return new v2\Client($options);
14
            case Version::THREE:
15
                return new v3\Client($options);
16
            default:
17
                throw new Exception\InvalidVersionException;
18
        }
19
    }
20
}
21