Completed
Push — master ( 24ccf8...89196b )
by Derek Stephen
01:45
created

LocaleLink::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Bone\Mvc\View\Extension\Plates;
4
5
use League\Plates\Engine;
6
use League\Plates\Extension\ExtensionInterface;
7
use Locale;
8
9
class LocaleLink implements ExtensionInterface
10
{
11
    /**
12
     * @param Engine $engine
13
     */
14 1
    public function register(Engine $engine)
15
    {
16 1
        $engine->registerFunction('l', [$this, 'locale']);
17 1
        $engine->registerFunction('locale', [$this, 'locale']);
18 1
    }
19
20
    /**
21
     * @return string
22
     */
23
    public function locale() : string
24
    {
25
        return '/' . Locale::getDefault();
26
    }
27
}
28