1 | <?php |
||
29 | class GeneralDecoder |
||
30 | { |
||
31 | /** |
||
32 | * standard keys, the type is indicated as value |
||
33 | * @var string[] |
||
34 | */ |
||
35 | static private $keys = array('apiKey'=>"string", "class"=>"string", "method"=>"string", "parameters"=>"array"); |
||
36 | |||
37 | /** |
||
38 | * get the array of return keys |
||
39 | * @return \string[] |
||
40 | */ |
||
41 | final static protected function getKeys() |
||
45 | |||
46 | /** |
||
47 | * Decode the data into a standard array that contains apiKey, class and method name and array of paramters |
||
48 | * @param mixed $data |
||
49 | * @return array |
||
50 | * @throws ApiReflectionException |
||
51 | */ |
||
52 | public function decodeData($data) |
||
58 | |||
59 | |||
60 | /** |
||
61 | * check if the keys of an array for return is valid |
||
62 | * @param array $data |
||
63 | * @return bool true if and only if the array is standard |
||
64 | */ |
||
65 | protected static function isValid($data) |
||
69 | |||
70 | /** |
||
71 | * check if two array are equals even if the elements order is different |
||
72 | * @param array $a |
||
73 | * @param array $b |
||
74 | * @return bool true if the two array are equals |
||
75 | */ |
||
76 | final protected static function arrayEquals($a, $b) { |
||
79 | |||
80 | /** |
||
81 | * check if data follow the types indicated in $types |
||
82 | * @param array $data |
||
83 | * @param array $types |
||
84 | * @return bool true if the check is ok |
||
85 | */ |
||
86 | final protected static function checkTypes($data, $types) |
||
101 | } |