Passed
Pull Request — master (#9)
by Quang
04:34
created

Processor::getResponseData()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 7
nc 4
nop 0
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Digia\Lumen\GraphQL\Execution;
4
5
use Youshido\GraphQL\Execution\Processor as BaseProcessor;
6
7
class Processor extends BaseProcessor
8
{
9
10
    /**
11
     * @inheritdoc
12
     */
13
    public function getResponseData(): array
14
    {
15
        $result = [];
16
17
        if (!empty($this->data)) {
18
            $result['data'] = $this->data;
19
        }
20
21
        if ($this->executionContext->hasErrors()) {
22
            $result['errors']     = $this->executionContext->getErrorsArray();
23
            $result['exceptions'] = $this->executionContext->getErrors();
24
        }
25
26
        return $result;
27
    }
28
}
29