FactFinderNgImportSearchAdapter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 13
c 1
b 0
f 0
dl 0
loc 37
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getMethod() 0 3 1
A getUrl() 0 10 1
A getChannel() 0 3 1
1
<?php
2
3
/**
4
 * MIT License
5
 * For full license information, please view the LICENSE file that was distributed with this source code.
6
 */
7
8
namespace SprykerEco\Client\FactFinderNg\Api\Adapter\Http;
9
10
use Generated\Shared\Transfer\FactFinderNgRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...FinderNgRequestTransfer 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...
11
use Symfony\Component\HttpFoundation\Request;
12
13
class FactFinderNgImportSearchAdapter extends FactFinderAbstractAdapter
14
{
15
    protected const FACT_FINDER_URL_IMPORT = 'import';
16
    protected const FACT_FINDER_URL_SEARCH = 'search';
17
18
    /**
19
     * @param \Generated\Shared\Transfer\FactFinderNgRequestTransfer $factFinderNgRequestTransfer
20
     *
21
     * @return string
22
     */
23
    protected function getUrl(FactFinderNgRequestTransfer $factFinderNgRequestTransfer): string
24
    {
25
        return sprintf(
26
            '%s/%s/%s/%s/%s?channel=%s',
27
            $this->config->getFactFinderUrl(),
28
            static::FACT_FINDER_URL_TYPE_URL,
29
            static::FACT_FINDER_URL_VERSION,
30
            static::FACT_FINDER_URL_IMPORT,
31
            static::FACT_FINDER_URL_SEARCH,
32
            $this->getChannel()
33
        );
34
    }
35
36
    /**
37
     * @return string
38
     */
39
    protected function getMethod(): string
40
    {
41
        return Request::METHOD_POST;
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    protected function getChannel(): string
48
    {
49
        return $this->config->getFactFinderChannel();
50
    }
51
}
52