Relation   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A achievements() 0 3 1
A getBranchRelationValue() 0 3 1
1
<?php
2
3
namespace App\Models\Concerns\User;
4
5
use App\Models\Achievement;
0 ignored issues
show
Bug introduced by
The type App\Models\Achievement 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...
6
use App\Models\Branch;
0 ignored issues
show
Bug introduced by
The type App\Models\Branch 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 Illuminate\Database\Eloquent\Relations\HasMany;
8
use Spatie\Permission\Traits\HasRoles;
9
10
/**
11
 * @property-read \Illuminate\Database\Eloquent\Collection<\App\Models\Role> $roles
12
 *
13
 * @see \App\Models\User
14
 */
15
trait Relation
16
{
17
    use HasRoles;
18
19
    /**
20
     * Return \App\Models\Branch model relation value.
21
     *
22
     * @return \App\Models\Branch|null
23
     */
24
    public function getBranchRelationValue(): ?Branch
25
    {
26
        return $this->getRelationValue('branch');
0 ignored issues
show
Bug introduced by
It seems like getRelationValue() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

26
        return $this->/** @scrutinizer ignore-call */ getRelationValue('branch');
Loading history...
27
    }
28
29
    /**
30
     * Define a one-to-many relationship with \App\Models\Achievement.
31
     *
32
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
33
     */
34
    public function achievements(): HasMany
35
    {
36
        return $this->hasMany(Achievement::class, 'achieved_by');
0 ignored issues
show
Bug introduced by
It seems like hasMany() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

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

36
        return $this->/** @scrutinizer ignore-call */ hasMany(Achievement::class, 'achieved_by');
Loading history...
37
    }
38
}
39