File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,9 @@ abstract class Notify {
3030 protected $ _message ;
3131 protected $ _start ;
3232 protected $ _timer ;
33+ protected $ _tick ;
34+ protected $ _iteration = 0 ;
35+ protected $ _speed = 0 ;
3336
3437 /**
3538 * Instatiates a Notification object.
@@ -92,23 +95,21 @@ public function elapsed() {
9295 * @return int The number of ticks performed in 1 second.
9396 */
9497 public function speed () {
95- static $ tick , $ iteration = 0 , $ speed = 0 ;
96-
9798 if (!$ this ->_start ) {
9899 return 0 ;
99- } else if (!$ tick ) {
100- $ tick = $ this ->_start ;
100+ } else if (!$ this -> _tick ) {
101+ $ this -> _tick = $ this ->_start ;
101102 }
102103
103104 $ now = microtime (true );
104- $ span = $ now - $ tick ;
105+ $ span = $ now - $ this -> _tick ;
105106 if ($ span > 1 ) {
106- $ iteration ++;
107- $ tick = $ now ;
108- $ speed = ($ this ->_current / $ iteration ) / $ span ;
107+ $ this -> _iteration ++;
108+ $ this -> _tick = $ now ;
109+ $ this -> _speed = ($ this ->_current / $ this -> _iteration ) / $ span ;
109110 }
110111
111- return $ speed ;
112+ return $ this -> _speed ;
112113 }
113114
114115 /**
You can’t perform that action at this time.
0 commit comments