1 | <?php |
||
7 | class Benchmark |
||
8 | { |
||
9 | protected $start_time; |
||
10 | |||
11 | protected $end_time; |
||
12 | |||
13 | protected $memory_usage; |
||
14 | |||
15 | /** |
||
16 | * Sets start microtime |
||
17 | * |
||
18 | * @return void |
||
19 | */ |
||
20 | public function start() |
||
24 | |||
25 | /** |
||
26 | * Sets end microtime |
||
27 | * |
||
28 | * @return $this |
||
29 | * @throws Exception |
||
30 | */ |
||
31 | public function end() |
||
41 | |||
42 | /** |
||
43 | * Returns the elapsed time, readable or not |
||
44 | * |
||
45 | * @param bool $raw |
||
46 | * @param string $format The format to display (printf format) |
||
47 | * @return float|string |
||
48 | * @throws Exception |
||
49 | */ |
||
50 | public function getTime($raw = false, $format = null) |
||
64 | |||
65 | /** |
||
66 | * Returns the memory usage at the end checkpoint |
||
67 | * |
||
68 | * @param boolean $readable Whether the result must be human readable |
||
|
|||
69 | * @param string $format The format to display (printf format) |
||
70 | * @return string|float |
||
71 | */ |
||
72 | public function getMemoryUsage($raw = false, $format = null) |
||
76 | |||
77 | /** |
||
78 | * Returns the memory peak, readable or not |
||
79 | * |
||
80 | * @param boolean $readable Whether the result must be human readable |
||
81 | * @param string $format The format to display (printf format) |
||
82 | * @return string|float |
||
83 | */ |
||
84 | public function getMemoryPeak($raw = false, $format = null) |
||
90 | |||
91 | /** |
||
92 | * Wraps a callable with start() and end() calls |
||
93 | * |
||
94 | * Additional arguments passed to this method will be passed to |
||
95 | * the callable. |
||
96 | * |
||
97 | * @param callable $callable |
||
98 | * @return mixed |
||
99 | */ |
||
100 | public function run(callable $callable) |
||
111 | |||
112 | /** |
||
113 | * Returns a human readable memory size |
||
114 | * |
||
115 | * @param int $size |
||
116 | * @param string $format The format to display (printf format) |
||
117 | * @param int $round |
||
118 | * @return string |
||
119 | */ |
||
120 | public static function readableSize($size, $format = null, $round = 3) |
||
140 | |||
141 | /** |
||
142 | * Returns a human readable elapsed time |
||
143 | * |
||
144 | * @param float $microtime |
||
145 | * @param string $format The format to display (printf format) |
||
146 | * @return string |
||
147 | */ |
||
148 | public static function readableElapsedTime($microtime, $format = null, $round = 3) |
||
166 | |||
167 | public function hasEnded() |
||
171 | |||
172 | public function hasStarted() |
||
176 | } |
||
177 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.