Passed
Push — master ( 83aa3d...907404 )
by Thomas
07:17
created

BundledData::getPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
namespace MadWizard\WebAuthn\Util;
4
5
use MadWizard\WebAuthn\Exception\NotAvailableException;
6
7
final class BundledData
8
{
9
    public static function getContents(string $path): string
10
    {
11
        $content = file_get_contents(self::getPath($path));
12
        if ($content === false) {
13
            throw new NotAvailableException(sprintf("Missing bundled data path '%s'.", $path));
14
        }
15
        return $content;
16
    }
17
18
    private static function getPath(string $path): string
19
    {
20
        return dirname(__DIR__, 2) . '/data/' . $path;
21
    }
22
}
23