Issues (645)

src/Config/GraphQLConfigOverrides.php (4 issues)

1
<?php
2
3
namespace Drupal\graphql\Config;
4
5
use Drupal\Core\Cache\CacheableMetadata;
0 ignored issues
show
The type Drupal\Core\Cache\CacheableMetadata was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Drupal\Core\Config\ConfigFactoryOverrideInterface;
0 ignored issues
show
The type Drupal\Core\Config\ConfigFactoryOverrideInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Drupal\Core\Config\StorageInterface;
0 ignored issues
show
The type Drupal\Core\Config\StorageInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Drupal\language\LanguageNegotiationMethodManager;
0 ignored issues
show
The type Drupal\language\LanguageNegotiationMethodManager was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
10
/**
11
 * GraphQL config overrides.
12
 *
13
 * Enforce the GraphQL language negotiation always to be on top.
14
 */
15
class GraphQLConfigOverrides implements ConfigFactoryOverrideInterface {
16
17
  /**
18
   * The config storage service.
19
   *
20
   * @var \Drupal\Core\Config\StorageInterface
21
   */
22
  protected $baseStorage;
23
24
  /**
25
   * The negotiator manager service.
26
   *
27
   * @var \Drupal\language\LanguageNegotiationMethodManager|null
28
   */
29
  protected $negotiatorManager;
30
31
  /**
32
   * GraphQLConfigOverrides constructor.
33
   *
34
   * @param \Drupal\Core\Config\StorageInterface $storage
35
   *   The config storage service.
36
   * @param \Drupal\language\LanguageNegotiationMethodManager|null $negotiatorManager
37
   */
38
  public function __construct(StorageInterface $storage, LanguageNegotiationMethodManager $negotiatorManager = NULL) {
39
    $this->baseStorage = $storage;
40
    $this->negotiatorManager = $negotiatorManager;
41
  }
42
43
  /**
44
   * {@inheritdoc}
45
   */
46
  public function loadOverrides($names) {
47
    if (
48
      $this->negotiatorManager &&
49
      in_array('language.types', $names)
50
      && $this->negotiatorManager->hasDefinition('language-graphql')
51
      && $config = $this->baseStorage->read('language.types')
52
    ) {
53
      foreach (array_keys($config['negotiation']) as $type) {
54
        $config['negotiation'][$type]['enabled']['language-graphql'] = -999;
55
        asort($config['negotiation'][$type]['enabled']);
56
      }
57
      return ['language.types' => $config];
58
    }
59
    return [];
60
  }
61
62
  /**
63
   * {@inheritdoc}
64
   */
65
  public function getCacheSuffix() {
66
    return 'graphql';
67
  }
68
69
  /**
70
   * {@inheritdoc}
71
   */
72
  public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) {
73
    return NULL;
74
  }
75
76
  /**
77
   * {@inheritdoc}
78
   */
79
  public function getCacheableMetadata($name) {
80
    return new CacheableMetadata();
81
  }
82
83
}
84