Passed
Push — master ( f47d5f...f7335a )
by Gabor
05:38
created

GetStatHelper::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
/**
3
 * WebHemi.
4
 *
5
 * PHP version 7.1
6
 *
7
 * @copyright 2012 - 2017 Gixx-web (http://www.gixx-web.com)
8
 * @license   https://opensource.org/licenses/MIT The MIT License (MIT)
9
 *
10
 * @link      http://www.gixx-web.com
11
 */
12
declare(strict_types = 1);
13
14
namespace WebHemi\Renderer\Helper;
15
16
use WebHemi\Renderer\HelperInterface;
17
18
/**
19
 * Class GetStatHelper
20
 *
21
 * @codeCoverageIgnore - config and PHP core functions. No business logic.
22
 */
23
class GetStatHelper implements HelperInterface
24
{
25
    /**
26
     * Should return the name of the helper.
27
     *
28
     * @return string
29
     */
30
    public static function getName() : string
31
    {
32
        return 'getStat';
33
    }
34
35
    /**
36
     * Should return the name of the helper.
37
     *
38
     * @return string
39
     */
40
    public static function getDefinition() : string
41
    {
42
        return '{{ getStat() }}';
43
    }
44
45
    /**
46
     * Gets helper options for the render.
47
     *
48
     * @return array
49
     * @codeCoverageIgnore - empty array
50
     */
51
    public static function getOptions() : array
52
    {
53
        return [];
54
    }
55
56
    /**
57
     * Should return a description text.
58
     *
59
     * @return string
60
     */
61
    public static function getDescription() : string
62
    {
63
        return 'Triggers the WebHemi\'s built-in timer and returns the data in array:'.PHP_EOL
64
            . '\'start_time\': the time when the timer had been called (called automatically).'.PHP_EOL
65
            . '\'end_time\': the time when the timer had been stopped (called in a template)'.PHP_EOL
66
            . '\'duration\': the difference in seconds '.PHP_EOL
67
            . '\'memory\': the maximum memory usage during the render in a human readable format '.PHP_EOL;
68
    }
69
70
    /**
71
     * A renderer helper should be called with its name.
72
     *
73
     * @return array
74
     */
75
    public function __invoke() : array
76
    {
77
        return render_stat();
78
    }
79
}
80