|
1
|
|
|
<?php |
|
2
|
|
|
namespace Jleagle\BattleNet; |
|
3
|
|
|
|
|
4
|
|
|
use Jleagle\BattleNet\Request\AbstractBattleNet; |
|
5
|
|
|
use Jleagle\BattleNet\Responses\Diablo\ArtisanResponse; |
|
6
|
|
|
use Jleagle\BattleNet\Responses\Diablo\CareerProfileResponse; |
|
7
|
|
|
use Jleagle\BattleNet\Responses\Diablo\FollowerResponse; |
|
8
|
|
|
use Jleagle\BattleNet\Responses\Diablo\HeroProfileResponse; |
|
9
|
|
|
use Jleagle\BattleNet\Responses\Diablo\ItemResponse; |
|
10
|
|
|
|
|
11
|
|
|
class Diablo extends AbstractBattleNet |
|
12
|
|
|
{ |
|
13
|
|
|
private $_path = 'd3'; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* @param string $battleTag |
|
17
|
|
|
* |
|
18
|
|
|
* @return CareerProfileResponse |
|
19
|
|
|
*/ |
|
20
|
|
|
public function getCareerProfile($battleTag) |
|
21
|
|
|
{ |
|
22
|
|
|
$data = $this->_get($this->_path . '/profile/' . urlencode($battleTag)); |
|
23
|
|
|
return new CareerProfileResponse($data); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @param string $battleTag |
|
28
|
|
|
* @param int $id |
|
29
|
|
|
* |
|
30
|
|
|
* @return HeroProfileResponse |
|
31
|
|
|
*/ |
|
32
|
|
|
public function getHeroProfile($battleTag, $id) |
|
33
|
|
|
{ |
|
34
|
|
|
$data = $this->_get( |
|
35
|
|
|
$this->_path . '/profile/' . urlencode($battleTag) . '/hero/' . $id |
|
36
|
|
|
); |
|
37
|
|
|
return new HeroProfileResponse($data); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @param string $itemDataString |
|
42
|
|
|
* |
|
43
|
|
|
* @return ItemResponse |
|
44
|
|
|
*/ |
|
45
|
|
|
public function getItem($itemDataString) |
|
46
|
|
|
{ |
|
47
|
|
|
$data = $this->_get($this->_path . '/data/item/' . $itemDataString); |
|
48
|
|
|
return new ItemResponse($data); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @param string $follower |
|
53
|
|
|
* |
|
54
|
|
|
* @return FollowerResponse |
|
55
|
|
|
*/ |
|
56
|
|
|
public function getFollower($follower) // Todo, make enum |
|
57
|
|
|
{ |
|
58
|
|
|
$data = $this->_get($this->_path . '/data/follower/' . $follower); |
|
59
|
|
|
return new FollowerResponse($data); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @param $artisan |
|
64
|
|
|
* |
|
65
|
|
|
* @return ArtisanResponse |
|
66
|
|
|
*/ |
|
67
|
|
|
public function getArtisan($artisan) // Todo, make enum |
|
68
|
|
|
{ |
|
69
|
|
|
$data = $this->_get($this->_path . '/data/artisan/' . $artisan); |
|
70
|
|
|
return new ArtisanResponse($data); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|