ShortifyPunit\ShortifyPunit::_createChainResponse PHP Method

_createChainResponse() protected static method

Setting up a chained mock response, function is called from mocked classes
protected static _createChainResponse ( $mockClassInstanceId, $mockClassType, $chainedMethodsBefore, $currentMethod, $args ) : null
$mockClassInstanceId
$mockClassType
$chainedMethodsBefore
$currentMethod
$args
return null
    protected static function _createChainResponse($mockClassInstanceId, $mockClassType, $chainedMethodsBefore, $currentMethod, $args)
    {
        $currentMethodName = key($currentMethod);
        $rReturnValues =& self::getMockHierarchyResponse($chainedMethodsBefore, $mockClassType, $mockClassInstanceId);
        // Check current method exist in return values chain
        $serializedArgs = serialize($args);
        if (!isset($rReturnValues[$currentMethodName][$serializedArgs]['response'])) {
            $serializedArgs = static::checkMatchingArguments($rReturnValues[$currentMethodName], $args);
            if (is_null($serializedArgs)) {
                return null;
            }
        }
        return self::generateResponse($rReturnValues[$currentMethodName][$serializedArgs]['response'], $args);
    }