2019-05-11 06:40:45 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace BeyondCode\LaravelWebSockets\Tests\Statistics\Logger;
|
|
|
|
|
|
2020-08-19 06:00:53 +00:00
|
|
|
use BeyondCode\LaravelWebSockets\Statistics\Logger\MemoryStatisticsLogger;
|
2019-05-11 06:40:45 +00:00
|
|
|
|
2020-08-19 06:00:53 +00:00
|
|
|
class FakeStatisticsLogger extends MemoryStatisticsLogger
|
2019-05-11 06:40:45 +00:00
|
|
|
{
|
2020-08-19 06:00:53 +00:00
|
|
|
/**
|
|
|
|
|
* {@inheritdoc}
|
|
|
|
|
*/
|
2019-05-11 06:40:45 +00:00
|
|
|
public function save()
|
|
|
|
|
{
|
|
|
|
|
foreach ($this->statistics as $appId => $statistic) {
|
|
|
|
|
$currentConnectionCount = $this->channelManager->getConnectionCount($appId);
|
|
|
|
|
$statistic->reset($currentConnectionCount);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-19 06:00:53 +00:00
|
|
|
/**
|
|
|
|
|
* Get app by id.
|
|
|
|
|
*
|
|
|
|
|
* @param mixed $appId
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
2019-05-11 06:40:45 +00:00
|
|
|
public function getForAppId($appId): array
|
|
|
|
|
{
|
|
|
|
|
$statistic = $this->findOrMakeStatisticForAppId($appId);
|
|
|
|
|
|
|
|
|
|
return $statistic->toArray();
|
|
|
|
|
}
|
|
|
|
|
}
|