Total Complexity | 5 |
Total Lines | 43 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
8 | trait GetDataTrait |
||
9 | { |
||
10 | |||
11 | /** |
||
12 | * Get full file url |
||
13 | * |
||
14 | * @param string $file |
||
15 | * @return string |
||
16 | */ |
||
17 | public static function getFileUrl($file) |
||
18 | { |
||
19 | $rootDir = DIRECTORY_SEPARATOR."..".DIRECTORY_SEPARATOR."..".DIRECTORY_SEPARATOR."..".DIRECTORY_SEPARATOR."data"; |
||
20 | return dirname(__FILE__).$rootDir.DIRECTORY_SEPARATOR.$file; |
||
21 | } |
||
22 | |||
23 | /** |
||
24 | * Return array from file |
||
25 | * |
||
26 | * @param string $file |
||
27 | * @return array |
||
28 | */ |
||
29 | public static function getListFromFile($file) |
||
30 | { |
||
31 | return file(self::getFileUrl($file)); |
||
|
|||
32 | } |
||
33 | |||
34 | /** |
||
35 | * Found string inside file |
||
36 | * |
||
37 | * @param string $string |
||
38 | * @param string $file |
||
39 | * @return bool |
||
40 | */ |
||
41 | public static function foundInFile($string, $file) |
||
51 | } |
||
52 | } |
If the returned type also contains false, it is an indicator that maybe an error condition leading to the specific return statement remains unhandled.