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 | "organizations" => [ |
||
32 | "base_action" => "single_organization", |
||
33 | "actions" => [ |
||
34 | "single_organization" => '\Organisation', |
||
35 | "organization_members" => ['\OrgMember', '', 'handle'] |
||
36 | ] |
||
37 | ], |
||
38 | ]; |
||
39 | |||
40 | /** |
||
41 | * StarCitizens constructor. |
||
42 | */ |
||
43 | 20 | public function __construct() |
|
47 | |||
48 | /** |
||
49 | * @param $name |
||
50 | * @param $arguments |
||
51 | * @return bool|mixed |
||
52 | * @throws \Exception |
||
53 | */ |
||
54 | 20 | public function __call($name, $arguments) |
|
62 | |||
63 | /** |
||
64 | * @param $system |
||
65 | * @param array $arguments |
||
66 | * @return bool|mixed |
||
67 | */ |
||
68 | 19 | private function doCall($system, array $arguments = []) |
|
79 | |||
80 | /** |
||
81 | * @param array $arguments |
||
82 | * @return array |
||
83 | */ |
||
84 | 19 | private function standardFindArguments(array $arguments) |
|
108 | |||
109 | /** |
||
110 | * @param $name |
||
111 | * @param $arguments |
||
112 | * @return bool|mixed |
||
113 | * @throws \Exception |
||
114 | */ |
||
115 | 1 | public static function __callStatic($name, $arguments) |
|
120 | |||
121 | |||
122 | /** |
||
123 | * Find an entity |
||
124 | * |
||
125 | * @param $id |
||
126 | * @param $system |
||
127 | * @param $profileType |
||
128 | * @param bool $cache |
||
129 | * @param bool $raw |
||
130 | * @return bool|mixed |
||
131 | */ |
||
132 | 19 | private function find($id, $system, $profileType, $cache = false, $raw = false) |
|
146 | |||
147 | /** |
||
148 | * @param $id |
||
149 | * @param $system |
||
150 | * @param $profileType |
||
151 | * @param $cache |
||
152 | * @return array |
||
153 | */ |
||
154 | 19 | private function getParams($id, $system, $profileType, $cache) |
|
169 | |||
170 | /** |
||
171 | * @param $response |
||
172 | * @param $profileType |
||
173 | * @param $raw |
||
174 | * |
||
175 | * @return bool|mixed |
||
176 | */ |
||
177 | 19 | private function checkResponse($response, $profileType, $raw) |
|
189 | |||
190 | /** |
||
191 | * Setup the client |
||
192 | */ |
||
193 | 20 | private static function setupClient() |
|
199 | |||
200 | /** |
||
201 | * Fills our model in with the provided data |
||
202 | * |
||
203 | * @param $model |
||
204 | * @param $fillData |
||
205 | * |
||
206 | * @return Model |
||
207 | */ |
||
208 | 19 | private function fillModel($model, $fillData) |
|
219 | } |