Passed
Push — master ( e1e679...09e224 )
by Quentin
10:29
created

Localization::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 0
nc 1
nop 0
dl 0
loc 2
ccs 1
cts 1
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace A17\Twill\Http\ViewComposers;
4
5
use App;
6
use Illuminate\Support\Facades\Lang;
7
use Illuminate\Contracts\View\View;
8
9
class Localization
10
{
11
    /**
12
     * Create a new profile composer.
13
     *
14
     * @return void
15
     */
16 50
    public function __construct()
17
    {
18
19 50
    }
20
21
    /**
22
     * Bind data to the view.
23
     *
24
     * @param  View  $view
25
     * @return void
26
     */
27 50
    public function compose(View $view)
28
    {
29 50
        $currentLang = Lang::get('twill::lang', [], config('twill.locale'));
30 50
        $fallbackLang = Lang::get('twill::lang', [], config('twill.fallback_locale', 'en'));
31 50
        $lang = array_replace_recursive($fallbackLang, $currentLang);
32
33
        $twillLocalization = [
34 50
            'locale' => config('twill.locale'),
35 50
            'fallback_locale' => config('twill.fallback_locale', 'en'),
36 50
            'lang' => $lang
37
        ];
38
        
39 50
        $view->with(['twillLocalization' => $twillLocalization]);
40
    }
41
}