DataRequest::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 2
eloc 5
nc 2
nop 3
1
<?php namespace StarCraftApiClient\Requests;
2
3
use StarCraftApiClient\Client;
4
5
/**
6
 * @author neun
7
 * @since  2015-10-25
8
 */
9
class DataRequest extends Request
10
{
11
12
    /**
13
     * DataRequest constructor.
14
     * @param Client $client
15
     * @param string $type
16
     * @param $region
17
     */
18
    public function __construct($client, $type, $region)
19
    {
20
        $url = 'https://%s.api.battle.net/sc2/data/%s?locale=%s&apikey=%s';
21
22
        if (in_array($type, ['achievements', 'rewards'])) {
23
            $this->url =
24
                sprintf($url, $region, $type, $client->language(), $client->apiToken());
25
        }
26
    }
27
}
28