Completed
Push — dev ( 39ba5f...0b8cdb )
by Tristan
04:57 queued 04:51
created

LangMenuComposer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 61.53%

Importance

Changes 0
Metric Value
wmc 3
eloc 14
dl 0
loc 26
ccs 8
cts 13
cp 0.6153
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A compose() 0 18 3
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 Mcamara\LaravelLocalization\Facades\LaravelLocalization;
8
9
class LangMenuComposer
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class LangMenuComposer
Loading history...
10
{
11
    /**
12
     * Bind data to the view.
13
     *
14
     * @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...
15
     * @return void
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
16
     */
17 12
    public function compose(View $view)
18
    {
19 12
        $locale = LaravelLocalization::getCurrentLocale();
20
21 12
        switch($locale) {
22 12
            case 'en':
23 12
                $linkLocale = 'fr';
24 12
                break;
25
            case 'fr':
26
                $linkLocale = 'en';
27
                break;
28
            default:
29
                $linkLocale = 'fr';
30
                break;
31
        }
32
33 12
        $view->with('lang_menu', Lang::get('common/lang_menu'));
34 12
        $view->with('language_link', LaravelLocalization::getLocalizedURL($linkLocale));
35 12
    }
36
}
37