|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* MIT License |
|
5
|
|
|
* Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace SprykerEco\Client\FactFinderSdk\Business\Api\Converter\Data; |
|
9
|
|
|
|
|
10
|
|
|
use FACTFinder\Data\Record; |
|
11
|
|
|
use Generated\Shared\Transfer\FactFinderSdkDataRecordTransfer; |
|
|
|
|
|
|
12
|
|
|
use SprykerEco\Client\FactFinderSdk\Business\Api\Converter\BaseConverter; |
|
13
|
|
|
use SprykerEco\Client\FactFinderSdk\FactFinderSdkConfig; |
|
14
|
|
|
use SprykerEco\Shared\FactFinderSdk\FactFinderSdkConstants; |
|
15
|
|
|
|
|
16
|
|
|
class RecordConverter extends BaseConverter implements RecordConverterInterface |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* @var \FACTFinder\Data\Record |
|
20
|
|
|
*/ |
|
21
|
|
|
protected $record; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* @var \SprykerEco\Client\FactFinderSdk\FactFinderSdkConfig |
|
25
|
|
|
*/ |
|
26
|
|
|
private $config; |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* @param \SprykerEco\Client\FactFinderSdk\FactFinderSdkConfig $config |
|
30
|
|
|
* @param \FACTFinder\Data\Record|null $record |
|
31
|
|
|
*/ |
|
32
|
|
|
public function __construct(FactFinderSdkConfig $config, ?Record $record = null) |
|
33
|
|
|
{ |
|
34
|
|
|
$this->record = $record; |
|
35
|
|
|
$this->config = $config; |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* @param \FACTFinder\Data\Record $record |
|
40
|
|
|
* |
|
41
|
|
|
* @return void |
|
42
|
|
|
*/ |
|
43
|
|
|
public function setRecord(Record $record) |
|
44
|
|
|
{ |
|
45
|
|
|
$this->record = $record; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @return \Generated\Shared\Transfer\FactFinderSdkDataRecordTransfer |
|
50
|
|
|
*/ |
|
51
|
|
|
public function convert() |
|
52
|
|
|
{ |
|
53
|
|
|
$factFinderDataRecordTransfer = new FactFinderSdkDataRecordTransfer(); |
|
54
|
|
|
$factFinderDataRecordTransfer->setId($this->record->getID()); |
|
55
|
|
|
$factFinderDataRecordTransfer->setSimilarity($this->record->getSimilarity()); |
|
56
|
|
|
$factFinderDataRecordTransfer->setPosition($this->record->getPosition()); |
|
57
|
|
|
$factFinderDataRecordTransfer->setOriginalPosition((int)$this->record->getField(FactFinderSdkConstants::ITEM_ORIGINAL_POSITION)); |
|
58
|
|
|
$factFinderDataRecordTransfer->setSeoPath($this->record->getSeoPath()); |
|
59
|
|
|
$factFinderDataRecordTransfer->setKeywords($this->record->getKeywords()); |
|
60
|
|
|
|
|
61
|
|
|
$this->convertFields($factFinderDataRecordTransfer); |
|
62
|
|
|
|
|
63
|
|
|
return $factFinderDataRecordTransfer; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @param \Generated\Shared\Transfer\FactFinderSdkDataRecordTransfer $factFinderDataRecordTransfer |
|
68
|
|
|
* |
|
69
|
|
|
* @return void |
|
70
|
|
|
*/ |
|
71
|
|
|
protected function convertFields(FactFinderSdkDataRecordTransfer $factFinderDataRecordTransfer) |
|
72
|
|
|
{ |
|
73
|
|
|
$fields = []; |
|
74
|
|
|
foreach ($this->config->getItemFields() as $itemFieldName) { |
|
75
|
|
|
$fields[$itemFieldName] = $this->record->getField($itemFieldName); |
|
76
|
|
|
} |
|
77
|
|
|
$factFinderDataRecordTransfer->setFields($fields); |
|
78
|
|
|
} |
|
79
|
|
|
} |
|
80
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths