Conditions | 4 |
Paths | 4 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
24 | public function find($pattern, \SplFileInfo $fileInfo) |
||
25 | { |
||
26 | if (!is_string($pattern)) { |
||
27 | throw new \InvalidArgumentException('Pattern should be an string'); |
||
28 | } |
||
29 | $pattern = $this->createRegExp($pattern); |
||
30 | $data = fopen($fileInfo->getPathName(), 'r'); |
||
31 | |||
32 | $return = false; |
||
33 | |||
34 | while ($line = fgets($data, 1024)) { |
||
35 | if (preg_match($pattern, $line)) { |
||
36 | $return = $fileInfo; |
||
37 | } |
||
38 | } |
||
39 | |||
40 | return $return; |
||
41 | } |
||
42 | |||
57 |