AddAttributeOptionsTranslatorFunctionPlugin   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 9
c 1
b 0
f 1
dl 0
loc 40
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A translate() 0 9 1
A getName() 0 3 1
1
<?php
2
3
/**
4
 * Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\AkeneoPimMiddlewareConnector\Communication\Plugin\TranslatorFunction;
9
10
use Spryker\Zed\Kernel\Communication\AbstractPlugin;
0 ignored issues
show
Bug introduced by
The type Spryker\Zed\Kernel\Communication\AbstractPlugin 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 SprykerMiddleware\Zed\Process\Dependency\Plugin\TranslatorFunction\TranslatorFunctionPluginInterface;
0 ignored issues
show
Bug introduced by
The type SprykerMiddleware\Zed\Pr...FunctionPluginInterface 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...
12
13
/**
14
 * @method \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Communication\AkeneoPimMiddlewareConnectorCommunicationFactory getFactory()
15
 * @method \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Business\AkeneoPimMiddlewareConnectorFacadeInterface getFacade()
16
 * @method \SprykerEco\Zed\AkeneoPimMiddlewareConnector\AkeneoPimMiddlewareConnectorConfig getConfig()
17
 * @method \SprykerEco\Zed\AkeneoPimMiddlewareConnector\Persistence\AkeneoPimMiddlewareConnectorQueryContainerInterface getQueryContainer()
18
 */
19
class AddAttributeOptionsTranslatorFunctionPlugin extends AbstractPlugin implements TranslatorFunctionPluginInterface
20
{
21
    /**
22
     * @var string
23
     */
24
    protected const NAME = 'AddAttributeOptions';
25
26
    /**
27
     * {@inheritDoc}
28
     *
29
     * @api
30
     *
31
     * @return string
32
     */
33
    public function getName(): string
34
    {
35
        return static::NAME;
36
    }
37
38
    /**
39
     * {@inheritDoc}
40
     *
41
     * @api
42
     *
43
     * @param mixed $value
44
     * @param array $payload
45
     * @param string $key
46
     * @param array $options
47
     *
48
     * @return mixed
49
     */
50
    public function translate($value, array $payload, string $key, array $options)
51
    {
52
        $translatorFunction = $this->getFactory()
53
            ->createTranslatorFunctionFactory()
54
            ->createAddAttributeOptionsTranslatorFunction();
55
        $translatorFunction->setKey($key);
56
        $translatorFunction->setOptions($options);
57
58
        return $translatorFunction->translate($value, $payload);
59
    }
60
}
61