private function createChainArrayOfReturnValues($action, $response)
    {
        // Pop first method
        $methods = $this->methods;
        $firstMethod = array_pop($methods);

        $lastValue = $response;

        $mockClassType = get_class($this->mockClass);

        if ( ! $this->mockClass instanceof MockInterface) {
            throw self::generateException('Class is not implementing MockInterface.');
        }

        $mockClassInstanceId = $this->mockClass->getShortifyPunitInstanceId();

        foreach($methods as $currentMethod)
        {
            $fakeClass = new MockClassOnTheFly();

            // extracting methods before the current method into an array
            $chainedMethodsBefore = $this->extractChainedMethodsBefore(
                array_reverse($this->methods),
                $currentMethod
            );

            // adding to the ShortifyPunit chained method response
            $this->addChainedMethodResponse(
                $chainedMethodsBefore,
                $currentMethod,
                $action,
                $lastValue,
                $mockClassInstanceId
            );

            $currentMethodName = key($currentMethod);

            // closure for MockOnTheFly chained methods
            $fakeClass->$currentMethodName = function() use (
                $mockClassInstanceId,
                $mockClassType,
                $chainedMethodsBefore,
                $currentMethod
            ) {
                return ShortifyPunit::createChainResponse(
                    $mockClassInstanceId,
                    $mockClassType,
                    $chainedMethodsBefore,
                    $currentMethod,
                    func_get_args()
                );
            };

            $lastValue = $fakeClass;

            // except from the last method all other chained method `returns` a calls so set the action for the next loop
            $action = MockAction::RETURNS;
        }



        $whenCase = new WhenCase($mockClassType, $this->mockClass->getShortifyPunitInstanceId(), key($firstMethod));
        $whenCase->setMethod(current($firstMethod), $action, $lastValue);
    }