Passed
Push — main ( 06da90...a6f07e )
by Sergey
07:41
created

EagerLoaderMultiAccessor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 9
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 9
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A __call() 0 8 3
1
<?php
2
3
namespace Gurucomkz\EagerLoading;
4
5
/**
6
 * Use this trait to allow access to the eager-loaded has_many & many_many fields.
7
 */
8
trait EagerLoaderMultiAccessor {
9
    public function __call($method, $arguments)
10
    {
11
        if($method !== 'tryEagerLoadingRelation'){
12
            if(null !== ($eagerResult = $this->tryEagerLoadingRelation($method))) {
0 ignored issues
show
Bug introduced by
The method tryEagerLoadingRelation() does not exist on Gurucomkz\EagerLoading\EagerLoaderMultiAccessor. 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

12
            if(null !== ($eagerResult = $this->/** @scrutinizer ignore-call */ tryEagerLoadingRelation($method))) {
Loading history...
13
                return $eagerResult;
14
            }
15
        }
16
        return parent::__call($method, $arguments);
17
    }
18
}
19