Completed
Pull Request — dev (#330)
by Josh
06:54
created

JobApplication::citizenship_declaration()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
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 2
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\VeteranStatus;
10
use App\Models\Lookup\PreferredLanguage;
11
use App\Models\Lookup\CitizenshipDeclaration;
12
13
/**
14
 * Class JobApplication
15
 *
16
 * @property int $id
17
 * @property int $job_poster_id
18
 * @property int $application_status_id
19
 * @property int $citizenship_declaration_id
20
 * @property int $veteran_status_id
21
 * @property int $preferred_language_id
22
 * @property int $applicant_id
23
 * @property int $applicant_snapshot_id
24
 * @property \Jenssegers\Date\Date $created_at
25
 * @property \Jenssegers\Date\Date $updated_at
26
 *
27
 * @property \App\Models\Applicant $applicant
28
 * @property \App\Models\Applicant $applicant_snapshot
29
 * @property \App\Models\Lookup\ApplicationStatus $application_status
30
 * @property \App\Models\Lookup\CitizenshipDeclaration $citizenship_declaration
31
 * @property \App\Models\Lookup\VeteranStatus $veteran_status
32
 * @property \App\Models\Lookup\PreferredLanguage $preferred_language
33
 * @property \App\Models\JobPoster $job_poster
34
 * @property \Illuminate\Database\Eloquent\Collection $job_application_answers
35
 * @property \Illuminate\Database\Eloquent\Collection $skill_declarations
36
 */
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...
37
class JobApplication 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...
38
39
    protected $casts = [
40
        'job_poster_id' => 'int',
41
        'application_status_id' => 'int',
42
        'citizenship_declaration_id' => 'int',
43
        'veteran_status_id' => 'int',
44
        'preferred_language_id' => 'int',
45
        'applicant_id' => 'int',
46
        'applicant_snapshot_id' => 'int'
47
    ];
48
    protected $fillable = [
49
        'citizenship_declaration_id',
50
        'veteran_status_id',
51
        'preferred_language_id',
52
    ];
53
54
    protected function createApplicantSnapshot($applicant_id) {
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function createApplicantSnapshot()
Loading history...
55
        $applicant = Applicant::where('id', $applicant_id)->firstOrFail();
56
57
        $snapshot = $applicant->replicate();
0 ignored issues
show
Unused Code introduced by
The assignment to $snapshot is dead and can be removed.
Loading history...
58
59
    }
60
61
    public function applicant() {
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function applicant()
Loading history...
62
        return $this->belongsTo(\App\Models\Applicant::class);
63
    }
64
65
    public function applicant_snapshot() {
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function applicant_snapshot()
Loading history...
Coding Style introduced by
Public method name "JobApplication::applicant_snapshot" is not in camel caps format
Loading history...
66
        return $this->belongsTo(\App\Models\Applicant::class, 'applicant_snapshot_id');
67
    }
68
69
    public function application_status() {
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function application_status()
Loading history...
Coding Style introduced by
Public method name "JobApplication::application_status" is not in camel caps format
Loading history...
70
        return $this->belongsTo(\App\Models\Lookup\ApplicationStatus::class);
71
    }
72
73
    public function citizenship_declaration() {
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function citizenship_declaration()
Loading history...
Coding Style introduced by
Public method name "JobApplication::citizenship_declaration" is not in camel caps format
Loading history...
74
        return $this->belongsTo(\App\Models\Lookup\CitizenshipDeclaration::class);
75
    }
76
77
    public function veteran_status() {
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function veteran_status()
Loading history...
Coding Style introduced by
Public method name "JobApplication::veteran_status" is not in camel caps format
Loading history...
78
        return $this->belongsTo(\App\Models\Lookup\VeteranStatus::class);
79
    }
80
81
    public function preferred_language() {
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function preferred_language()
Loading history...
Coding Style introduced by
Public method name "JobApplication::preferred_language" is not in camel caps format
Loading history...
82
        return $this->belongsTo(\App\Models\Lookup\PreferredLanguage::class);
83
    }
84
85
    public function job_poster() {
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function job_poster()
Loading history...
Coding Style introduced by
Public method name "JobApplication::job_poster" is not in camel caps format
Loading history...
86
        return $this->belongsTo(\App\Models\JobPoster::class);
87
    }
88
89
    public function job_application_answers() {
0 ignored issues
show
Coding Style introduced by
Missing doc comment for function job_application_answers()
Loading history...
Coding Style introduced by
Public method name "JobApplication::job_application_answers" is not in camel caps format
Loading history...
90
        return $this->hasMany(\App\Models\JobApplicationAnswer::class);
91
    }
92
93
    /**
94
     * Return either 'complete', 'incomplete' or 'error', depending on the
95
     * status of the requested section.
96
     *
97
     * @param  string $section Should be one of:
0 ignored issues
show
Coding Style introduced by
Tag value indented incorrectly; expected 1 spaces but found 2
Loading history...
98
     *                              'basics'
0 ignored issues
show
Coding Style introduced by
Parameter comment not aligned correctly; expected 25 spaces but found 30
Loading history...
99
     *                              'experience'
0 ignored issues
show
Coding Style introduced by
Parameter comment not aligned correctly; expected 25 spaces but found 30
Loading history...
100
     *                              'essential_skills'
0 ignored issues
show
Coding Style introduced by
Parameter comment not aligned correctly; expected 25 spaces but found 30
Loading history...
101
     *                              'asset_skills'
0 ignored issues
show
Coding Style introduced by
Parameter comment not aligned correctly; expected 25 spaces but found 30
Loading history...
102
     *                              'preview'
0 ignored issues
show
Coding Style introduced by
Parameter comment not aligned correctly; expected 25 spaces but found 30
Loading history...
103
     *
104
     * @return string $status   'complete', 'incomplete' or 'error'
105
     */
106
    public function getSectionStatus(string $section) {
107
        //TODO: determine whether sections are complete or opcache_invalid
108
109
        $status = 'incomplete';
110
        switch($section) {
111
            case 'basics':
112
                break;
113
            case 'experience':
114
                break;
115
            case 'essential_skills':
116
                break;
117
            case 'asset_skills':
118
                break;
119
            case 'preview':
120
                break;
121
            default:
122
                $status = 'error';
123
                break;
124
        }
125
        return $status;
126
    }
127
}
128