Passed
Push — release/1.0.17 ( f9f3c1...f9f3c1 )
by Grant
10:46 queued 13s
created

TwoFactorComposer   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 16
dl 0
loc 26
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A compose() 0 18 4
1
<?php
2
3
namespace App\Http\ViewComposers;
4
5
use Illuminate\View\View;
6
use Illuminate\Support\Facades\Lang;
7
use Facades\App\Services\WhichPortal;
8
9
class TwoFactorComposer
10
{
11
    /**
12
     * Bind data to the view.
13
     *
14
     * @param  View  $view
2 ignored issues
show
Coding Style Documentation introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
15
     * @return void
16
     */
17
    public function compose(View $view)
18
    {
19
        $confirm_url = '';
20
        $profile_url = '';
21
        if (WhichPortal::isApplicantPortal()) {
22
            $confirm_url = route('two_factor.confirm');
23
            $profile_url = route('settings.edit');
24
        } elseif (WhichPortal::isManagerPortal()) {
25
            $confirm_url = route('manager.two_factor.confirm');
26
            $profile_url = route('manager.settings.edit');
27
        } elseif (WhichPortal::isAdminPortal()) {
28
            $confirm_url = route('admin.two_factor.confirm');
29
            $profile_url = backpack_url('2fa');
30
        }
31
        $view->with('two_factor', Lang::get('two_factor'))
32
            ->with('otp', Lang::get('one_time_password'))
33
            ->with('confirm_url', $confirm_url)
34
            ->with('profile_url', $profile_url);
35
    }
36
}
37