ShortifyPunit\ShortifyPunit::_createResponse PHP Method

_createResponse() protected static method

Create response is a private method which is called from the Mocked classes returns a value which was set before in the When() function otherwise returning NULL
protected static _createResponse ( $className, $instanceId, $methodName, $arguments ) : Mixed | null
$className
$instanceId
$methodName
$arguments
return Mixed | null | null
    protected static function _createResponse($className, $instanceId, $methodName, $arguments)
    {
        $args = serialize($arguments);
        // check if instance of this method even exist
        if (!isset(self::$returnValues[$className][$instanceId][$methodName])) {
            return null;
        }
        // Check if doesn't exist as-is in return values array
        if (!isset(self::$returnValues[$className][$instanceId][$methodName][$args]['response'])) {
            // try to finding matching Hamcrest-API Function (anything(), equalTo())
            $returnValues = self::$returnValues[$className][$instanceId][$methodName];
            $args = static::checkMatchingArguments($returnValues, $arguments);
        }
        return is_null($args) ? null : self::generateResponse(self::$returnValues[$className][$instanceId][$methodName][$args]['response'], $arguments);
    }