Application::getScope()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
/*
3
 * This file is part of the Laravel Platfourm package.
4
 *
5
 * (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Longman\Platfourm\Foundation;
12
13
use Illuminate\Foundation\Application as LaravelApplication;
14
15
class Application extends LaravelApplication
16
{
17
18
    public function getAvailableLocales()
19
    {
20
        $locales = $this['multilang']->getLocales();
21
22
        return array_keys($locales);
23
    }
24
25
    public function getDefaultLocale()
26
    {
27
        $locale = config('multilang.default_locale', 'en');
28
29
        return $locale;
30
    }
31
32
    public function isAdmin()
33
    {
34
        return $this->getScope() == 'admin';
35
    }
36
37
    public function isSite()
38
    {
39
        return !$this->isAdmin();
40
    }
41
42
    public function getScope()
43
    {
44
        return $this['config']->get('app.scope', 'global');
45
    }
46
47
}
48