GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Profiler   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 118
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 19
dl 0
loc 118
rs 10
c 0
b 0
f 0
wmc 8

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 13 3
A setStartTime() 0 5 1
A watch() 0 4 1
A getTotalExecution() 0 3 1
A setStartMemory() 0 5 1
A getMetrics() 0 3 1
1
<?php
2
/**
3
 * This file is part of the O2System Framework package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @author         Steeve Andrian Salim
9
 * @copyright      Copyright (c) Steeve Andrian Salim
10
 */
11
12
// ------------------------------------------------------------------------
13
14
namespace O2System\Gear;
15
16
// ------------------------------------------------------------------------
17
18
/**
19
 * O2System Gear Profiler
20
 *
21
 * @package O2System\Gear
22
 */
23
class Profiler
24
{
25
    /**
26
     * Profiler::$startTime
27
     *
28
     * Profiler Start Time
29
     *
30
     * @var float
31
     */
32
    private $startTime;
33
34
    /**
35
     * Profiler::$startMemory
36
     *
37
     * Profiler Start Memory Usage
38
     *
39
     * @var float
40
     */
41
    private $startMemory;
42
43
    /**
44
     * Profiler::$metrics
45
     *
46
     * Profiler Metrics Stack
47
     *
48
     * @var Profiler\Metrics
49
     */
50
    private $metrics;
51
52
    // ------------------------------------------------------------------------
53
54
    /**
55
     * Profiler::__construct
56
     *
57
     * @return Profiler
58
     */
59
    public function __construct()
60
    {
61
        $this->startTime = defined('STARTUP_TIME')
62
            ? STARTUP_TIME
0 ignored issues
show
Bug introduced by
The constant O2System\Gear\STARTUP_TIME was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
63
            : microtime(true);
64
65
        $this->startMemory = defined('STARTUP_MEMORY')
66
            ? STARTUP_MEMORY
0 ignored issues
show
Bug introduced by
The constant O2System\Gear\STARTUP_MEMORY was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
67
            : memory_get_usage(true);
68
69
        $this->metrics = new Profiler\Metrics();
70
71
        $this->watch('Starting Profiler Service');
72
    }
73
74
    // ------------------------------------------------------------------------
75
76
    /**
77
     * Profiler::watch
78
     *
79
     * @param string $marker
80
     */
81
    public function watch($marker)
82
    {
83
        // Stop Last Benchmark
84
        $this->metrics->push(new Profiler\DataStructures\Metric($marker));
85
    }
86
87
    // ------------------------------------------------------------------------
88
89
    /**
90
     * Profiler::setStartTime
91
     *
92
     * @param float $startTime
93
     *
94
     * @return Profiler
95
     */
96
    public function setStartTime($startTime)
97
    {
98
        $this->startTime = $startTime;
99
100
        return $this;
101
    }
102
103
    // ------------------------------------------------------------------------
104
105
    /**
106
     * Profiler::setStartMemory
107
     *
108
     * @param float $startMemory
109
     *
110
     * @return Profiler
111
     */
112
    public function setStartMemory($startMemory)
113
    {
114
        $this->startMemory = $startMemory;
115
116
        return $this;
117
    }
118
119
    // ------------------------------------------------------------------------
120
121
    /**
122
     * Profiler::getMetrics
123
     *
124
     * @return \O2System\Gear\Profiler\Metrics
125
     */
126
    public function getMetrics()
127
    {
128
        return $this->metrics;
129
    }
130
131
    // ------------------------------------------------------------------------
132
133
    /**
134
     * Profiler::getTotalExecution
135
     *
136
     * @return mixed
137
     */
138
    public function getTotalExecution()
139
    {
140
        return $this->metrics->bottom();
141
    }
142
}