1 | <?php |
||
20 | class LuaAskResultProcessor { |
||
21 | |||
22 | /** |
||
23 | * Holds all possible representations of "true" in this smw instance |
||
24 | * |
||
25 | * @var array |
||
26 | */ |
||
27 | private $msgTrue; |
||
28 | |||
29 | /** |
||
30 | * This counter serves as fallback, if no label for printout is specified |
||
31 | * |
||
32 | * @var int |
||
33 | */ |
||
34 | private $numericIndex; |
||
35 | |||
36 | /** |
||
37 | * Holds the query result for this object |
||
38 | * |
||
39 | * @var QueryResult |
||
40 | */ |
||
41 | private $queryResult; |
||
42 | |||
43 | /** |
||
44 | * LuaAskResultProcessor constructor. |
||
45 | * |
||
46 | * @param QueryResult $queryResult |
||
47 | */ |
||
48 | 15 | public function __construct( QueryResult $queryResult ) { |
|
53 | |||
54 | /** |
||
55 | * Extracts the data in {@see $queryResult} and returns it as a table |
||
56 | * usable in lua context |
||
57 | * |
||
58 | * @uses getDataFromQueryResultRow |
||
59 | * |
||
60 | * @return array|null |
||
61 | */ |
||
62 | 3 | public function getProcessedResult() { |
|
77 | |||
78 | /** |
||
79 | * Extracts the data of a single result row in the {@see $queryResult} |
||
80 | * and returns it as a table usable in lua context |
||
81 | * |
||
82 | * @param array $resultRow result row as an array of {@see ResultArray} objects |
||
83 | * |
||
84 | * @uses getDataFromResultArray |
||
85 | * |
||
86 | * @return array |
||
87 | */ |
||
88 | 4 | public function getDataFromQueryResultRow( array $resultRow ) { |
|
102 | |||
103 | /** |
||
104 | * Extracts the data of a single printRequest / query field |
||
105 | * |
||
106 | * @param ResultArray $resultArray |
||
107 | * |
||
108 | * @uses getKeyFromPrintRequest, getValueFromDataValue, extractLuaDataFromDVData |
||
109 | * |
||
110 | * @return array array ( int|string, array ) |
||
111 | */ |
||
112 | public function getDataFromResultArray( ResultArray $resultArray ) { |
||
130 | |||
131 | /** |
||
132 | * Takes an smw query print request and tries to retrieve the label |
||
133 | * falls back to {@see getNumericIndex} if none was found |
||
134 | * |
||
135 | * @param PrintRequest $printRequest |
||
136 | * |
||
137 | * @uses getNumericIndex |
||
138 | * |
||
139 | * @return int|string |
||
140 | */ |
||
141 | public function getKeyFromPrintRequest( PrintRequest $printRequest ) { |
||
149 | |||
150 | /** |
||
151 | * Extracts the data of a single value of the current printRequest / query field |
||
152 | * The value is formatted according to the type of the property |
||
153 | * |
||
154 | * @param DataValue $dataValue |
||
155 | * |
||
156 | * @return mixed |
||
157 | */ |
||
158 | public function getValueFromDataValue( DataValue $dataValue ) { |
||
178 | |||
179 | /** |
||
180 | * Takes an array of data fields and returns either null, a single value or a lua table. |
||
181 | * |
||
182 | * @param array $resultArrayData |
||
183 | * |
||
184 | * @return mixed |
||
185 | */ |
||
186 | public function extractLuaDataFromDVData( $resultArrayData ) { |
||
201 | 8 | ||
202 | /** |
||
203 | * Returns current numeric index (and increases it afterwards) |
||
204 | * |
||
205 | * @uses $numericIndex |
||
206 | * |
||
207 | * @return int |
||
208 | */ |
||
209 | public function getNumericIndex() { |
||
212 | } |
||
213 |