Completed
Push — master ( d52ee7...e7842c )
by Alexandr
03:54
created

ConfigAwareTrait::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
ccs 2
cts 2
cp 1
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
/*
3
 * This file is a part of GraphQL project.
4
 *
5
 * @author Alexandr Viniychuk <[email protected]>
6
 * created: 2:02 PM 5/13/16
7
 */
8
9
namespace Youshido\GraphQL\Config\Traits;
10
11
12
use Youshido\GraphQL\Config\AbstractConfig;
13
use Youshido\GraphQL\Config\Field\FieldConfig;
14
use Youshido\GraphQL\Config\Field\InputFieldConfig;
15
use Youshido\GraphQL\Config\Object\ObjectTypeConfig;
16
17
trait ConfigAwareTrait
18
{
19
20
    /** @var AbstractConfig|ObjectTypeConfig|FieldConfig|InputFieldConfig */
21
    protected $config;
22
23 30
    public function getConfig()
24
    {
25 30
        return $this->config;
26
    }
27
28 53
    protected function getConfigValue($key, $defaultValue = null)
29
    {
30 53
        return !empty($this->config) ? $this->config->get($key, $defaultValue) : $defaultValue;
31
    }
32
33 9
    public function getDescription()
34
    {
35 9
        return $this->getConfigValue('description');
36
    }
37
38
}
39