Completed
Pull Request — 8.x-3.x (#550)
by Philipp
02:12
created

GraphQLServiceProvider::alter()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 9
rs 9.6666
1
<?php
2
3
namespace Drupal\graphql;
4
5
use Drupal\Core\DependencyInjection\ContainerBuilder;
6
use Drupal\Core\DependencyInjection\ServiceProviderBase;
7
8
/**
9
 * GraphQL service provider.
10
 */
11
class GraphQLServiceProvider extends ServiceProviderBase {
12
13
  /**
14
   * {@inheritdoc}
15
   */
16
  public function alter(ContainerBuilder $container) {
17
    // Replace the language negotiator with a fixed one.
18
    // Can be removed if this is fixed.
19
    // https://www.drupal.org/project/drupal/issues/2952789
20
    if ($container->hasDefinition('language_negotiator')) {
21
      $container->getDefinition('language_negotiator')
22
        ->setClass(FixedLanguageNegotiator::class);
23
    }
24
  }
25
26
}
27