ExtensionsAwareTrait::addExtension()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 1
crap 1
1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\Definition\Traits;
12
13
use Ynlo\GraphQLBundle\Definition\InterfaceExtensionDefinition;
14
15
/**
16
 * ExtensionsAwareTrait
17
 */
18
trait ExtensionsAwareTrait
19
{
20
    /**
21
     * @var string[]
22
     */
23
    protected $extensions = [];
24
25
    /**
26
     * @return InterfaceExtensionDefinition[]
27
     */
28 3
    public function getExtensions(): array
29
    {
30 3
        return $this->extensions;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->extensions returns the type string[] which is incompatible with the documented return type Ynlo\GraphQLBundle\Defin...ceExtensionDefinition[].
Loading history...
31
    }
32
33
    /**
34
     * @param string $class
35
     */
36 2
    public function addExtension($class)
37
    {
38 2
        $this->extensions[$class] = new InterfaceExtensionDefinition($class);
39 2
    }
40
}
41