CheckRelationConfig   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 16
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A checkDisplayConfig() 0 6 3
A checkNameConfig() 0 6 3
1
<?php
2
3
namespace Anavel\Crud\Abstractor\Eloquent\Relation\Traits;
4
5
use Anavel\Crud\Abstractor\Exceptions\RelationException;
6
7
trait CheckRelationConfig
8
{
9 17
    public function checkDisplayConfig()
10
    {
11 17
        if (empty($this->config) || empty($this->config['display'])) {
0 ignored issues
show
Bug introduced by
The property config does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
12 3
            throw new RelationException('Display should be set in config');
13
        }
14 17
    }
15
16 35
    public function checkNameConfig($config)
17
    {
18 35
        if (empty($config) || empty($config['name'])) {
19 2
            throw new RelationException('Relation name should be set');
20
        }
21 35
    }
22
}
23