Total Complexity | 5 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
11 | class Font |
||
12 | { |
||
13 | const FONT_ARIAL = 'arial'; |
||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | private $fontPathname; |
||
19 | |||
20 | /** |
||
21 | * @return array |
||
22 | */ |
||
23 | private static function getFonts() |
||
24 | { |
||
25 | $directory = dirname(__FILE__) . '/../../Resources/Fonts/'; |
||
26 | |||
27 | return [ |
||
28 | self::FONT_ARIAL => $directory . 'arial.ttf', |
||
29 | ]; |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * Font constructor. |
||
34 | * @param $fontPathname |
||
35 | * @throws InvalidFontException |
||
36 | */ |
||
37 | public function __construct($fontPathname) |
||
38 | { |
||
39 | if (!is_file($fontPathname)) { |
||
40 | throw new InvalidFontException('Font file not found at path ' . $fontPathname); |
||
41 | } |
||
42 | $this->fontPathname = $fontPathname; |
||
43 | } |
||
44 | |||
45 | /** |
||
46 | * @return Font |
||
47 | * @throws InvalidFontException |
||
48 | */ |
||
49 | public static function arial() |
||
54 | } |
||
55 | |||
56 | /** |
||
57 | * @return string |
||
58 | */ |
||
59 | public function __toString() |
||
62 | } |
||
63 | } |
||
64 |