appwrite/src/Appwrite/Event/UsageDump.php

45 lines
795 B
PHP
Raw Normal View History

2024-01-28 09:28:59 +00:00
<?php
namespace Appwrite\Event;
use Utopia\Queue\Connection;
class UsageDump extends Event
{
protected array $stats;
public function __construct(protected Connection $connection)
{
parent::__construct($connection);
$this
->setQueue(Event::USAGE_DUMP_QUEUE_NAME)
->setClass(Event::USAGE_DUMP_CLASS_NAME);
}
/**
* Add Stats.
*
* @param array $stats
* @return self
*/
public function setStats(array $stats): self
{
$this->stats = $stats;
return $this;
}
/**
2025-01-17 05:08:39 +00:00
* Prepare the payload for the usage dump event.
2024-01-28 09:28:59 +00:00
*
2025-01-17 05:08:39 +00:00
* @return array
2024-01-28 09:28:59 +00:00
*/
2025-01-17 05:08:39 +00:00
protected function preparePayload(): array
2024-01-28 09:28:59 +00:00
{
2025-01-17 05:08:39 +00:00
return [
2024-01-28 09:28:59 +00:00
'stats' => $this->stats,
2025-01-17 05:08:39 +00:00
];
2024-01-28 09:28:59 +00:00
}
}