protected function handleResult(ContextInterface $context, $result)
    {
        $validated = $this->validateResult($result);
        if (is_null($validated)) {
            $validated = $result;
        }

        if ($validated instanceof ContextInterface) {
            $context = $validated;
        } elseif (!is_null($validated)) {
            $context->setResult($validated);
        }

        return $context;
    }
protected function handleResult(ContextInterface $context, $result)
    {
        $validated = $this->validateResult($result);
        if (is_null($validated)) {
            $validated = $result;
        }

        if ($validated instanceof ContextInterface) {
            $context = $validated;
        } elseif (!is_null($validated)) {
            $context->setResult($validated);
        }

        return $context;
    }
protected function handleResult ( ContextInterface $ context , $ result ) { $ validated = $ this -> validateResult ( $ result ) ; if ( is_null ( $ validated ) ) { $ validated = $ result ; } if ( $ validated instanceof ContextInterface ) { $ context = $ validated ; } elseif ( ! is_null ( $ validated ) ) { $ context -> setResult ( $ validated ) ; } return $ context ; }
Validate middleware result. Imprementer shall invoke
exceptions in this method if result is not valid.

@param  ContextInterface $context A context object
@param  mixed $result
@return ContextInterface|null
Validate middleware result . Imprementer shall invoke exceptions in this method if result is not valid .