IniLoader   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Test Coverage

Coverage 80%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
eloc 6
c 1
b 0
f 1
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
/**
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
?>