Completed
Push — 8.x-1.x ( 94d3ab...24f211 )
by Philipp
06:45
created

GraphqlTwigServiceProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 10
wmc 1
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A alter() 0 5 1
1
<?php
2
3
namespace Drupal\graphql_twig;
4
5
use Drupal\Core\DependencyInjection\ContainerBuilder;
6
use Drupal\Core\DependencyInjection\ServiceModifierInterface;
7
use Drupal\Core\DependencyInjection\ServiceProviderBase;
8
use Drupal\Core\DependencyInjection\ServiceProviderInterface;
9
10
/**
11
 * Service provider to inject a custom derivation of `TwigEnvironment`.
12
 */
13
class GraphqlTwigServiceProvider extends ServiceProviderBase {
14
15
  /**
16
   * {@inheritdoc}
17
   */
18
  public function alter(ContainerBuilder $container) {
19
    // Replace the twig environment with the GraphQL enhanced one.
20
    $container->getDefinition('twig')
21
      ->setClass(GraphQLTwigEnvironment::class);
22
  }
23
24
}
25