| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4.432 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | 78 | public function sync($type = 'xml') |
|
| 15 | { |
||
| 16 | 78 | $translations = (array) $this->config->get('translations'); |
|
| 17 | |||
| 18 | // Download quran data |
||
| 19 | 78 | foreach ($translations as $tr) { |
|
| 20 | 78 | $file = $this->config->get('storage_path') . '/' . $tr . '.' . $type; |
|
| 21 | |||
| 22 | 78 | if (!file_exists($file)) { |
|
| 23 | if (php_sapi_name() === 'cli') { |
||
| 24 | echo "Downloading translation \e[32m$tr\e[0m ...\n"; |
||
| 25 | } |
||
| 26 | |||
| 27 | $url = 'http://tanzil.net/trans/?transID=' . $tr . '&type=' . $type; |
||
| 28 | 26 | $this->download($url, $file); |
|
| 29 | } |
||
| 30 | } |
||
| 31 | 78 | } |
|
| 32 | |||
| 47 |