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 | 19 | public function __construct() |
|
47 | |||
48 | /** |
||
49 | * @param $name |
||
50 | * @param $arguments |
||
51 | * @return bool|mixed |
||
52 | * @throws \Exception |
||
53 | */ |
||
54 | 19 | public function __call($name, $arguments) |
|
62 | |||
63 | /** |
||
64 | * @param $system |
||
65 | * @param array $arguments |
||
66 | * @return bool|mixed |
||
67 | */ |
||
68 | 18 | private function doCall($system, array $arguments = []) |
|
90 | |||
91 | /** |
||
92 | * @param $name |
||
93 | * @param $arguments |
||
94 | * @return bool|mixed |
||
95 | * @throws \Exception |
||
96 | */ |
||
97 | 1 | public static function __callStatic($name, $arguments) |
|
102 | |||
103 | |||
104 | /** |
||
105 | * Find an entity |
||
106 | * |
||
107 | * @param $id |
||
108 | * @param $system |
||
109 | * @param $profileType |
||
110 | * @param bool $cache |
||
111 | * @param bool $raw |
||
112 | * @return bool|mixed |
||
113 | */ |
||
114 | 18 | private function find($id, $system, $profileType, $cache = false, $raw = false) |
|
128 | |||
129 | /** |
||
130 | * @param $id |
||
131 | * @param $system |
||
132 | * @param $profileType |
||
133 | * @param $cache |
||
134 | * @return array |
||
135 | */ |
||
136 | 18 | private function getParams($id, $system, $profileType, $cache) |
|
151 | |||
152 | /** |
||
153 | * @param $response |
||
154 | * @param $profileType |
||
155 | * @param $raw |
||
156 | * |
||
157 | * @return bool|mixed |
||
158 | */ |
||
159 | 18 | private function checkResponse($response, $profileType, $raw) |
|
171 | |||
172 | /** |
||
173 | * Setup the client |
||
174 | */ |
||
175 | 19 | private static function setupClient() |
|
181 | |||
182 | /** |
||
183 | * Fills our model in with the provided data |
||
184 | * |
||
185 | * @param $model |
||
186 | * @param $fillData |
||
187 | * |
||
188 | * @return Model |
||
189 | */ |
||
190 | 18 | private function fillModel($model, $fillData) |
|
201 | } |