Completed
Push — master ( f67f4f...77dcfd )
by Curtis
40s queued 12s
created

Relations::getRelationValue()   A

Complexity

Conditions 4
Paths 3

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 4
eloc 4
c 1
b 0
f 0
nc 3
nop 1
dl 0
loc 8
rs 10
1
<?php
2
3
namespace App\Traits\enso\DynamicMethods;
4
5
trait Relations
6
{
7
    use Methods;
8
9
    public function getRelationValue($key)
10
    {
11
        if ($this->relationLoaded($key)) {
0 ignored issues
show
Bug introduced by
The method relationLoaded() does not exist on App\Traits\enso\DynamicMethods\Relations. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

11
        if ($this->/** @scrutinizer ignore-call */ relationLoaded($key)) {
Loading history...
12
            return $this->relations[$key];
13
        }
14
15
        if (isset(static::$dynamicMethods[$key]) || method_exists($this, $key)) {
16
            return $this->getRelationshipFromMethod($key);
0 ignored issues
show
Bug introduced by
The method getRelationshipFromMethod() does not exist on App\Traits\enso\DynamicMethods\Relations. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

16
            return $this->/** @scrutinizer ignore-call */ getRelationshipFromMethod($key);
Loading history...
17
        }
18
    }
19
}
20