Conditions | 4 |
Paths | 8 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
10 | public function __invoke (Twig_Environment $env, $assetPath) |
||
11 | { |
||
12 | $globals = $env->getGlobals(); |
||
13 | |||
14 | if ($assetPath instanceof FrontMatterObject) |
||
15 | { |
||
16 | $assetPath = $assetPath->getPermalink(); |
||
17 | } |
||
18 | |||
19 | // @TODO 1.0.0 Remove support for 'base' as it's been deprecated |
||
|
|||
20 | $base = (array_key_exists('base', $globals['site'])) ? $globals['site']['base'] : $globals['site']['baseurl']; |
||
21 | |||
22 | $baseURL = (empty($base)) ? '/' : '/' . trim($base, '/') . '/'; |
||
23 | $url = ltrim($assetPath, '/'); |
||
24 | |||
25 | return ($baseURL . $url); |
||
26 | } |
||
27 | |||
34 | } |