Passed
Push — master ( 86c3d2...1ebd3c )
by Gabor
07:26
created

GetStatHelper::getDefinition()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
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\Adapter\Renderer\RendererHelperInterface;
17
18
/**
19
 * Class GetStatHelper
20
 */
21
class GetStatHelper implements RendererHelperInterface
22
{
23
    /**
24
     * Should return the name of the helper.
25
     *
26
     * @return string
27
     * @codeCoverageIgnore - plain text
28
     */
29
    public static function getName() : string
30
    {
31
        return 'getStat';
32
    }
33
34
    /**
35
     * Should return the name of the helper.
36
     *
37
     * @return string
38
     * @codeCoverageIgnore - plain text
39
     */
40
    public static function getDefinition() : string
41
    {
42
        return 'getStat(void) : array';
43
    }
44
45
    /**
46
     * Should return a description text.
47
     *
48
     * @return string
49
     * @codeCoverageIgnore - plain text
50
     */
51
    public static function getDescription() : string
52
    {
53
        return 'Triggers the WebHemi\'s built-in timer and returns the data in array:'.PHP_EOL
54
            . '\'start_time\': the time when the timer had been called (called automatically).'.PHP_EOL
55
            . '\'end_time\': the time when the timer had been stopped (called in a template)'.PHP_EOL
56
            . '\'duration\': the difference in seconds '.PHP_EOL
57
            . '\'memory\': the maximum memory usage during the render in a human readable format '.PHP_EOL;
58
    }
59
60
    /**
61
     * A renderer helper should be called with its name.
62
     *
63
     * @return array
64
     */
65
    public function __invoke() : array
66
    {
67
        return render_stat();
68
    }
69
}
70