| Conditions | 4 | 
| Paths | 4 | 
| Total Lines | 18 | 
| Code Lines | 10 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Tests | 10 | 
| CRAP Score | 4 | 
| Changes | 0 | ||
| 1 | <?php | ||
| 61 | 42 | private function getImage(string $type, string $size): string | |
| 62 |     { | ||
| 63 | 42 | $path = $type . '_path'; | |
| 64 | 42 | if (isset($this->data->$path)) | |
| 65 |         { | ||
| 66 | 36 | if (!isset($this->conf->images->base_url)) | |
| 67 |             { | ||
| 68 | 12 |                 throw new \Exception('base_url configuration not found'); | |
| 69 | } | ||
| 70 | 24 | $sizes = $type . '_sizes'; | |
| 71 | 24 | if (!in_array($size, $this->conf->images->$sizes)) | |
| 72 |             { | ||
| 73 | 12 |                 throw new \Exception('Incorrect ' . $type . ' size : ' . $size); | |
| 74 | } | ||
| 75 | 12 | return $this->conf->images->base_url . $size . $this->data->$path; | |
| 76 | } | ||
| 77 | 6 | return ''; | |
| 78 | } | ||
| 79 | |||
| 81 |