Conditions | 2 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
26 | public function getText ( string $language = "en_US", string $className, string $entry ) : string |
||
27 | { |
||
28 | $result = ""; |
||
29 | |||
30 | $data = Yaml::parseFile( __DIR__ . sprintf( "/../../resources/Locales/translations_%s.yml", $language ) ); |
||
31 | |||
32 | $classPathParts = explode( "\\", $className ); |
||
33 | |||
34 | $dataCopy = $data; |
||
35 | |||
36 | foreach ( $classPathParts as $currentPart ) { |
||
37 | $dataCopy = $dataCopy[$currentPart]; |
||
38 | } |
||
39 | |||
40 | $result = $dataCopy[$entry]; |
||
41 | |||
42 | return $result; |
||
43 | } |
||
45 |