Conditions | 6 |
Paths | 9 |
Total Lines | 23 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
1 | <?php |
||
7 | public static function get($key, $data=NULL) |
||
8 | { |
||
9 | // if not $key |
||
10 | if (!$key) { |
||
11 | return null; |
||
12 | } |
||
13 | if ($data) { |
||
14 | foreach ($data as $var => $value) { |
||
15 | ${$var} = $value; |
||
16 | } |
||
17 | } |
||
18 | // load config file (this is only done once per application lifecycle) |
||
19 | if (!self::$texts) { |
||
20 | self::$texts = require('../application/config/texts.php'); |
||
21 | } |
||
22 | |||
23 | // check if array key exists |
||
24 | if (!array_key_exists($key, self::$texts)) { |
||
25 | return null; |
||
26 | } |
||
27 | |||
28 | return self::$texts[$key]; |
||
29 | } |
||
30 | |||
32 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.