Passed
Push — master ( d0211e...76bea9 )
by Willy
02:05
created

WorldOfWarcraftApiFactory::getAuctionApi()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 7
ccs 0
cts 4
cp 0
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
crap 2
1
<?php
2
3
namespace Kubinashi\BattlenetApi\WorldOfWarcraft;
4
5
use Kubinashi\BattlenetApi\Model\AuthenticationModel;
6
use Kubinashi\BattlenetApi\Service\RequestService;
7
use Kubinashi\BattlenetApi\WorldOfWarcraft\AchievementApi\AchievementApi;
8
use Kubinashi\BattlenetApi\WorldOfWarcraft\AuctionApi\AuctionApi;
9
use Kubinashi\BattlenetApi\WorldOfWarcraft\CharacterProfileApi\CharacterProfileApi;
10
11
/**
12
 * @author  Willy Reiche
13
 * @since   2017-07-21
14
 * @version 1.0
15
 */
16
class WorldOfWarcraftApiFactory
17
{
18
    /**
19
     * @var AuthenticationModel
20
     */
21
    private static $authenticationModel;
22
23
    /**
24
     * @var RequestService
25
     */
26
    private static $requestService;
27
28
    /**
29
     * WorldOfWarcraftApi constructor.
30
     *
31
     * @param string $apiKey
32
     * @param string $locale
33
     * @param string $region
34
     */
35 2
    public function __construct($apiKey, $locale, $region)
36
    {
37 2
        self::$authenticationModel = new AuthenticationModel($apiKey, $locale, $region);
38 2
        self::$requestService = new RequestService();
39 2
    }
40
41
    /**
42
     * @param string $charName
43
     * @param string $realm
44
     *
45
     * @return CharacterProfileApi
46
     */
47 1
    public static function getCharacterApi($charName, $realm)
48
    {
49 1
        return new CharacterProfileApi(
50 1
            self::$authenticationModel,
51 1
            self::$requestService,
52 1
            $charName,
53
            $realm
54 1
        );
55
    }
56
57
    /**
58
     * @return AchievementApi
59
     */
60
    public static function getAchievementApi()
61
    {
62
        return new AchievementApi(
63
            self::$authenticationModel,
64
            self::$requestService
65
        );
66
    }
67
68
    /**
69
     * @return AuctionApi
70
     */
71
    public static function getAuctionApi()
72
    {
73
        return new AuctionApi(
74
            self::$authenticationModel,
75
            self::$requestService
76
        );
77
    }
78
}