1 | <?php |
||
15 | final class StarCitizens |
||
16 | { |
||
17 | /** |
||
18 | * @var bool|StarCitizensClient |
||
19 | */ |
||
20 | private static $client = false; |
||
21 | |||
22 | private $systems = [ |
||
23 | "accounts" => [ |
||
24 | "base_action" => "full_profile", |
||
25 | "actions" => [ |
||
26 | "full_profile" => '\Profile', |
||
27 | "threads" => ['\Thread', '', 'thread_id'], |
||
28 | "posts" => ['\Post', 'post', 'post_id'], |
||
29 | ] |
||
30 | ] |
||
31 | ]; |
||
32 | |||
33 | /** |
||
34 | * StarCitizens constructor. |
||
35 | */ |
||
36 | 4 | public function __construct() |
|
40 | |||
41 | /** |
||
42 | * @param $name |
||
43 | * @param $arguments |
||
44 | * @return bool|mixed |
||
45 | * @throws \Exception |
||
46 | */ |
||
47 | 4 | public function __call($name, $arguments) |
|
55 | |||
56 | /** |
||
57 | * @param $name |
||
58 | * @param array $arguments |
||
59 | * @return bool|mixed |
||
60 | */ |
||
61 | 3 | private function doCall($name, array $arguments) |
|
80 | |||
81 | /** |
||
82 | * @param $id |
||
83 | * @param $system |
||
84 | * @return bool|mixed |
||
85 | */ |
||
86 | 2 | private function callBase($id, $system) |
|
90 | |||
91 | /** |
||
92 | * @param $id |
||
93 | * @param $system |
||
94 | * @param bool $action |
||
95 | * @return bool|mixed |
||
96 | */ |
||
97 | 1 | private function callAction($id, $system, $action = false) |
|
103 | |||
104 | /** |
||
105 | * @param $name |
||
106 | * @param $arguments |
||
107 | * @return bool|mixed |
||
108 | * @throws \Exception |
||
109 | */ |
||
110 | 1 | public static function __callStatic($name, $arguments) |
|
115 | |||
116 | |||
117 | /** |
||
118 | * Find an entity |
||
119 | * |
||
120 | * @param $id |
||
121 | * @param $system |
||
122 | * @param $profileType |
||
123 | * @param bool $cache |
||
124 | * @param bool $raw |
||
125 | * @return bool|mixed |
||
126 | */ |
||
127 | 3 | private function find($id, $system, $profileType, $cache = false, $raw = false) |
|
141 | |||
142 | /** |
||
143 | * @param $id |
||
144 | * @param $system |
||
145 | * @param $profileType |
||
146 | * @param $cache |
||
147 | * @return array |
||
148 | */ |
||
149 | 3 | private function getParams($id, $system, $profileType, $cache) |
|
164 | |||
165 | /** |
||
166 | * @param $response |
||
167 | * @param $profileType |
||
168 | * @param $raw |
||
169 | * |
||
170 | * @return bool|mixed |
||
171 | */ |
||
172 | 3 | private function checkResponse($response, $profileType, $raw) |
|
184 | |||
185 | /** |
||
186 | * Setup the client |
||
187 | */ |
||
188 | 4 | private static function setupClient() |
|
194 | |||
195 | /** |
||
196 | * Fills our model in with the provided data |
||
197 | * |
||
198 | * @param $model |
||
199 | * @param $fillData |
||
200 | * |
||
201 | * @return Model |
||
202 | */ |
||
203 | 3 | private function fillModel($model, $fillData) |
|
214 | } |