IniLoader::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 1
Bugs 0 Features 1
Metric Value
eloc 4
c 1
b 0
f 1
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
/**
7
 * IniLoader
8
 * Loads texts from ini files
9
 *
10
 * @author Jakub Konečný
11
 */
12 1
final class IniLoader extends FileLoader {
13
  protected string $extension = "ini";
14
15
  /**
16
   * @throws \RuntimeException
17
   */
18
  protected function parseFile(string $filename): array {
19 1
    $result = parse_ini_file($filename, true);
20 1
    if($result === false) {
21
      throw new \RuntimeException("File $filename does not exist or cannot be read.");
22
    }
23 1
    return $result;
24
  }
25
}
26
?>