2022-12-30 21:54:44 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
2020-09-22 11:48:12 +02:00
|
|
|
|
|
|
|
namespace danog\MadelineProto\Settings;
|
|
|
|
|
|
|
|
use danog\MadelineProto\SettingsAbstract;
|
|
|
|
|
2020-10-07 19:31:52 +02:00
|
|
|
/**
|
|
|
|
* Serialization settings.
|
|
|
|
*/
|
2023-01-15 12:05:38 +01:00
|
|
|
final class Serialization extends SettingsAbstract
|
2020-09-22 11:48:12 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Serialization interval, in seconds.
|
|
|
|
*/
|
|
|
|
protected int $interval = 30;
|
|
|
|
|
|
|
|
public function mergeArray(array $settings): void
|
|
|
|
{
|
|
|
|
if (isset($settings['serialization']['serialization_interval'])) {
|
|
|
|
$this->setInterval($settings['serialization']['serialization_interval']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Get serialization interval, in seconds.
|
|
|
|
*/
|
|
|
|
public function getInterval(): int
|
|
|
|
{
|
|
|
|
return $this->interval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set serialization interval, in seconds.
|
|
|
|
*
|
|
|
|
* @param int $interval Serialization interval, in seconds.
|
|
|
|
*/
|
|
|
|
public function setInterval(int $interval): self
|
|
|
|
{
|
|
|
|
$this->interval = $interval;
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
}
|