Completed
Push — 8.x-1.x ( 6a50ee...0ea223 )
by Philipp
03:06 queued 01:59
created

CurrentUrl::resolveValues()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 4
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Drupal\graphql_twig\Plugin\GraphQL\Fields;
4
5
use Drupal\Core\Url;
6
use Drupal\graphql\GraphQL\Execution\ResolveContext;
7
use Drupal\graphql\Plugin\GraphQL\Fields\FieldPluginBase;
8
use GraphQL\Type\Definition\ResolveInfo;
9
10
/**
11
 * @GraphQLField(
12
 *   id = "current_url",
13
 *   name = "currentUrl",
14
 *   description = "Provides current URL at GraphQL root level.",
15
 *   type = "Url",
16
 *   arguments = {},
17
 *   secure = true,
18
 *   parents = {
19
 *     "Root",
20
 *   },
21
 *   response_cache_max_age = 0,
22
 * )
23
 */
24
class CurrentUrl extends FieldPluginBase {
25
26
  /**
27
   * {@inheritdoc}
28
   */
29
  protected function resolveValues($value, array $args, ResolveContext $context, ResolveInfo $info) {
30
    yield Url::fromRoute('<current>');
31
  }
32
33
}
34