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