1 | <?php |
||
22 | class ExecutionSpeed |
||
23 | { |
||
24 | const MIN_MAX = 5; |
||
25 | const MIN_COEFFICIENT = 0.001; |
||
26 | |||
27 | /** |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $stack = []; |
||
31 | |||
32 | /** |
||
33 | * @var int |
||
34 | */ |
||
35 | protected $max = 50; |
||
36 | |||
37 | /** |
||
38 | * ExecutionSpeed constructor |
||
39 | * |
||
40 | * @param int $max max |
||
41 | * |
||
42 | * @throws InvalidArgumentException |
||
43 | */ |
||
44 | public function __construct(int $max = 50) |
||
52 | |||
53 | /** |
||
54 | * @param int $count count |
||
55 | * @param int $duration duration |
||
56 | * |
||
57 | * @return void |
||
58 | */ |
||
59 | public function push(int $count, int $duration)/*: void*/ |
||
70 | |||
71 | /** |
||
72 | * @param float $coefficient |
||
73 | * @param int $precision |
||
74 | * |
||
75 | * @return float |
||
76 | */ |
||
77 | public function getSpeed(float $coefficient = 0.3, int $precision = 1): float |
||
99 | |||
100 | /** |
||
101 | * @param float $coefficient coefficient |
||
102 | * |
||
103 | * @return array |
||
104 | */ |
||
105 | protected function getCoefficients(float $coefficient): array |
||
126 | } |