Completed
Push — master ( 3bf3f8...6817df )
by Steven
13s
created

ClientFactory::makeWith()   A

Complexity

Conditions 4
Paths 6

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.2
c 0
b 0
f 0
cc 4
eloc 10
nc 6
nop 2
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