@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * Base url |
17 | 17 | */ |
18 | - const APIURL = "http://sc-api.com"; |
|
18 | + const APIURL = "http://sc-api.com"; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @var Client |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function getResult($params = []) |
46 | 46 | { |
47 | - $request = new Request("GET", '?'.http_build_query($params)); |
|
47 | + $request = new Request("GET", '?' . http_build_query($params)); |
|
48 | 48 | return $this->client->send($request); |
49 | 49 | } |
50 | 50 | } |
51 | 51 | \ No newline at end of file |
@@ -12,7 +12,7 @@ |
||
12 | 12 | public $thread_id; |
13 | 13 | public $thread_replies; |
14 | 14 | public $thread_views; |
15 | - public $original_poster=[]; |
|
15 | + public $original_poster = []; |
|
16 | 16 | public $original_post = []; |
17 | 17 | public $recent_poster = []; |
18 | 18 | public $recent_post; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
54 | - * @param $id |
|
54 | + * @param string $id |
|
55 | 55 | * @param bool $cache |
56 | 56 | * @param bool $raw |
57 | 57 | * |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
66 | - * @param $id |
|
66 | + * @param string $id |
|
67 | 67 | * @param bool $cache |
68 | 68 | * @param bool $raw |
69 | 69 | * |
@@ -38,7 +38,7 @@ |
||
38 | 38 | */ |
39 | 39 | protected static function find($id, $action = Organisations::ORG, $cache = false, $raw = false) |
40 | 40 | { |
41 | - $cache = ($cache === true)? "cache" : "live"; |
|
41 | + $cache = ($cache === true) ? "cache" : "live"; |
|
42 | 42 | |
43 | 43 | $params = [ |
44 | 44 | 'api_source' => $cache, |
@@ -46,11 +46,12 @@ discard block |
||
46 | 46 | ]; |
47 | 47 | |
48 | 48 | $response = json_decode(self::$client->getResult($params)->getBody()->getContents(), true); |
49 | - if ($response['request_stats']['query_status'] == "success") |
|
50 | - if ($raw === true) |
|
49 | + if ($response['request_stats']['query_status'] == "success") { |
|
50 | + if ($raw === true) |
|
51 | 51 | return $response; |
52 | - else |
|
53 | - return self::fillModel($profileType, $response['data']); |
|
52 | + } else { |
|
53 | + return self::fillModel($profileType, $response['data']); |
|
54 | + } |
|
54 | 55 | |
55 | 56 | return false; |
56 | 57 | } |
@@ -60,8 +61,9 @@ discard block |
||
60 | 61 | */ |
61 | 62 | private static function setupClient() |
62 | 63 | { |
63 | - if (static::$client === false) |
|
64 | - static::$client = new StarCitizensClient(); |
|
64 | + if (static::$client === false) { |
|
65 | + static::$client = new StarCitizensClient(); |
|
66 | + } |
|
65 | 67 | } |
66 | 68 | |
67 | 69 | /** |
@@ -156,8 +156,9 @@ discard block |
||
156 | 156 | { |
157 | 157 | if ($this->threads === null) { |
158 | 158 | $threads = Accounts::findThreads($this->handle); |
159 | - if ($threads instanceof Store) |
|
160 | - $this->threads = $threads; |
|
159 | + if ($threads instanceof Store) { |
|
160 | + $this->threads = $threads; |
|
161 | + } |
|
161 | 162 | } |
162 | 163 | |
163 | 164 | |
@@ -172,8 +173,9 @@ discard block |
||
172 | 173 | { |
173 | 174 | if ($this->posts === null) { |
174 | 175 | $posts = Accounts::findPosts($this->handle); |
175 | - if ($posts instanceof Store) |
|
176 | - $this->posts = $posts; |
|
176 | + if ($posts instanceof Store) { |
|
177 | + $this->posts = $posts; |
|
178 | + } |
|
177 | 179 | } |
178 | 180 | |
179 | 181 | return $this->posts; |
@@ -186,8 +188,9 @@ discard block |
||
186 | 188 | */ |
187 | 189 | public function with(...$types) { |
188 | 190 | foreach ($types as $type) { |
189 | - if (method_exists($this, strtolower($type))) |
|
190 | - call_user_func([$this, $type]); |
|
191 | + if (method_exists($this, strtolower($type))) { |
|
192 | + call_user_func([$this, $type]); |
|
193 | + } |
|
191 | 194 | } |
192 | 195 | |
193 | 196 | return $this; |
@@ -29,10 +29,11 @@ discard block |
||
29 | 29 | { |
30 | 30 | $this->className = 'StarCitizen\Models' . $className; |
31 | 31 | foreach ($data as $item) { |
32 | - if ($dataRoot != '') |
|
33 | - $objectData = $item[$dataRoot]; |
|
34 | - else |
|
35 | - $objectData = $item; |
|
32 | + if ($dataRoot != '') { |
|
33 | + $objectData = $item[$dataRoot]; |
|
34 | + } else { |
|
35 | + $objectData = $item; |
|
36 | + } |
|
36 | 37 | |
37 | 38 | $storageObject = new \ReflectionClass('StarCitizen\Models' . $className); |
38 | 39 | $this->offsetSet($objectData[$idName], $storageObject->newInstance($objectData)); |
@@ -54,8 +55,9 @@ discard block |
||
54 | 55 | */ |
55 | 56 | public function offsetExists($offset) |
56 | 57 | { |
57 | - if (array_key_exists($offset, $this->items)) |
|
58 | - return true; |
|
58 | + if (array_key_exists($offset, $this->items)) { |
|
59 | + return true; |
|
60 | + } |
|
59 | 61 | |
60 | 62 | return false; |
61 | 63 | } |
@@ -67,8 +69,9 @@ discard block |
||
67 | 69 | */ |
68 | 70 | public function offsetGet($offset) |
69 | 71 | { |
70 | - if ($this->offsetExists($offset)) |
|
71 | - return $this->items[$offset]; |
|
72 | + if ($this->offsetExists($offset)) { |
|
73 | + return $this->items[$offset]; |
|
74 | + } |
|
72 | 75 | |
73 | 76 | return false; |
74 | 77 | } |
@@ -79,8 +82,9 @@ discard block |
||
79 | 82 | */ |
80 | 83 | public function offsetSet($offset, $value) |
81 | 84 | { |
82 | - if ($value instanceof $this->className) |
|
83 | - $this->items[$offset] = $value; |
|
85 | + if ($value instanceof $this->className) { |
|
86 | + $this->items[$offset] = $value; |
|
87 | + } |
|
84 | 88 | } |
85 | 89 | |
86 | 90 | /** |
@@ -88,8 +92,9 @@ discard block |
||
88 | 92 | */ |
89 | 93 | public function offsetUnset($offset) |
90 | 94 | { |
91 | - if ($this->offsetExists($offset) && isset($this->items[$offset])) |
|
92 | - unset ($this->items[$offset]); |
|
95 | + if ($this->offsetExists($offset) && isset($this->items[$offset])) { |
|
96 | + unset ($this->items[$offset]); |
|
97 | + } |
|
93 | 98 | } |
94 | 99 | |
95 | 100 | /** |