RootMutation   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 1
b 0
f 0
dl 0
loc 26
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFields() 0 6 1
A __construct() 0 5 1
1
<?php
2
3
namespace Bakery\Support;
4
5
use Illuminate\Support\Collection;
6
use Bakery\Types\Definitions\ObjectType;
7
8
class RootMutation extends ObjectType
9
{
10
    /**
11
     * RootQuery constructor.
12
     *
13
     * @param \Bakery\Support\TypeRegistry $registry
14
     * @param array $fields
15
     */
16
    public function __construct(TypeRegistry $registry, array $fields)
17
    {
18
        $this->fields = $fields;
19
20
        parent::__construct($registry);
21
    }
22
23
    /**
24
     * Get the fields for the type.
25
     *
26
     * @return Collection
27
     */
28
    public function getFields(): Collection
29
    {
30
        $fields = collect($this->fields);
31
32
        return $fields->map(function (RootField $field) {
33
            return $field->toArray();
34
        });
35
    }
36
}
37