for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of GitterBot package.
*
* @author Serafim <[email protected]>
* @date 28.01.2016 16:35
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Gitter;
use Gitter\Client as BaseClient;
use App\Exceptions\GitterHandler;
use React\EventLoop\LoopInterface;
* Class Client
* @package App\Gitter
class Client extends BaseClient
{
* @var bool
protected $fallbackMode = false;
* @var array
protected $fallbackSubscribers = [];
* Client constructor.
* @param LoopInterface $loop
* @param string $token
public function __construct(LoopInterface $loop, $token)
parent::__construct($loop, $token);
$this->setErrorHandler(new GitterHandler());
}
* @param bool $value
* @return $this
public function setFallbackMode(bool $value = true)
if ($this->fallbackMode !== $value) {
foreach ($this->fallbackSubscribers as $subscriber) {
$subscriber($value);
$this->fallbackMode = $value;
return $this;
* @return bool
public function isFallbackMode()
return $this->fallbackMode;
* @param \Closure $callback
public function onChangeFallbackMode(\Closure $callback)
$this->fallbackSubscribers[] = $callback;