| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3.0987 |
| Changes | 2 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 16 | 78 | public function sync($type = 'xml') |
|
| 17 | { |
||
| 18 | // Download quran data |
||
| 19 | 78 | foreach ($this->config->get('translations') as $tr) { |
|
|
|
|||
| 20 | 78 | $file = $this->config->get('storage_path').'/'.$tr.'.'.$type; |
|
| 21 | |||
| 22 | 78 | if (!file_exists($file)) { |
|
| 23 | $url = 'http://tanzil.net/trans/?transID='.$tr.'&type='.$type; |
||
| 24 | 26 | $this->download($url, $file); |
|
| 25 | } |
||
| 26 | 52 | } |
|
| 27 | 78 | } |
|
| 28 | |||
| 36 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.