Conditions | 3 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
26 | 3 | public function image($dir, $image, $width = null, $height = null, array $options = [], array $attributes = []) |
|
27 | { |
||
28 | 3 | $attributes = array_replace_recursive($this->attributes, $attributes); |
|
29 | 3 | $options = array_replace_recursive($this->options, $options); |
|
30 | |||
31 | 3 | $path = config('laravelimage.routePath') . '/' . $dir . $image . '?' . http_build_query($options, '', '&'); |
|
32 | |||
33 | 3 | if ( ! empty((int) $width)) { |
|
34 | 3 | $path .= '&w=' . (int) $width; |
|
35 | } |
||
36 | |||
37 | 3 | if ( ! empty((int) $height)) { |
|
38 | 3 | $path .= '&h=' . (int) $height; |
|
39 | } |
||
40 | |||
41 | 3 | return '<img src="' . asset($path) . '" ' . $this->buildAttributes($attributes) . ' />'; |
|
42 | } |
||
43 | |||
65 |