__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the ekino Drupal Debug project.
7
 *
8
 * (c) ekino
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Ekino\Drupal\Debug\Configuration;
15
16
use Ekino\Drupal\Debug\Configuration\Model\DefaultsConfiguration as DefaultsConfigurationModel;
17
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
18
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
19
20
class SubstituteOriginalDrupalKernelConfiguration extends AbstractConfiguration
21
{
22
    /**
23
     * @var string
24
     */
25
    public const ROOT_KEY = 'substitute_original_drupal_kernel';
26
27
    private $defaultsConfiguration;
28
29 19
    public function __construct(DefaultsConfigurationModel $defaultsConfiguration)
30
    {
31 19
        $this->defaultsConfiguration = $defaultsConfiguration;
32 19
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37 19
    public function getArrayNodeDefinition(TreeBuilder $treeBuilder): ArrayNodeDefinition
38
    {
39
        /** @var ArrayNodeDefinition $rootNode */
40 19
        $rootNode = $treeBuilder->root(self::ROOT_KEY);
41
42
        $rootNode
43 19
            ->info("It is recommended to disable the original DrupalKernel substitution to run your tests.\nTo programmatically toggle it, use the two dedicated composer commands.")
44 19
            ->canBeDisabled()
45 19
            ->children()
46 19
                ->scalarNode('composer_autoload_file_path')
47 19
                    ->cannotBeEmpty()
48 19
                    ->defaultValue('vendor/autoload.php')
49 19
                ->end()
50 19
                ->scalarNode('cache_directory_path')
0 ignored issues
show
Bug introduced by
The method scalarNode() does not exist on Symfony\Component\Config...der\NodeParentInterface. It seems like you code against a sub-type of Symfony\Component\Config...der\NodeParentInterface such as Symfony\Component\Config...ion\Builder\NodeBuilder. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

50
                ->/** @scrutinizer ignore-call */ scalarNode('cache_directory_path')
Loading history...
51 19
                    ->info('If not specified, it fall backs to the default cache directory path.')
52 19
                    ->defaultValue($this->defaultsConfiguration->getCacheDirectoryPath())
53 19
                ->end()
54 19
          ->end();
55
56 19
        return $rootNode;
57
    }
58
}
59