Conditions | 5 |
Paths | 4 |
Total Lines | 19 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
33 | public function sweep() |
||
34 | { |
||
35 | $line = explode("\n", file_get_contents(base_path().$this->file)); |
||
|
|||
36 | $line = $line[$this->line - 1] ?? ''; |
||
37 | $count = 0; |
||
38 | if ($line) { |
||
39 | foreach ($this->terms()->get() as $term) { |
||
40 | $keywords = ["localize('{$term->term}')", 'localize("'.$term->term.'")']; |
||
41 | $matched = array_filter(array_map(function ($u) use ($line) { |
||
42 | return strpos($line, $u); |
||
43 | }, $keywords), 'strlen'); |
||
44 | if (empty($matched)) { |
||
45 | $this->terms()->detach($term->id); |
||
46 | } |
||
47 | $count += count($matched); |
||
48 | } |
||
49 | } |
||
50 | if ($count == 0) { |
||
51 | $this->delete(); |
||
52 | } |
||
55 |
Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.