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 ( b9d8ea...f62593 )
by Cees-Jan
11s
created

functions.php ➔ exists()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 6
nc 3
nop 1
dl 0
loc 12
ccs 5
cts 5
cp 1
crap 3
rs 9.4285
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace ApiClients\Tools\ResourceGenerator;
4
5
use RecursiveDirectoryIterator;
6
use RecursiveIteratorIterator;
7
use Symfony\Component\Finder\SplFileInfo;
8
use Symfony\Component\Yaml\Yaml;
9
10
/**
11
 * @param string $filename
12
 * @return array
13
 */
14
function readYaml(string $filename): array
15
{
16 1
    return Yaml::parse(file_get_contents($filename));
17
}
18
19
/**
20
 * @param string $dir
21
 * @return array
22
 */
23
function readYamlDir(string $dir): array
24
{
25 1
    $files = [];
26 1
    $directory = new RecursiveDirectoryIterator($dir);
27 1
    $directory = new RecursiveIteratorIterator($directory);
28 1
    foreach ($directory as $file) {
29 1
        if (!is_file($file->getPathname())) {
30 1
            continue;
31
        }
32
33 1
        $files[$file->getPathname()] = readYaml($file->getPathname());
34
    }
35 1
    return $files;
36
}
37
38
/**
39
 * @param string $line
40
 */
41
function out(string $line)
42
{
43
    echo $line;
44
}
45
46
/**
47
 * @param string $line
48
 */
49
function outln(string $line)
50
{
51
    echo $line, PHP_EOL;
52
}
53
54
/**
55
 * @param string $ic
56
 * @return bool
57
 */
58
function exists(string $ic): bool
59
{
60 1
    if (class_exists($ic)) {
61 1
        return true;
62
    }
63
64 1
    if (interface_exists($ic)) {
65 1
        return true;
66
    }
67
68 1
    return false;
69
}
70