PhpDeal\Aspect\PostconditionCheckerAspect::postConditionContract PHP Method

postConditionContract() public method

Verifies post-condition contract for the method
public postConditionContract ( Go\Aop\Intercept\MethodInvocation $invocation ) : mixed
$invocation Go\Aop\Intercept\MethodInvocation
return mixed
    public function postConditionContract(MethodInvocation $invocation)
    {
        $object = $invocation->getThis();
        $args = $this->fetchMethodArguments($invocation);
        $class = $invocation->getMethod()->getDeclaringClass();
        if ($class->isCloneable()) {
            $args['__old'] = clone $object;
        }
        $result = $invocation->proceed();
        $args['__result'] = $result;
        $allContracts = $this->fetchAllContracts($invocation);
        $this->ensureContracts($invocation, $allContracts, $object, $class->name, $args);
        return $result;
    }