@param RuleInterface $next

@return RuleInterface
168718
protected static function isNumeric(RuleInterface $next = null): RuleInterface
    {
        return $next === null ? new AsNumeric() : new AndOperator(new AsNumeric(), $next);
    }
859467
public static function readable(string $apiClass, RuleInterface $next = null): RuleInterface
    {
        $primary = new IsReadableViaApiRule($apiClass);

        return $next === null ? $primary : new AndOperator($primary, $next);
    }
433286
public static function roleRelationship(RuleInterface $next = null): RuleInterface
    {
        return self::toOneRelationship(RoleSchema::TYPE, static::roleId($next));
    }
447187
protected static function stringLengthMax(int $max, RuleInterface $next = null): RuleInterface
    {
        return $next === null ?
            new StringLengthMax($max) :
            new AndOperator(static::stringLengthMax($max), $next);
    }
1200087
public function handle($request, Closure $next)
    {
        if ($this->auth->check()) {
            /** @var CoreInterface $core */
            $core = app(Component::CORE);

            return redirect()->route( $core->prefixRoute(NamedRoute::HOME) );
        }

        return $next($request);
    }
1275535
public function execute($command, callable $next)
    {
        try {
            return $next($command);
        } catch (ExceptionInterface $exception) {
            throw $exception;
        } catch (ValidationException $exception) {
            $this->exceptionHandler->throwServiceExceptionFromViolationException($exception);
        } catch (RequestException $exception) {
            $this->exceptionHandler->throwServiceExceptionFromRequestException($exception);
        } catch (\Throwable $exception) {
            $this->exceptionHandler->throwServiceException($exception);
        }
    }
106273
public static function toManyRelationship(string $type, RuleInterface $next = null): RuleInterface
    {
        $primary = new ToManyRelationshipTypeCheckerRule($type);

        return $next === null ? $primary : new AndOperator($primary, $next);
    }
762845
public function next(RequestInterface $request)
    {
        if (!count($this->processingStack) && $this->responseSourceDelegate) {
            return $this->responseSourceDelegate->next($request);
        }
        return parent::next($request);
    }
318285
protected static function notEquals($value, RuleInterface $next = null): RuleInterface
    {
        if ($value === null) {
            $rule = new IsNotNull();
        } elseif ($value instanceof DateTimeInterface) {
            $rule = new DateTimeNotEquals($value);
        } else {
            $rule = new ScalarNotEquals($value);
        }

        return $next === null ? $rule : new AndOperator(static::notEquals($value), $next);
    }
463485
public function handle($request, \Closure $next)
    {
        $route = $request->route();

        if ($route->hasCondition()) {
            $this->router->addWordPressBindings($route);
        }

        return $next($request);
    }
530849
public function handle(ServerRequestInterface $request, DelegateInterface $next)
    {
        $cookies = $request->getCookieParams();

        if (!isset($cookies[static::SESSION_ID_KEY])) {
            $sessionId = session_create_id();
        } else {
            $sessionId = $cookies[static::SESSION_ID_KEY];
        }

        $request->withHeader(static::SESSION_ID_KEY, $sessionId);

        $response = $next->process($request);

        return $response->withCookie(static::SESSION_ID_KEY, $sessionId);
    }
842551
protected static function stringToInt(RuleInterface $next = null): RuleInterface
    {
        return $next === null ? new StringToInt() : new AndOperator(new StringToInt(), $next);
    }
246117
public function findSiblingRow(EM\RowInterface $row, $next = false)
    {
        if (null === $container = $row->getContainer()) {
            return null;
        }

        return $this->findSibling($container->getRows(), $row, $next);
    }
1040832
private function next(QueryBuilder $nextQuery)
    {
        $now = new \DateTime('now');

        $qb = clone $nextQuery;
        $qb->setParameter(':currentTime', $now->format('Y-m-d H:i:s'));

        return $qb->execute()->fetch();
    }
430922
public static function toOneRelationship(string $type, RuleInterface $next = null): RuleInterface
    {
        $primary = new ToOneRelationshipTypeCheckerRule($type);

        return $next === null ? $primary : new AndOperator($primary, $next);
    }
1301372
public function handle($request, Closure $next)
    {
        if ( ! $this->auth->check()) {

            if ($request->ajax() || $request->wantsJson()) {
                return response('Unauthorized.', 401);
            } else {
                /** @var CoreInterface $core */
                $core = app(Component::CORE);

                return redirect()->route( $core->prefixRoute(NamedRoute::AUTH_LOGIN) );
            }
        }

        return $next($request);
    }
793226
public static function existAll(string $tableName, string $primaryName, RuleInterface $next = null): RuleInterface
    {
        $primary = new ExistInDbTableMultipleWithDoctrineRule($tableName, $primaryName);

        return $next === null ? $primary : new AndOperator($primary, $next);
    }