NeonLoader   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 3
b 0
f 0
dl 0
loc 12
rs 10
ccs 4
cts 5
cp 0.8

1 Method

Rating   Name   Duplication   Size   Complexity  
A parseFile() 0 6 2
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
?>