|
1
|
|
|
<?php |
|
2
|
|
|
namespace Atog\PHPokemon; |
|
3
|
|
|
|
|
4
|
|
|
use Atog\Api\Client as AbstractClient; |
|
5
|
|
|
use Atog\PHPokemon\Endpoints; |
|
6
|
|
|
use \Atog\PHPokemon\Models; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Class Client |
|
10
|
|
|
* @property-read \Atog\PHPokemon\Endpoints\Pokedex pokedex |
|
11
|
|
|
* @property-read \Atog\PHPokemon\Endpoints\Pokemon pokemon |
|
12
|
|
|
* @property-read \Atog\PHPokemon\Endpoints\Types types |
|
13
|
|
|
* @property-read \Atog\PHPokemon\Endpoints\Moves moves |
|
14
|
|
|
* @property-read \Atog\PHPokemon\Endpoints\Abilities abilities |
|
15
|
|
|
* @property-read \Atog\PHPokemon\Endpoints\EggGroups eggGroups |
|
16
|
|
|
* @property-read \Atog\PHPokemon\Endpoints\Descriptions descriptions |
|
17
|
|
|
* @package Atog\PHPokemon |
|
18
|
|
|
*/ |
|
19
|
|
|
class Client extends AbstractClient |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* @var $abilities |
|
23
|
|
|
*/ |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @var string |
|
27
|
|
|
*/ |
|
28
|
|
|
protected $domain = 'http://pokeapi.co/api/v1'; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Client constructor. |
|
32
|
|
|
* @param array $endpoints |
|
33
|
|
|
* @param array $config |
|
34
|
|
|
*/ |
|
35
|
|
|
public function __construct(array $endpoints = [], array $config = []) |
|
36
|
|
|
{ |
|
37
|
|
|
$defaultEndpoints = [ |
|
38
|
|
|
Endpoints\Pokedex::class, |
|
39
|
|
|
Endpoints\Pokemon::class, |
|
40
|
|
|
Endpoints\Types::class, |
|
41
|
|
|
Endpoints\Moves::class, |
|
42
|
|
|
Endpoints\Abilities::class, |
|
43
|
|
|
Endpoints\EggGroups::class, |
|
44
|
|
|
Endpoints\Descriptions::class |
|
45
|
|
|
]; |
|
46
|
|
|
$models = [ |
|
47
|
|
|
'Pokedex' => Models\Pokedex::class, |
|
48
|
|
|
'Pokemon' => Models\Pokemon::class, |
|
49
|
|
|
'Types' => Models\Types::class, |
|
50
|
|
|
'Moves' => Models\Moves::class, |
|
51
|
|
|
'Abilities' => Models\Abilities::class, |
|
52
|
|
|
'EggGroups' => Models\EggGroups::class, |
|
53
|
|
|
'Descriptions' => Models\Descriptions::class |
|
54
|
|
|
]; |
|
55
|
|
|
|
|
56
|
|
|
$config['models'] = $models; |
|
57
|
|
|
parent::__construct(array_merge($defaultEndpoints, $endpoints), $config); |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|