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

EagerLoaderMultiAccessor::__call()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 4
c 1
b 0
f 0
nc 3
nop 2
dl 0
loc 8
rs 10
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