src/Middleware/Queue.php
protected function evalCondition(
        $condition,
        RequestInterface $request,
        ResponseInterface $response
    )/*# : bool */ {
        // instanceof ConditionInterface
        if (is_object($condition) && $condition instanceof ConditionInterface) {
            return $condition->evaluate($request, $response);

        // old style callable
        } elseif (is_callable($condition)) {
            return $condition($request, $response);

        // unknown type
        } else {
            throw new LogicException(
                Message::get(Message::CONDITION_INVALID, $condition),
                Message::CONDITION_INVALID
            );
        }
    }
protected function evalCondition(
        $condition,
        RequestInterface $request,
        ResponseInterface $response
    )/*# : bool */ {
        // instanceof ConditionInterface
        if (is_object($condition) && $condition instanceof ConditionInterface) {
            return $condition->evaluate($request, $response);

        // old style callable
        } elseif (is_callable($condition)) {
            return $condition($request, $response);

        // unknown type
        } else {
            throw new LogicException(
                Message::get(Message::CONDITION_INVALID, $condition),
                Message::CONDITION_INVALID
            );
        }
    }
protected function evalCondition ( $ condition , RequestInterface $ request , ResponseInterface $ response ) /*# : bool */ { // instanceof ConditionInterface if ( is_object ( $ condition ) && $ condition instanceof ConditionInterface ) { return $ condition -> evaluate ( $ request , $ response ) ; // old style callable } elseif ( is_callable ( $ condition ) ) { return $ condition ( $ request , $ response ) ; // unknown type } else { throw new LogicException ( Message :: get ( Message :: CONDITION_INVALID , $ condition ) , Message :: CONDITION_INVALID ) ; } }
Evaluate the condition

support both a callable returns bool value or an object instance of
ConditionInterface.

@param  ConditionInterface|callable $condition
@param  RequestInterface $request
@param  ResponseInterface $response
@return bool
@throws LogicException if condition is invalid
@access protected
Evaluate the condition