Mage::domain()   A
last analyzed

Complexity

Conditions 5
Paths 5

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 16
CRAP Score 5

Importance

Changes 0
Metric Value
dl 0
loc 21
ccs 16
cts 16
cp 1
rs 9.2728
c 0
b 0
f 0
cc 5
nc 5
nop 1
crap 5
1
<?php
2
3
namespace Omatech\Mage\Core;
4
5
use Exception;
6
7
class Mage
8
{
9
    /**
10
     * @param string $domain
11
     * @return mixed
12
     * @throws Exception
13
     */
14 5
    public static function domain(string $domain)
15
    {
16 5
        switch ($domain) {
17 5
            case 'Permissions':
18 1
                $facade = app('mage.permissions');
19 1
                break;
20 4
            case 'Roles':
21 1
                $facade = app('mage.roles');
22 1
                break;
23 3
            case 'Users':
24 1
                $facade = app('mage.users');
25 1
                break;
26 2
            case 'Translations':
27 1
                $facade = app('mage.translations');
28 1
                break;
29
            default:
30 1
                throw new Exception();
31
        }
32
33 4
        return $facade;
34
    }
35
}
36