1 | <?php |
||
29 | class GeneralEncoder |
||
30 | { |
||
31 | const MATRIX = "matrix"; |
||
32 | const TEXT = "text"; |
||
33 | const GENERAL_RETURN = "generalReturn"; |
||
34 | |||
35 | /** |
||
36 | * Encode the return of each method into a string |
||
37 | * @param mixed $methodReturn return of method called by reflection |
||
38 | * @return string |
||
39 | */ |
||
40 | public function stringEncode($methodReturn) |
||
46 | |||
47 | /** |
||
48 | * Encode the return of each method into a associative matrix |
||
49 | * @param mixed $methodReturn return of method called by reflection |
||
50 | * @return array |
||
51 | */ |
||
52 | public function matrixEncode($methodReturn) |
||
56 | |||
57 | /** |
||
58 | * Encode a complex/simple data into an array with information for each element |
||
59 | * @param $data |
||
60 | * @param $name |
||
61 | * @return string |
||
62 | * @see encodeElement |
||
63 | */ |
||
64 | final static protected function encodeData($data, $name = self::GENERAL_RETURN){ |
||
76 | |||
77 | /** |
||
78 | * encode an element (can be a complex element such as an array) into a array with name and type information |
||
79 | * @param mixed $value |
||
80 | * @param string $name |
||
81 | * @param string $type |
||
82 | * @return array |
||
83 | */ |
||
84 | final static protected function encodeElement($value, $name = "", $type = self::TEXT) |
||
88 | } |