Passed
Push — develop ( ff7e62...18f528 )
by Andrew
07:05 queued 10s
created

SeomaticType::resolve()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 4
dl 0
loc 5
rs 10
1
<?php
2
/**
3
 * SEOmatic plugin for Craft CMS 3.x
4
 *
5
 * A turnkey SEO implementation for Craft CMS that is comprehensive, powerful,
6
 * and flexible
7
 *
8
 * @link      https://nystudio107.com
9
 * @copyright Copyright (c) 2019 nystudio107
10
 */
11
12
namespace nystudio107\seomatic\gql\types;
13
14
use nystudio107\seomatic\gql\interfaces\SeomaticInterface;
15
16
use craft\gql\base\ObjectType;
17
18
use GraphQL\Type\Definition\ResolveInfo;
19
20
/**
21
 * Class SeomaticType
22
 *
23
 * @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...
24
 * @package   Seomatic
25
 * @since     3.2.8
0 ignored issues
show
Coding Style introduced by
The tag in position 3 should be the @author tag
Loading history...
26
 */
27
class SeomaticType extends ObjectType
28
{
29
    /**
0 ignored issues
show
Coding Style introduced by
Parameter $config should have a doc-comment as per coding-style.
Loading history...
30
     * @inheritdoc
31
     */
32
    public function __construct(array $config)
33
    {
34
        $config['interfaces'] = [
35
            SeomaticInterface::getType(),
36
        ];
37
38
        parent::__construct($config);
39
    }
40
41
    /**
0 ignored issues
show
Coding Style introduced by
Parameter $source should have a doc-comment as per coding-style.
Loading history...
Coding Style introduced by
Parameter $arguments should have a doc-comment as per coding-style.
Loading history...
Coding Style introduced by
Parameter $context should have a doc-comment as per coding-style.
Loading history...
Coding Style introduced by
Parameter $resolveInfo should have a doc-comment as per coding-style.
Loading history...
42
     * @inheritdoc
43
     */
44
    protected function resolve($source, $arguments, $context, ResolveInfo $resolveInfo)
45
    {
46
        $fieldName = SeomaticInterface::GRAPH_QL_FIELDS[$resolveInfo->fieldName];
47
48
        return $source[$fieldName];
49
    }
50
}
51