Completed
Push — v0_9 ( 7321a8...fbed1d )
by Vladimir
03:21
created

CanonicalUrl::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace BZIon\Twig;
4
5
class CanonicalUrl
6
{
7
    /**
8
     * Build the canonical URL of a relative URL
9
     *
10
     * @param  string $relativeUrl
11
     * @return string The canonical URL
12
     */
13
    public function __invoke($relativeUrl)
14
    {
15
        $baseURL = \Service::getRequest()->getSchemeAndHttpHost();
16
17
        return $baseURL . $relativeUrl;
18
    }
19
20
    public static function get()
21
    {
22
        return new \Twig_SimpleFilter(
23
            'canonical',
24
            new self()
25
        );
26
    }
27
}