Completed
Pull Request — master (#1)
by Sascha-Oliver
08:19
created

TranslationAdapterPhraseAppExtension::load()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 0
cts 14
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 12
nc 1
nop 2
crap 2
1
<?php
2
3
namespace Translation\PlatformAdapter\PhraseApp\Bridge\Symfony\DependencyInjection;
4
5
use FAPI\PhraseApp\PhraseAppClient;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
8
use Translation\PlatformAdapter\PhraseApp\PhraseApp;
9
10
/**
11
 * @author Sascha-Oliver Prolic <[email protected]>
12
 */
13
class TranslationAdapterPhraseAppExtension extends Extension
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function load(array $configs, ContainerBuilder $container)
19
    {
20
        $configuration = new Configuration($container);
0 ignored issues
show
Unused Code introduced by
The call to Configuration::__construct() has too many arguments starting with $container.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
21
        $config = $this->processConfiguration($configuration, $configs);
22
23
        $apiDef = $container->register('php_translation.adapter.phrase_app.raw');
24
        $apiDef->setClass(PhraseAppClient::class);
25
        $apiDef->addArgument($config['token']);
26
27
        $adapterDef = $container->register('php_translation.adapter.phrase_app');
28
        $adapterDef
29
            ->setClass(PhraseApp::class)
30
            ->addArgument($apiDef)
31
            ->addArgument($config['project_id'])
32
            ->addArgument($config['locale_to_id_mapping']);
33
    }
34
}
35