Passed
Push — feature/screening-plan ( 87436a...16ec65 )
by Tristan
09:00 queued 02:03
created

Criteria::assessments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 2
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * Created by Reliese Model.
5
 * Date: Thu, 12 Jul 2018 22:39:27 +0000.
6
 */
0 ignored issues
show
Coding Style introduced by
Missing @link tag in file comment
Loading history...
Coding Style introduced by
Missing @category tag in file comment
Loading history...
Coding Style introduced by
Missing @author tag in file comment
Loading history...
Coding Style introduced by
PHP version not specified
Loading history...
Coding Style introduced by
Missing @package tag in file comment
Loading history...
Coding Style introduced by
Missing @license tag in file comment
Loading history...
7
8
namespace App\Models;
9
use App\Models\Lookup\CriteriaTypeTranslation;
10
11
/**
12
 * Class Criteria
13
 *
14
 * @property int $id
15
 * @property int $criteria_type_id
16
 * @property int $job_poster_id
17
 * @property int $skill_id
18
 * @property int $skill_level_id
19
 * @property \Jenssegers\Date\Date $created_at
20
 * @property \Jenssegers\Date\Date $updated_at
21
 *
22
 * @property \App\Models\Lookup\CriteriaType $criteria_type
23
 * @property \App\Models\JobPoster $job_poster
24
 * @property \App\Models\Skill $skill
25
 * @property \App\Models\Lookup\SkillLevel $skill_level
26
 * @property \Illuminate\Database\Eloquent\Collection $criteria_translations
27
 * @property \Illuminate\Database\Eloquent\Collection[Assessment] $assessments
28
 *
29
 *  Accessors
30
 * @property string $type
31
 *
32
 *  Localized Properties:
33
  * @property string $description
0 ignored issues
show
Coding Style introduced by
Expected 1 space(s) before asterisk; 2 found
Loading history...
34
 */
0 ignored issues
show
Documentation Bug introduced by
The doc comment \Illuminate\Database\Elo...\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...
35
class Criteria extends BaseModel {
0 ignored issues
show
Coding Style introduced by
Opening brace of a class must be on the line after the definition
Loading history...
36
37
    use \Dimsav\Translatable\Translatable;
0 ignored issues
show
introduced by
The trait Dimsav\Translatable\Translatable requires some properties which are not provided by App\Models\Criteria: $translations, $useTranslationFallback, $translationModel, $localeKey, $translationForeignKey
Loading history...
38
    public $translatedAttributes = ['description'];
39
40
    protected $table = 'criteria';
41
    protected $casts = [
42
        'criteria_type_id' => 'int',
43
        'job_poster_id' => 'int',
44
        'skill_id' => 'int',
45
        'skill_level_id' => 'int',
46
    ];
47
    protected $fillable = [
48
        'criteria_type_id',
49
        'skill_id',
50
        'skill_level_id',
51
    ];
52
    protected $with = [
53
        'criteria_type',
54
        'skill',
55
        'skill_level'
56
    ];
57
58
    public function criteria_type() {
0 ignored issues
show
Coding Style introduced by
Public method name "Criteria::criteria_type" is not in camel caps format
Loading history...
Coding Style introduced by
Missing doc comment for function criteria_type()
Loading history...
59
        return $this->belongsTo(\App\Models\Lookup\CriteriaType::class);
60
    }
61
62
    public function job_poster() {
0 ignored issues
show
Coding Style introduced by
Public method name "Criteria::job_poster" is not in camel caps format
Loading history...
Coding Style introduced by
Missing doc comment for function job_poster()
Loading history...
63
        return $this->belongsTo(\App\Models\JobPoster::class);
64
    }
65
66
    public function skill() {
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function skill()
Loading history...
67
        return $this->belongsTo(\App\Models\Skill::class);
68
    }
69
70
    public function skill_level() {
0 ignored issues
show
Coding Style introduced by
Public method name "Criteria::skill_level" is not in camel caps format
Loading history...
Coding Style introduced by
Missing doc comment for function skill_level()
Loading history...
71
        return $this->belongsTo(\App\Models\Lookup\SkillLevel::class);
72
    }
73
74
    public function criteria_translations() {
0 ignored issues
show
Coding Style introduced by
Public method name "Criteria::criteria_translations" is not in camel caps format
Loading history...
Coding Style introduced by
Missing doc comment for function criteria_translations()
Loading history...
75
        return $this->hasMany(\App\Models\Lookup\CriteriaTypeTranslation::class);
76
    }
77
78
    /**
79
     * Get all assessments for this Criteria, for all Screening Plans.
80
     *
81
     * @return \Illuminate\Database\Eloquent\Collection
82
     */
83
    public function assessments() // phpcs:ignore
84
    {
85
        return $this->hasMany(\App\Models\ScreeningPlan::class);
1 ignored issue
show
Bug Best Practice introduced by
The expression return $this->hasMany(Ap...s\ScreeningPlan::class) returns the type Illuminate\Database\Eloquent\Relations\HasMany which is incompatible with the documented return type Illuminate\Database\Eloquent\Collection.
Loading history...
86
    }
87
88
    /**
89
     * Returns the associated criteria-type name
90
     * @return string
0 ignored issues
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
91
     */
92
    public function getTypeAttribute(): string
93
    {
94
        return $this->criteria_type->name;
95
    }
96
}
97