Time   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 0
cbo 3
dl 0
loc 27
ccs 0
cts 6
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getFunctions() 0 9 1
A getName() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * This file is part of TwigView.
6
 *
7
 ** (c) 2014 Cees-Jan Kiewiet
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace WyriHaximus\TwigView\Lib\Twig\Extension;
14
15
use Cake\I18n\Time as CakeTime;
16
use Twig\Extension\AbstractExtension;
17
use Twig\TwigFunction;
18
19
/**
20
 * Class Time.
21
 * @package WyriHaximus\TwigView\Lib\Twig\Extension
22
 */
23
final class Time extends AbstractExtension
24
{
25
    /**
26
     * Get declared functions.
27
     *
28
     * @return \Twig\TwigFunction[]
29
     */
30
    public function getFunctions(): array
31
    {
32
        return [
33
            new TwigFunction('time', function ($time = null, $timezone = null) {
34
                return new CakeTime($time, $timezone);
35
            }),
36
            new TwigFunction('timezones', 'Cake\I18n\Time::listTimezones'),
37
        ];
38
    }
39
40
    /**
41
     * Get extension name.
42
     *
43
     * @return string
44
     */
45
    public function getName(): string
46
    {
47
        return 'time';
48
    }
49
}
50