Passed
Pull Request — master (#19)
by
unknown
01:50
created

ClashOfClansApi::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace ClashApi
4
{
5
    use ClashApi\DataAccessLayer\WebClient;
6
    use ClashApi\Models\Player;
7
8
    class ClashOfClansApi
9
    {
10
        /**
11
         * @var WebClient to perform requests to the Clash Of Clans API
12
         */
13
        protected $webClient;
14
15
        /**
16
         * @var string  apikey  Every call to the Clash Of Clans API needs to contain an Api Key
17
         */
18
        public function __construct($apiKey)
19
        {
20
            $this->webClient = new WebClient($apiKey);
21
        }
22
23
        /**
24
         * 
25
         * @var string The player's tag (with the hasttag)
26
         */
27
        public function getPlayerByTag($tag)
28
        {
29
            $response = $this->webClient->sendRequest('/players/' . $tag);
30
31
            return new Player($response);
32
        }
33
    }
34
}