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

GetStatHelper   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 49
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 49
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 4 1
A getDefinition() 0 4 1
A getDescription() 0 8 1
A __invoke() 0 4 1
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