SuggestRequest::request()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 17
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 17
rs 9.9
c 0
b 0
f 0
cc 2
nc 2
nop 1
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\Handler\Request;
9
10
use Exception;
11
use FACTFinder\Util\Parameters;
12
use Generated\Shared\Transfer\FactFinderSdkSuggestRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...kSuggestRequestTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use Generated\Shared\Transfer\FactFinderSdkSuggestResponseTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...SuggestResponseTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use SprykerEco\Client\FactFinderSdk\Business\Api\ApiConstants;
15
16
class SuggestRequest extends AbstractRequest implements SuggestRequestInterface
17
{
18
    public const TRANSACTION_TYPE = ApiConstants::TRANSACTION_TYPE_SUGGEST;
19
20
    /**
21
     * @param \Generated\Shared\Transfer\FactFinderSdkSuggestRequestTransfer $factFinderSuggestRequestTransfer
22
     *
23
     * @return \Generated\Shared\Transfer\FactFinderSdkSuggestResponseTransfer
24
     */
25
    public function request(FactFinderSdkSuggestRequestTransfer $factFinderSuggestRequestTransfer)
26
    {
27
        $requestParameters = new Parameters();
28
        $requestParameters->setAll($factFinderSuggestRequestTransfer->toArray());
29
        $this->factFinderConnector->setRequestParameters($requestParameters);
30
31
        $suggestAdapter = $this->factFinderConnector->createSuggestAdapter();
32
33
        try {
34
            $responseTransfer = $this->converterFactory
35
                ->createSuggestResponseConverter($suggestAdapter)
36
                ->convert();
37
        } catch (Exception $exception) {
38
            $responseTransfer = new FactFinderSdkSuggestResponseTransfer();
39
        }
40
41
        return $responseTransfer;
42
    }
43
}
44