| Conditions | 5 |
| Paths | 6 |
| Total Lines | 18 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 7.3471 |
| Changes | 3 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | 60 | public function sync($type = 'xml') |
|
| 15 | { |
||
| 16 | 60 | $translations = (array) $this->config->get('translations'); |
|
| 17 | |||
| 18 | // Download quran data |
||
| 19 | 60 | foreach ($translations as $tr) { |
|
| 20 | 60 | $file = $this->config->get('storage_path') . '/' . $tr . '.' . $type; |
|
|
|
|||
| 21 | |||
| 22 | 60 | 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 | $this->download($url, $file); |
||
| 29 | |||
| 30 | if ($type == 'xml') { |
||
| 31 | 30 | $this->cleanXML($file); |
|
| 32 | } |
||
| 63 |