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

BundledData   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 14
ccs 0
cts 7
cp 0
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getContents() 0 7 2
A getPath() 0 3 1
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