2016-01-02 12:30:07 +08:00
|
|
|
<?php
|
2016-11-29 13:03:53 +08:00
|
|
|
|
2016-01-02 12:30:07 +08:00
|
|
|
/*
|
|
|
|
* 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;
|
|
|
|
|
2017-10-03 21:43:49 +08:00
|
|
|
/**
|
|
|
|
* @deprecated
|
|
|
|
*/
|
2016-01-02 12:30:07 +08:00
|
|
|
class ConfigureMiddleware
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @var MiddlewarePipe
|
|
|
|
*/
|
|
|
|
public $pipe;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2017-06-30 18:07:20 +08:00
|
|
|
public $stackName;
|
2016-01-02 12:30:07 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param MiddlewarePipe $pipe
|
2017-06-30 18:07:20 +08:00
|
|
|
* @param string $stackName
|
2016-01-02 12:30:07 +08:00
|
|
|
*/
|
2017-06-30 18:07:20 +08:00
|
|
|
public function __construct(MiddlewarePipe $pipe, $stackName)
|
2016-01-02 12:30:07 +08:00
|
|
|
{
|
|
|
|
$this->pipe = $pipe;
|
2017-06-30 18:07:20 +08:00
|
|
|
$this->stackName = $stackName;
|
2016-01-02 12:30:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public function pipe(callable $middleware)
|
|
|
|
{
|
2017-06-30 18:07:20 +08:00
|
|
|
$this->pipe->pipe($middleware);
|
2016-01-02 12:30:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public function isForum()
|
|
|
|
{
|
2017-06-30 18:07:20 +08:00
|
|
|
return $this->stackName === 'forum';
|
2016-01-02 12:30:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public function isAdmin()
|
|
|
|
{
|
2017-06-30 18:07:20 +08:00
|
|
|
return $this->stackName === 'admin';
|
2016-01-02 12:30:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public function isApi()
|
|
|
|
{
|
2017-06-30 18:07:20 +08:00
|
|
|
return $this->stackName === 'api';
|
2016-01-02 12:30:07 +08:00
|
|
|
}
|
|
|
|
}
|