1 | <?php |
||
5 | class WSIUtils |
||
6 | { |
||
7 | /** |
||
8 | * Do modifications with response for collection requests |
||
9 | * Fix issues related to specific results in WSI mode |
||
10 | * |
||
11 | * @param mixed $response |
||
12 | * |
||
13 | * @return array |
||
14 | */ |
||
15 | public static function processCollectionResponse($response) |
||
16 | { |
||
17 | if (!is_array($response)) { |
||
18 | if ($response && is_object($response)) { |
||
19 | // response is object, but might be empty in case when no data in WSI mode |
||
20 | $data = get_object_vars($response); |
||
21 | if (empty($data)) { |
||
22 | $response = []; |
||
23 | } else { |
||
24 | // single result in WSI mode |
||
25 | $response = [$response]; |
||
26 | } |
||
27 | } else { |
||
28 | // for empty results in Soap V2 |
||
29 | $response = []; |
||
30 | } |
||
31 | } |
||
32 | |||
33 | return $response; |
||
34 | } |
||
35 | |||
36 | /** |
||
37 | * @param array $response |
||
38 | * @return array |
||
39 | */ |
||
40 | public static function convertResponseToMultiArray($response) |
||
48 | |||
49 | /** |
||
50 | * Parse WSI response and nested data |
||
51 | * |
||
52 | * @param mixed $result |
||
53 | * @param bool $defaultNull if not found in result node return null |
||
54 | * |
||
55 | * @return null |
||
56 | */ |
||
57 | public static function parseWSIResponse($result, $defaultNull = true) |
||
84 | } |
||
85 |