GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( da7651...84ea09 )
by Leandro
03:32
created

DomainService::configFiles()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 17
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 9.2
c 0
b 0
f 0
cc 4
eloc 12
nc 4
nop 1
1
<?php
2
/**
3
 * Domain Service file
4
 *
5
 * @author     Leandro Silva <[email protected]>
6
 * @category   LosDomain
7
 * @license    https://github.com/Lansoweb/LosDomain/blob/master/LICENSE MIT License
8
 * @link       http://github.com/LansoWeb/LosDomain
9
 */
10
namespace LosDomain;
11
12
/**
13
 * Domain Service class
14
 *
15
 * @author     Leandro Silva <[email protected]>
16
 * @category   LosDomain
17
 * @license    https://github.com/Lansoweb/LosDomain/blob/master/LICENSE MIT License
18
 * @link       http://github.com/LansoWeb/LosDomain
19
 */
20
final class DomainService
21
{
22
23
    /**
24
     * Returns um array of php config files per domain
25
     *
26
     * @param string $basePath
27
     * @return array Array of files
28
     */
29
    public static function configFiles(string $basePath) : array
30
    {
31
        if (! file_exists($basePath)) {
32
            return [];
33
        }
34
        $domain = new Domain();
35
        $path = $domain->toString();
36
        if (file_exists($e = $basePath . DIRECTORY_SEPARATOR . 'config.php')) {
37
            $config = include $e;
38
            $aliases = $config['los_domain']['aliases'] ?? [];
39
            if (array_key_exists($domain->toString(), $aliases)) {
40
                $path = $aliases[$domain->toString()];
41
            }
42
        }
43
        $pattern = $basePath . DIRECTORY_SEPARATOR . $path . '/{{,*.}global,{,*.}local}.php';
44
        return glob($pattern, GLOB_BRACE);
45
    }
46
}
47