@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | protected function get($key = null) |
85 | 85 | { |
86 | - if($key === null) |
|
86 | + if ($key === null) |
|
87 | 87 | { |
88 | 88 | return $this->data; |
89 | 89 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | public function __call($name, $arguments) |
95 | 95 | { |
96 | - if($data = $this->get($name)) |
|
96 | + if ($data = $this->get($name)) |
|
97 | 97 | { |
98 | 98 | return $data; |
99 | 99 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $members = $this->all(); |
45 | 45 | |
46 | - return array_filter($members, function($player){ |
|
46 | + return array_filter($members, function($player) { |
|
47 | 47 | return $player->isLeader(); |
48 | 48 | })[0]; |
49 | 49 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | $members = $this->all(); |
57 | 57 | |
58 | - return array_filter($members, function($player){ |
|
58 | + return array_filter($members, function($player) { |
|
59 | 59 | return $player->isElder(); |
60 | 60 | }); |
61 | 61 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | { |
68 | 68 | $members = $this->all(); |
69 | 69 | |
70 | - return array_filter($members, function($player){ |
|
70 | + return array_filter($members, function($player) { |
|
71 | 71 | return $player->isCoLeader(); |
72 | 72 | }); |
73 | 73 | } |
@@ -116,7 +116,7 @@ |
||
116 | 116 | protected function request($url) |
117 | 117 | { |
118 | 118 | $response = $this->getHttpClient() |
119 | - ->request('GET', $url, ['headers' => ['authorization' => 'Bearer ' . $this->getToken()]]); |
|
119 | + ->request('GET', $url, ['headers' => ['authorization' => 'Bearer ' . $this->getToken()]]); |
|
120 | 120 | |
121 | 121 | return ResponseMediator::convertResponseToArray($response); |
122 | 122 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public function getClan($tag) |
33 | 33 | { |
34 | - $response = $this->request('clans/' . urlencode($tag)); |
|
34 | + $response = $this->request('clans/'.urlencode($tag)); |
|
35 | 35 | |
36 | 36 | return Clan::makeFromArray($response); |
37 | 37 | } |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | { |
48 | 48 | $params = is_array($params) ? $params : ['name' => $params]; |
49 | 49 | |
50 | - $response = $this->request('clans?' . http_build_query($params)); |
|
50 | + $response = $this->request('clans?'.http_build_query($params)); |
|
51 | 51 | |
52 | - return array_map(function($item){ |
|
52 | + return array_map(function($item) { |
|
53 | 53 | return Clan::makeFromArray($item); |
54 | 54 | }, $response['items']); |
55 | 55 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function getLocation($id) |
63 | 63 | { |
64 | - return Location::makeFromArray($this->request('locations/' . urlencode($id))); |
|
64 | + return Location::makeFromArray($this->request('locations/'.urlencode($id))); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function getLocations() |
73 | 73 | { |
74 | - return array_map(function($item){ |
|
74 | + return array_map(function($item) { |
|
75 | 75 | return Location::makeFromArray($item); |
76 | 76 | }, $this->request('locations')['items']); |
77 | 77 | } |
@@ -84,15 +84,15 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public function getRankingsForLocation($locationId, $rankingId) |
86 | 86 | { |
87 | - $url = 'locations/' . $locationId . '/rankings/' . $rankingId; |
|
87 | + $url = 'locations/'.$locationId.'/rankings/'.$rankingId; |
|
88 | 88 | |
89 | - if($rankingId == 'clans'){ |
|
90 | - return array_map(function($item){ |
|
89 | + if ($rankingId == 'clans') { |
|
90 | + return array_map(function($item) { |
|
91 | 91 | return Clan::makeFromArray($item); |
92 | 92 | }, $this->request($url)['items']); |
93 | 93 | } |
94 | 94 | |
95 | - return array_map(function($item){ |
|
95 | + return array_map(function($item) { |
|
96 | 96 | return Player::makeFromArray($item); |
97 | 97 | }, $this->request($url)['items']); |
98 | 98 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | public function getLeagues() |
106 | 106 | { |
107 | - return array_map(function($item){ |
|
107 | + return array_map(function($item) { |
|
108 | 108 | return League::makeFromArray($item); |
109 | 109 | }, $this->request('leagues')['items']); |
110 | 110 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | protected function request($url) |
117 | 117 | { |
118 | 118 | $response = $this->getHttpClient() |
119 | - ->request('GET', $url, ['headers' => ['authorization' => 'Bearer ' . $this->getToken()]]); |
|
119 | + ->request('GET', $url, ['headers' => ['authorization' => 'Bearer '.$this->getToken()]]); |
|
120 | 120 | |
121 | 121 | return ResponseMediator::convertResponseToArray($response); |
122 | 122 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function getHttpClient() |
128 | 128 | { |
129 | - if($this->httpClient === null) |
|
129 | + if ($this->httpClient === null) |
|
130 | 130 | { |
131 | 131 | $this->httpClient = new GuzzleClient(['base_uri' => 'https://api.clashofclans.com/v1/']); |
132 | 132 | } |