| Total Complexity | 8 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Coverage | 94.12% |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | class TradesAggregator |
||
| 15 | { |
||
| 16 | private const PERIODS = [ |
||
| 17 | P_01MIN => P_01MIN, |
||
| 18 | P_03MIN => P_01MIN, |
||
| 19 | P_05MIN => P_01MIN, |
||
| 20 | P_15MIN => P_05MIN, |
||
| 21 | P_30MIN => P_05MIN, |
||
| 22 | P_45MIN => P_05MIN, |
||
| 23 | P_01HOUR => P_15MIN, |
||
| 24 | P_02HOUR => P_15MIN, |
||
| 25 | P_03HOUR => P_15MIN, |
||
| 26 | P_04HOUR => P_15MIN, |
||
| 27 | P_01DAY => P_01HOUR, |
||
| 28 | ]; |
||
| 29 | |||
| 30 | /** @var string */ |
||
| 31 | private $pair; |
||
| 32 | |||
| 33 | /**@var EventCounterDeprecated[] */ |
||
| 34 | private $counters = []; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * TradesCounter constructor. |
||
| 38 | * @param string $pair |
||
| 39 | */ |
||
| 40 | 15 | public function __construct(string $pair) |
|
| 41 | { |
||
| 42 | 15 | foreach (static::PERIODS as $length => $groupBy) { |
|
| 43 | 15 | $this->counters[$length] = new EventCounterDeprecated($length, $groupBy); |
|
| 44 | } |
||
| 45 | 15 | $this->pair = $pair; |
|
| 46 | 15 | } |
|
| 47 | |||
| 48 | 14 | public function countTrade(Trade $trade): Trade |
|
| 57 | } |
||
| 58 | |||
| 59 | 1 | public function trades(int $timePeriod): int |
|
| 60 | { |
||
| 61 | 1 | return $this->counters[$timePeriod]->getCalculatedEvents(); |
|
| 62 | } |
||
| 63 | |||
| 64 | 1 | public function volume(int $timePeriod): float |
|
| 67 | } |
||
| 68 | |||
| 69 | 1 | public function avgPrice(int $timePeriod): float |
|
| 74 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.