Completed
Push — 1.0.x ( e6ac6e...9b8cfd )
by Antonio
06:50
created

BehatServiceProvider::getParameters()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 2
eloc 3
nc 2
nop 0
1
<?php
2
3
namespace NuvoleWeb\Drupal\DrupalExtension\ServiceProvider;
4
5
use Drupal\Core\DependencyInjection\ContainerBuilder;
6
use Drupal\Core\DependencyInjection\ServiceProviderBase;
7
8
/**
9
 * Class BehatServiceProvider.
10
 *
11
 * @package NuvoleWeb\Drupal\DrupalExtension\ServiceProvider
12
 */
13
class BehatServiceProvider extends ServiceProviderBase {
14
15
  /**
16
   * {@inheritdoc}
17
   */
18
  public function alter(ContainerBuilder $container) {
19
    foreach ($this->getParameters() as $name => $value) {
20
      $container->setParameter($name, $value);
21
    }
22
  }
23
24
  /**
25
   * Get parameters set in ServiceContainerContext.
26
   *
27
   * @see ServiceContainerContext::overrideParameters()
28
   *
29
   * @return array
30
   *    Array of parameters.
31
   */
32
  protected function getParameters() {
33
    $parameters = \Drupal::state()->get('nuvole_web.drupal_extension.parameter_overrides');
34
    return $parameters ? $parameters : [];
35
  }
36
37
}
38