Test Failed
Pull Request — master (#23)
by
unknown
10:17
created

RelationLoader   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 4
dl 0
loc 8
ccs 0
cts 4
cp 0
rs 10
c 2
b 1
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 6 2
1
<?php
2
3
namespace Rexlabs\Laravel\Smokescreen\Relations;
4
5
use Illuminate\Database\Eloquent\Collection;
6
use Rexlabs\Smokescreen\Relations\RelationLoaderInterface;
0 ignored issues
show
Bug introduced by
The type Rexlabs\Smokescreen\Rela...RelationLoaderInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use Rexlabs\Smokescreen\Resource\ResourceInterface;
0 ignored issues
show
Bug introduced by
The type Rexlabs\Smokescreen\Resource\ResourceInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
9
/**
10
 * Laravel implementation for loading relationships.
11
 * Smokescreen will call this automatically for all resources.
12
 */
13
class RelationLoader implements RelationLoaderInterface
14
{
15
    public function load(ResourceInterface $resource, array $relationshipKeys)
16
    {
17
        // Eager load relationships on collections
18
        $obj = $resource->getData();
19
        if ($obj instanceof Collection) {
20
            $obj->loadMissing($relationshipKeys);
21
        }
22
    }
23
}
24