Passed
Pull Request — dev (#313)
by Tristan
06:51
created

SkillDeclaration::work_samples()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 7
ccs 0
cts 4
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:28 +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
10
/**
11
 * Class SkillDeclaration
12
 *
13
 * @property int $id
14
 * @property int $skill_id
15
 * @property int $skill_status_id
16
 * @property int $skill_level_id
17
 * @property int $applicant_id
18
 * @property string $description
19
 * @property \Jenssegers\Date\Date $created_at
20
 * @property \Jenssegers\Date\Date $updated_at
21
 *
22
 * @property \App\Models\Skill $skill
23
 * @property \App\Models\Lookup\SkillStatus $skill_status
24
 * @property \App\Models\Lookup\SkillLevel $skill_level
25
 * @property \App\Models\Applicant $applicant
26
 * @property \Illuminate\Database\Eloquent\Collection $work_experiences
27
 * @property \Illuminate\Database\Eloquent\Collection $references
28
 * @property \Illuminate\Database\Eloquent\Collection $work_samples
29
 */
0 ignored issues
show
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...
30
class SkillDeclaration 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...
31
32
    protected $casts = [
33
        'skill_id' => 'int',
34
        'skill_status_id' => 'int',
35
        'skill_level_id' => 'int',
36
        'applicant_id' => 'int',
37
        'description' => 'string'
38
    ];
39
    protected $fillable = [
40
        'skill_level_id',
41
        'description',
42
    ];
43
44
    public function skill() {
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function skill()
Loading history...
Coding Style introduced by
Opening brace should be on a new line
Loading history...
45
        return $this->belongsTo(\App\Models\Skill::class);
46
    }
47
48
    public function skill_status() {
0 ignored issues
show
Coding Style introduced by
Public method name "SkillDeclaration::skill_status" is not in camel caps format
Loading history...
Coding Style introduced by
Missing doc comment for function skill_status()
Loading history...
Coding Style introduced by
Opening brace should be on a new line
Loading history...
49
        return $this->belongsTo(\App\Models\Lookup\SkillStatus::class);
50
    }
51
52
    public function skill_level() {
0 ignored issues
show
Coding Style introduced by
Public method name "SkillDeclaration::skill_level" is not in camel caps format
Loading history...
Coding Style introduced by
Missing doc comment for function skill_level()
Loading history...
Coding Style introduced by
Opening brace should be on a new line
Loading history...
53
        return $this->belongsTo(\App\Models\Lookup\SkillLevel::class);
54
    }
55
56
    public function applicant() {
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function applicant()
Loading history...
Coding Style introduced by
Opening brace should be on a new line
Loading history...
57
        return $this->belongsTo(\App\Models\Applicant::class);
58
    }
59
60
    public function work_experiences() {
0 ignored issues
show
Coding Style introduced by
Public method name "SkillDeclaration::work_experiences" is not in camel caps format
Loading history...
Coding Style introduced by
Missing doc comment for function work_experiences()
Loading history...
Coding Style introduced by
Opening brace should be on a new line
Loading history...
61
        $skill_id = $this->skill->id;
62
        return $this->applicant->work_experiences->filter(
63
            function($work_experience) use ($skill_id) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
64
                //Returns true if $work_experience is connected to a skill
65
                // that matches this skill declaration
66
                return $work_experience->skills->where(id, $skill_id) != null;
0 ignored issues
show
Bug introduced by
The constant App\Models\id was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
67
        });
0 ignored issues
show
Coding Style introduced by
Closing brace indented incorrectly; expected 12 spaces, found 8
Loading history...
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
68
    }
69
70
    public function references() {
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function references()
Loading history...
Coding Style introduced by
Opening brace should be on a new line
Loading history...
71
        $skill_id = $this->skill->id;
72
        return $this->applicant->references->filter(
73
            function($reference) use ($skill_id) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
74
                //Returns true if $reference is connected to a skill
75
                // that matches this skill declaration
76
                return $reference->skills->where(id, $skill_id) != null;
0 ignored issues
show
Bug introduced by
The constant App\Models\id was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
77
        });
0 ignored issues
show
Coding Style introduced by
Closing brace indented incorrectly; expected 12 spaces, found 8
Loading history...
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
78
    }
79
80
    public function work_samples() {
0 ignored issues
show
Coding Style introduced by
Public method name "SkillDeclaration::work_samples" is not in camel caps format
Loading history...
Coding Style introduced by
Missing doc comment for function work_samples()
Loading history...
Coding Style introduced by
Opening brace should be on a new line
Loading history...
81
        $skill_id = $this->skill->id;
82
        return $this->applicant->work_samples->filter(
83
            function($work_sample) use ($skill_id) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
84
                //Returns true if $reference is connected to a skill
85
                // that matches this skill declaration
86
                return $work_sample->skills->where(id, $skill_id) != null;
0 ignored issues
show
Bug introduced by
The constant App\Models\id was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
87
        });
0 ignored issues
show
Coding Style introduced by
Closing brace indented incorrectly; expected 12 spaces, found 8
Loading history...
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
88
    }
89
90
}
91