Issues (645)

LanguageNegotiation/LanguageNegotiationGraphQL.php (4 issues)

Labels
Severity
1
<?php
2
3
namespace Drupal\graphql\Plugin\LanguageNegotiation;
4
5
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
0 ignored issues
show
The type Drupal\Core\Plugin\ContainerFactoryPluginInterface 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\graphql\GraphQLLanguageContext;
7
use Drupal\language\LanguageNegotiationMethodBase;
0 ignored issues
show
The type Drupal\language\LanguageNegotiationMethodBase 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 Symfony\Component\DependencyInjection\ContainerInterface;
0 ignored issues
show
The type Symfony\Component\Depend...tion\ContainerInterface 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
use Symfony\Component\HttpFoundation\Request;
0 ignored issues
show
The type Symfony\Component\HttpFoundation\Request 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...
10
11
/**
12
 * Class for identifying language from a selected language.
13
 *
14
 * @LanguageNegotiation(
15
 *   id = Drupal\graphql\Plugin\LanguageNegotiation\LanguageNegotiationGraphQL::METHOD_ID,
16
 *   weight = -999,
17
 *   name = @Translation("GraphQL context"),
18
 *   description = @Translation("The current GraphQL language context. Only available while executing a query.")
19
 * )
20
 */
21
class LanguageNegotiationGraphQL extends LanguageNegotiationMethodBase implements ContainerFactoryPluginInterface {
22
23
  /**
24
   * The graphql language context.
25
   *
26
   * @var \Drupal\graphql\GraphQLLanguageContext
27
   */
28
  protected $languageContext;
29
30
  /**
31
   * {@inheritdoc}
32
   */
33
  public static function create(
34
    ContainerInterface $container,
35
    array $configuration,
36
    $plugin_id,
37
    $plugin_definition
38
  ) {
39
    return new static($container->get('graphql.language_context'));
40
  }
41
42
  /**
43
   * LanguageNegotiationGraphQL constructor.
44
   *
45
   * @param \Drupal\graphql\GraphQLLanguageContext $languageContext
46
   *   Instance of the GraphQL language context.
47
   */
48
  public function __construct(GraphQLLanguageContext $languageContext) {
49
    $this->languageContext = $languageContext;
50
  }
51
52
  /**
53
   * The language negotiation method id.
54
   */
55
  const METHOD_ID = 'language-graphql';
56
57
  /**
58
   * {@inheritdoc}
59
   */
60
  public function getLangcode(Request $request = NULL) {
61
    return $this->languageContext->getCurrentLanguage();
62
  }
63
64
}
65