| Conditions | 5 |
| Paths | 6 |
| Total Lines | 21 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 40 | public static function getString($identifier, $locale = null) |
||
| 41 | { |
||
| 42 | if (is_null($locale)) { |
||
| 43 | $locale = Config::getConfigField("locale"); |
||
| 44 | } |
||
| 45 | |||
| 46 | $localePath = FinanCalc::getPath() . "/locale/$locale.php"; |
||
| 47 | |||
| 48 | if (!file_exists($localePath)) { |
||
| 49 | return null; |
||
| 50 | } |
||
| 51 | |||
| 52 | /** @noinspection PhpIncludeInspection */ |
||
| 53 | $strings = include($localePath); |
||
| 54 | |||
| 55 | if (!is_array($strings) || !array_key_exists($identifier, $strings)) { |
||
| 56 | return null; |
||
| 57 | } |
||
| 58 | |||
| 59 | return $strings[$identifier]; |
||
| 60 | } |
||
| 61 | } |
||
| 63 |