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

ApplicantProfileMenuComposer   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 11
eloc 51
dl 0
loc 71
ccs 0
cts 31
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B compose() 0 63 11
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace App\Http\ViewComposers;
4
5
use Illuminate\View\View;
6
use Illuminate\Support\Facades\Lang;
7
use Illuminate\Support\Facades\Auth;
8
use Illuminate\Support\Facades\Route;
9
10
class ApplicantProfileMenuComposer
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class ApplicantProfileMenuComposer
Loading history...
11
{
12
    /**
13
     * Bind data to the view.
14
     *
15
     * @param  View  $view
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
16
     * @return void
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
17
     */
18
    public function compose(View $view)
19
    {
20
        $profileMenu = [
21
            "about" => [
22
                "active" => false,
23
                "link" => route('profile.about.edit', $view->getData()['applicant']),
24
                "title" => "Go to the About Me section of your profile.",
25
                "label" => "About Me"
26
            ],
27
            "experience" => [
28
                "active" => false,
29
                "link" => route('profile.experience.edit', $view->getData()['applicant']),
30
                "title" => "Go to the Experience section of your profile.",
31
                "label" => "My Experience"
32
            ],
33
            "skills" => [
34
                "active" => false,
35
                "link" => "/profile/skills",
36
                "title" => "Go to the Skills section of your profile.",
37
                "label" => "My Skills"
38
            ],
39
            "references" => [
40
                "active" => false,
41
                "link" => "/profile/references",
42
                "title" => "Go to the References section of your profile.",
43
                "label" => "My References"
44
            ],
45
            "portfolio" => [
46
                "active" => false,
47
                "link" => "/profile/portfolio",
48
                "title" => "Go to the Portfolio section of your profile.",
49
                "label" => "My Portfolio"
50
            ]
51
        ];
52
53
        //Set active on the proper item
54
        switch(Route::currentRouteName()) {
55
            case('profile.about'):
56
            case('profile.about.edit'):
57
                $profileMenu['about']['active'] = true;
58
                break;
59
            case('profile.experience'):
60
            case('profile.experience.edit'):
61
                $profileMenu['experience']['active'] = true;
62
                break;
63
            case('profile.skills'):
64
            case('profile.skills.edit'):
65
                $profileMenu['skills']['active'] = true;
66
                break;
67
            case('profile.references'):
68
            case('profile.references.edit'):
69
                $profileMenu['references']['active'] = true;
70
                break;
71
            case('profile.portfolio'):
72
            case('profile.portfolio.edit'):
73
                $profileMenu['portfolio']['active'] = true;
74
                break;
75
            default:
76
                //No active menu item
77
                break;
78
        }
79
80
        $view->with('profile_menu', $profileMenu);
81
    }
82
}
83