Conditions | 6 |
Paths | 6 |
Total Lines | 33 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types = 1); |
||
20 | public function getTextFieldPayload(DataObject $dataObject): array |
||
21 | { |
||
22 | $helper = new IndexingHelper(); |
||
23 | $fullPayload = $helper->getFieldsToIndex($dataObject); |
||
24 | |||
25 | $textPayload = []; |
||
26 | |||
27 | $keys = \array_keys($fullPayload); |
||
28 | $specsHelper = new SpecsHelper(); |
||
29 | |||
30 | foreach ($keys as $key) { |
||
31 | if ($fullPayload[$key] === []) { |
||
32 | continue; |
||
33 | } |
||
34 | |||
35 | $textPayload[$key] = []; |
||
36 | $specs = $specsHelper->getFieldSpecs($key); |
||
37 | |||
38 | foreach (\array_keys($specs) as $field) { |
||
39 | // skip link field |
||
40 | if ($field === 'Link') { |
||
41 | continue; |
||
42 | } |
||
43 | $type = $specs[$field]; |
||
44 | if (!\in_array($type, ['Varchar', 'HTMLText'], true)) { |
||
45 | continue; |
||
46 | } |
||
47 | |||
48 | $textPayload[$key][$field] = (string) $fullPayload[$key][$field]; |
||
49 | } |
||
50 | } |
||
51 | |||
52 | return $textPayload; |
||
53 | } |
||
55 |