framework/src/Event/ConfigureMiddleware.php
Franz Liedke c41e58531a
Deprecate remaining non-namespaced events
These will be replaced by etenders soon.
2018-01-03 09:42:11 +01:00

61 lines
1.0 KiB
PHP

<?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Event;
use Zend\Stratigility\MiddlewarePipe;
/**
* @deprecated
*/
class ConfigureMiddleware
{
/**
* @var MiddlewarePipe
*/
public $pipe;
/**
* @var string
*/
public $stackName;
/**
* @param MiddlewarePipe $pipe
* @param string $stackName
*/
public function __construct(MiddlewarePipe $pipe, $stackName)
{
$this->pipe = $pipe;
$this->stackName = $stackName;
}
public function pipe(callable $middleware)
{
$this->pipe->pipe($middleware);
}
public function isForum()
{
return $this->stackName === 'forum';
}
public function isAdmin()
{
return $this->stackName === 'admin';
}
public function isApi()
{
return $this->stackName === 'api';
}
}