RetourQuery   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 28
dl 0
loc 41
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getQueries() 0 36 3
1
<?php
2
/**
3
 * Retour plugin for Craft CMS
4
 *
5
 * Retour allows you to intelligently redirect legacy URLs, so that you don't
6
 * lose SEO value when rebuilding & restructuring a website
7
 *
8
 * @link      https://nystudio107.com/
0 ignored issues
show
Coding Style introduced by
The tag in position 1 should be the @copyright tag
Loading history...
9
 * @copyright Copyright (c) 2019 nystudio107
0 ignored issues
show
Coding Style introduced by
@copyright tag must contain a year and the name of the copyright holder
Loading history...
10
 */
0 ignored issues
show
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
Coding Style introduced by
Missing @package tag in file comment
Loading history...
Coding Style introduced by
Missing @author tag in file comment
Loading history...
Coding Style introduced by
Missing @license tag in file comment
Loading history...
11
12
namespace nystudio107\retour\gql\queries;
13
14
use craft\gql\base\Query;
15
use GraphQL\Type\Definition\Type;
16
use nystudio107\retour\gql\arguments\RetourArguments;
17
18
use nystudio107\retour\gql\interfaces\RetourInterface;
19
use nystudio107\retour\gql\resolvers\RetourResolver;
20
use nystudio107\retour\helpers\Gql as GqlHelper;
21
22
/**
23
 * Class RetourQuery
24
 *
25
 * @author    nystudio107
0 ignored issues
show
Coding Style introduced by
The tag in position 1 should be the @package tag
Loading history...
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
Coding Style introduced by
Tag value for @author tag indented incorrectly; expected 2 spaces but found 4
Loading history...
26
 * @package   Retour
0 ignored issues
show
Coding Style introduced by
Tag value for @package tag indented incorrectly; expected 1 spaces but found 3
Loading history...
27
 * @since     3.1.26
0 ignored issues
show
Coding Style introduced by
Tag value for @since tag indented incorrectly; expected 3 spaces but found 5
Loading history...
Coding Style introduced by
The tag in position 3 should be the @author tag
Loading history...
28
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
29
class RetourQuery extends Query
30
{
31
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
Coding Style introduced by
Parameter $checkToken should have a doc-comment as per coding-style.
Loading history...
32
     * @inheritdoc
33
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
34
    public static function getQueries($checkToken = true): array
35
    {
36
        if ($checkToken && !GqlHelper::canQueryRetour()) {
37
            return [];
38
        }
39
40
        return [
41
            'retour' => [
42
                'type' => RetourInterface::getType(),
43
                'args' => RetourArguments::getArguments(),
44
                'resolve' => RetourResolver::class . '::resolve',
45
                'description' => 'This query is used to query for Retour redirects.',
46
                'deprecationReason' => 'This query is deprecated and will be removed in the future. You should use `retourResolveRedirect` instead.',
47
            ],
48
            'retourResolveRedirect' => [
49
                'type' => RetourInterface::getType(),
50
                'args' => RetourArguments::getArguments(),
51
                'resolve' => RetourResolver::class . '::resolve',
52
                'description' => 'This query is used to query for Retour redirects.',
53
            ],
54
            'retourRedirects' => [
55
                'type' => Type::listOf(RetourInterface::getType()),
56
                'args' => [
57
                    'site' => [
58
                        'name' => 'site',
59
                        'type' => Type::string(),
60
                        'description' => 'The site handle to list all redirects for.',
61
                    ],
62
                    'siteId' => [
63
                        'name' => 'siteId',
64
                        'type' => Type::int(),
65
                        'description' => 'The siteId to list all redirects for.',
66
                    ],
67
                ],
68
                'resolve' => RetourResolver::class . '::resolveAll',
69
                'description' => 'This query is used to query for all Retour redirects for a site.',
70
            ],
71
        ];
72
    }
73
}
74