Passed
Branch beta (1b8e35)
by Jon
07:16
created

BelongsToProject::project()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
/** Created by PhpStorm,  User: jonphipps,  Date: 2017-05-25,  Time: 1:10 PM */
4
5
namespace App\Models\Traits;
6
7
use App\Models\Project;
8
use Illuminate\Database\Eloquent\Relations\BelongsTo;
9
10
trait BelongsToProject
11
{
12
    public function project(): ?BelongsTo
13
    {
14
        return $this->belongsTo(Project::class, 'agent_id', 'id');
0 ignored issues
show
Bug introduced by
It seems like belongsTo() 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

14
        return $this->/** @scrutinizer ignore-call */ belongsTo(Project::class, 'agent_id', 'id');
Loading history...
15
    }
16
17
    public function getProjectIdAttribute($value)
1 ignored issue
show
Unused Code introduced by
The parameter $value is not used and could be removed. ( Ignorable by Annotation )

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

17
    public function getProjectIdAttribute(/** @scrutinizer ignore-unused */ $value)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
18
    {
19
        return $this->agent_id;
0 ignored issues
show
Bug Best Practice introduced by
The property agent_id does not exist on App\Models\Traits\BelongsToProject. Did you maybe forget to declare it?
Loading history...
20
    }
21
}
22