Passed
Pull Request — 1.x (#4)
by David
11:19
created

TdbmObjectType   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 2
dl 0
loc 26
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getFieldList() 0 4 1
A showAll() 0 6 2
A hideAll() 0 6 2
1
<?php
2
3
4
namespace TheCodingMachine\Tdbm\GraphQL;
5
6
7
use Youshido\GraphQL\Type\Object\AbstractObjectType;
8
9
abstract class TdbmObjectType extends AbstractObjectType
10
{
11
    /**
12
     * Returns the list of fields coming from TDBM beans.
13
     *
14
     * @return Field[]
15
     */
16
    protected function getFieldList(): array
17
    {
18
        return [];
19
    }
20
21
    protected function showAll(): void
22
    {
23
        foreach ($this->getFieldList() as $field) {
24
            $field->show();
25
        }
26
    }
27
28
    protected function hideAll(): void
29
    {
30
        foreach ($this->getFieldList() as $field) {
31
            $field->hide();
32
        }
33
    }
34
}
35