Passed
Push — feature/screening-plan ( a30cac...87436a )
by Tristan
07:23
created

AssessmentType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 4
dl 0
loc 27
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getNameAttribute() 0 3 1
A assessments() 0 3 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace App\Models\Lookup;
4
5
use Illuminate\Database\Eloquent\Model;
6
use App\Models\Assessment;
7
8
/**
9
 * Class AssessmentType
10
 * Database columns:
11
 * @property int $id
0 ignored issues
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
12
 * @property string $key
13
 * @property \Jenssegers\Date\Date $created_at
14
 * @property \Jenssegers\Date\Date $updated_at
15
 * Relations:
16
 * @property Collection[Assessment] $assessments
17
 * Accessors:
18
 * @property string $name   The localized name for this type.
19
 */
0 ignored issues
show
Documentation Bug introduced by
The doc comment Collection[Assessment] at position 1 could not be parsed: Expected ']' at position 1, but found '['.
Loading history...
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
20
class AssessmentType extends Model
21
{
22
    /**
23
     * The columns that can be filled with mass-assignment
24
     *
25
     * @var string[]
26
     */
27
    protected $fillable = [];
28
29
    /**
30
     * Get the collection of Assessments of this type.
31
     *
32
     * @return \Illuminate\Database\Eloquent\Collection
33
     */
34
    public function assessments() // phpcs:ignore
35
    {
36
        return $this->hasMany(Assessment::class);
1 ignored issue
show
Bug Best Practice introduced by
The expression return $this->hasMany(Ap...dels\Assessment::class) returns the type Illuminate\Database\Eloquent\Relations\HasMany which is incompatible with the documented return type Illuminate\Database\Eloquent\Collection.
Loading history...
37
    }
38
39
    /**
40
     * Get the localized name of this Type
41
     *
42
     * @return string
43
     */
44
    public function getNameAttribute(): string
45
    {
46
        return $this->key; //TODO: actually return a localized name
0 ignored issues
show
Bug introduced by
The property key does not seem to exist on App\Models\Lookup\AssessmentType. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
47
    }
48
}
49