src/ShortifyPunit.php
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
        );
    }
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
        );
    }
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 ) ; }
Setting up a chained mock response, function is called from mocked classes

@param $mockClassInstanceId
@param $mockClassType
@param $chainedMethodsBefore
@param $currentMethod
@param $args
@return null
Setting up a chained mock response function is called from mocked classes