Passed
Push — develop ( 119dfd...2d7b42 )
by Brent
02:44
created

function.image.php ➔ smarty_function_image()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 2
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
use Brendt\Stitcher\Stitcher;
4
use Brendt\Stitcher\Template\TemplatePlugin;
5
6
/**
7
 * @param array                    $params
8
 * @param Smarty_Internal_Template $template
9
 *
10
 * @return mixed
11
 *
12
 * @see \Brendt\Stitcher\Template\EnginePlugin::image()
13
 */
14
function smarty_function_image(array $params, Smarty_Internal_Template $template) {
15
    /** @var TemplatePlugin $plugin */
16
    $plugin = Stitcher::get('service.template.plugin');
17
18
    $src = isset($params['src']) ? $params['src'] : null;
19
    $image = $plugin->image($src);
20
21
    $template->assign($params['var'], $image);
22
}
23