helpers.php ➔ user_model()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
1
<?php
2
3
use Illuminate\Support\Str;
4
5
function projects_config_published()
6
{
7
    return file_exists(config_path('projects.php'));
8
}
9
10
function projects_base_path(string $append = '') : string
11
{
12
    $append = Str::start($append, '/');
13
14
    return Str::replaceLast('/src/Helpers', '', dirname(__FILE__)).$append;
15
}
16
17
function user_model()
18
{
19
    $user_class = config('projects.user_class');
20
21
    $repository = (new Illuminate\Config\Repository);
22
23
    $repository->set('custom', require projects_base_path('/config/projects.php'));
24
25
    if ( ! $user_class) {
26
        $user_class = $repository->get('custom.user_class');
27
    }
28
29
    return new $user_class;
30
}
31