| Conditions | 4 |
| Paths | 4 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 29 | 6 | public function thinkImage(string $field): ThinkImage |
|
| 30 | { |
||
| 31 | 6 | if (!empty($this->thinkImages[ $field ])) { |
|
| 32 | 6 | return $this->thinkImages[ $field ]->setValue($this->{$field}); |
|
| 33 | } |
||
| 34 | 6 | $map = $this->thinkImagesMap(); |
|
| 35 | 6 | if (!array_key_exists($field, $map)) { |
|
| 36 | 1 | throw new SimpleImageManagerException("Filed [{$field}] not present in thinkImagesMap."); |
|
| 37 | } |
||
| 38 | |||
| 39 | 6 | return $this->thinkImages[ $field ] = ($map[ $field ] instanceof ThinkImage) ? $map[ $field ] : new ThinkImage($map[ $field ], $this->{$field}); |
|
| 40 | } |
||
| 42 |