Passed
Push — task/laravel-breadcrumbs ( 3beccb...a96280 )
by Yonathan
10:46 queued 10s
created

TwoFactorComposer::compose()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 18
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 15
dl 0
loc 18
rs 9.7666
c 0
b 0
f 0
cc 4
nc 4
nop 1
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