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

GraphqlTwigServiceProvider::alter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 9.4285
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