Completed
Push — 8.1.x ( fb062c...e20c53 )
by Antonio
06:58
created

DrupalExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
dl 0
loc 54
c 0
b 0
f 0
wmc 2
lcom 0
cbo 5
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A process() 0 6 1
B configure() 0 37 1
1
<?php
2
3
namespace NuvoleWeb\Drupal\DrupalExtension\ServiceContainer;
4
5
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Drupal\DrupalExtension\ServiceContainer\DrupalExtension as OriginalDrupalExtension;
8
9
/**
10
 * Class DrupalExtension.
11
 *
12
 * @package NuvoleWeb\Drupal\DrupalExtension\ServiceContainer
13
 */
14
class DrupalExtension extends OriginalDrupalExtension {
15
16
  /**
17
   * {@inheritdoc}
18
   */
19
  public function process(ContainerBuilder $container) {
20
    parent::process($container);
21
    $container->getParameterBag()->set('drupal.driver.cores.6.class', 'NuvoleWeb\Drupal\Driver\Cores\Drupal6');
22
    $container->getParameterBag()->set('drupal.driver.cores.7.class', 'NuvoleWeb\Drupal\Driver\Cores\Drupal7');
23
    $container->getParameterBag()->set('drupal.driver.cores.8.class', 'NuvoleWeb\Drupal\Driver\Cores\Drupal8');
24
  }
25
26
  /**
27
   * {@inheritdoc}
28
   */
29
  public function configure(ArrayNodeDefinition $builder) {
30
    parent::configure($builder);
31
32
    // @codingStandardsIgnoreStart
33
    $builder->
34
      children()->
35
        arrayNode('text')->
36
          info(
37
            'Text strings, such as Log out or the Username field can be altered via behat.yml if they vary from the default values.' . PHP_EOL
38
            . '  log_out: "Sign out"' . PHP_EOL
39
            . '  log_in: "Sign in"' . PHP_EOL
40
            . '  password_field: "Enter your password"' . PHP_EOL
41
            . '  username_field: "Nickname"' . PHP_EOL
42
            . '  node_submit_label: "Save"'
43
          )->
44
          addDefaultsIfNotSet()->
45
            children()->
46
              scalarNode('log_in')->
47
                defaultValue('Log in')->
48
              end()->
49
              scalarNode('log_out')->
50
                defaultValue('Log out')->
51
              end()->
52
              scalarNode('password_field')->
53
                defaultValue('Password')->
54
              end()->
55
              scalarNode('username_field')->
56
                defaultValue('Username')->
57
              end()->
58
              scalarNode('node_submit_label')->
59
                defaultValue('Save')->
60
              end()->
61
          end()->
62
        end()->
63
      end();
64
    // @codingStandardsIgnoreEnd
65
  }
66
67
}
68