Conditions | 1 |
Paths | 1 |
Total Lines | 37 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 2 |
CRAP Score | 1 |
Changes | 0 |
1 | <?php |
||
14 | 4 | public function getBody(): string |
|
15 | { |
||
16 | return <<<LUA |
||
17 | 4 | if box.space[space] == nil then |
|
18 | return nil |
||
19 | end |
||
20 | if box.space[space].index[index] == nil then |
||
21 | return nil |
||
22 | end |
||
23 | |||
24 | if #values == 0 then |
||
25 | return {} |
||
26 | end |
||
27 | |||
28 | local pk = {} |
||
29 | for i, t in pairs(box.space[space].index[0].parts) do |
||
30 | table.insert(pk, t.fieldno) |
||
31 | end |
||
32 | |||
33 | local result = {} |
||
34 | local keys = {} |
||
35 | |||
36 | for i, value in pairs(values) do |
||
37 | for j, tuple in box.space[space].index[index]:pairs(value) do |
||
38 | local key = "" |
||
39 | for i, f in pairs(pk) do |
||
40 | key = key .. tuple[f] .. '-' |
||
41 | end |
||
42 | if keys[key] == nil then |
||
43 | keys[key] = true |
||
44 | table.insert(result, tuple) |
||
45 | end |
||
46 | end |
||
47 | end |
||
48 | return result |
||
49 | LUA; |
||
50 | } |
||
51 | } |
||
52 |