NeonLoader::parseFile()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 4
c 2
b 0
f 0
dl 0
loc 6
rs 10
ccs 3
cts 4
cp 0.75
cc 2
nc 2
nop 1
crap 2.0625
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexendrie\Translation\Loaders;
5
6
use Nette\Neon\Neon;
7
8
/**
9
 * Translations loader
10
 * Loads texts from neon files
11
 *
12
 * @author Jakub Konečný
13
 */
14 1
final class NeonLoader extends FileLoader {
15
  protected string $extension = "neon";
16
17
  /**
18
   * @throws \RuntimeException
19
   */
20
  protected function parseFile(string $filename): array {
21 1
    $content = file_get_contents($filename);
22 1
    if($content === false) {
23
      throw new \RuntimeException("File $filename does not exist or cannot be read.");
24
    }
25 1
    return Neon::decode($content);
26
  }
27
}
28
?>