1 | <?php |
||
2 | |||
3 | namespace Validate\Traits; |
||
4 | |||
5 | /** |
||
6 | * Undocumented trait |
||
7 | */ |
||
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(string $file): string |
||
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|false |
||
28 | */ |
||
29 | public static function getListFromFile(string $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 $string, string $file): boolean |
||
0 ignored issues
–
show
|
|||
42 | { |
||
43 | if (!$fileHandle = fopen(self::getFileUrl($file), "r")) { |
||
44 | return false; |
||
0 ignored issues
–
show
|
|||
45 | } |
||
46 | while (!feof($fileHandle)) { |
||
47 | if (trim($string) === trim(fgets($fileHandle))) { |
||
48 | return true; |
||
0 ignored issues
–
show
|
|||
49 | } |
||
50 | } |
||
51 | fclose($fileHandle); |
||
52 | return false; |
||
0 ignored issues
–
show
|
|||
53 | } |
||
54 | } |
||
55 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths