mirror of https://github.com/movim/movim
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
663 B
37 lines
663 B
<?php
|
|
|
|
namespace App;
|
|
|
|
use App\Presence;
|
|
|
|
class PresenceBuffer
|
|
{
|
|
protected static $instance;
|
|
private $saver = null;
|
|
|
|
public static function getInstance()
|
|
{
|
|
if (!isset(self::$instance)) {
|
|
self::$instance = new self();
|
|
}
|
|
|
|
return self::$instance;
|
|
}
|
|
|
|
public function save()
|
|
{
|
|
if ($this->saver) {
|
|
$this->saver->save();
|
|
$this->saver = null;
|
|
}
|
|
}
|
|
|
|
public function append(Presence $presence, $call)
|
|
{
|
|
if ($this->saver == null) {
|
|
$this->saver = new PresenceBufferSaver;
|
|
}
|
|
|
|
$this->saver->append($presence, $call);
|
|
}
|
|
}
|