Passed
Pull Request — master (#349)
by
unknown
01:53
created

PostScriptGlyphs::getGlyphs()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 2
rs 10
1
<?php
2
3
// Source : https://github.com/OpenPrinting/cups-filters/blob/master/fontembed/aglfn13.c
4
5
namespace Smalot\PdfParser\Encoding;
6
7
class PostScriptGlyphs
8
{
9
    private static $glyphs = null;
10
11 1
    public static function getGlyphs()
12
    {
13 1
        if (null === self::$glyphs) {
14 1
            self::$glyphs = json_decode(file_get_contents(__DIR__.'/PostScriptGlyphs.json'), true);
15
        }
16
17 1
        return self::$glyphs;
18
    }
19
20 1
    public static function getCodePoint($glyph)
21
    {
22 1
        return hexdec(static::getGlyphs()[$glyph]);
23
    }
24
}
25