Add a response to the list.

@param int $key
@param array|null $response
172
public function addResponse($key, array $response)
    {
        $originalRequest = isset($this->request[$key]) ? $this->request[$key] : null;
        $responseBody = isset($response['body']) ? $response['body'] : null;
        $responseError = isset($response['error']) ? $response['error'] : null;
        $responseMethod = isset($response['method']) ? $response['method'] : null;

        $this->responses[$key] = new Response($originalRequest, $responseBody, $responseError, $responseMethod);
    }
923563
public function setPost($key, $value = null)
    {
        if (is_array($key)) {
            $_POST = $key;
        } else {
            $_POST[$key] = $value;
        }
        return $this;
    }
868275
public function selfFromResponse(array $response)
    {
        $this->fill($response);

        foreach ($this->getSingleNestedEntities() as $key => $value) {
            if (isset($response[$key])) {
                $entityName = $value;
                $this->$key = new $entityName($this->connection, $response[$key]);
            }
        }

        foreach ($this->getMultipleNestedEntities() as $key => $value) {
            if (isset($response[$key])) {
                $entityName = $value['entity'];
                /** @var self $instantiatedEntity */
                $instantiatedEntity = new $entityName($this->connection);
                $this->$key = $instantiatedEntity->collectionFromResult($response[$key]);
            }
        }

        return $this;
    }
212236
public function addResponse($response)
    {
        if (is_string($response)) {
            $response = file_exists($response)
                ? $this->factory->fromMessage(file_get_contents($response))
                : $this->factory->fromMessage($response);
        } elseif (!($response instanceof ResponseInterface)) {
            throw new \InvalidArgumentException('Response must a message '
                . 'string, response object, or path to a file');
        }

        $this->queue[] = $response;

        return $this;
    }
1204130
protected function addParam($key, $value = null)
	{
		if (is_null($value))
		{
			$this->params[] = $key;
		}
		else
		{
			$this->params[$key] = $value;
		}

	}
1104971
private static function sendResponse( SlimResponse $response )
	{
		header(sprintf(
			'HTTP/%s %s %s',
			$response->getProtocolVersion(),
			$response->getStatusCode(),
			$response->getReasonPhrase()
		));
		foreach ($response->getHeaders() as $name => $values) {
			header( sprintf('%s: %s', $name, $response->getHeaderLine($name)) );
		}
		if (config('system.errors.display')) {
			echo str_replace("\t", '\\\t',$response->getBody(true));
		}
	}
1201172
protected function updateResponse(Request $request, Response $response)
    {
        $this->stopProfiling(ProfilingCollection::REQUEST_TIMER);

        if ($this->needToUpdateResponse($response)) {
            $data = $this->getResponseData($response);

            if ($data === false) {
                return;
            }

            $data[$this->responseKey] = $this->storage->getData();

            $this->setResponseData($response, $data);
        }
    }
732229
protected function parseResponseData($key = null)
    {
        $responseData = get_array_data('resource_response.data', $this->data);

        if (!$responseData) {
            return false;
        }

        return $key ?
            get_array_data($key, $responseData) :
            $responseData;
    }
779489
def add(response)
      if @list.key? response.name
        raise DuplicateResponse, "A response named #{response.name} already exists"
      end
      @list[response.name] = response
    end
173649
public function add($keys, $value = null)
    {
        if (is_array($keys)) {
            foreach ($keys as $key => $value) {
                $this->add($key, $value);
            }
        } elseif (is_null($this->get($keys))) {
            $this->set($keys, $value);
        }
    }
1340106
public function addQuery($key, $value = null)
    {
        //if it's an array
        if (is_array($key)) {
            //warning this overwrites existing headers
            $this->query = $key;
            return $this;
        }

        //else it should be key value
        $this->query[$key] =  $value;
        return $this;
    }
1200444
public function addItems($list, $key = null)
    {
        if(is_array($list)) {
            array_walk($list, function($val, $key){
                $this->addItem($val, $key);
            });
            return $this;
        }

        $this->addItem($list, $key);
        return $this;
    }
1372631
public function getResponseByKey($key)
  {
    return isset($this->responses[$key]) ? $this->responses[$key] : null;
  }
2253
public function addRequestHeader($key, $value = null)
    {
        if (is_array($key)) {
            foreach ($key as $newKey => $newValue) {
                $this->addRequestHeader($newKey, $newValue);
            }
        } else {
            $key = preg_replace_callback(
                '/([\s\-_]|^)([a-z0-9-_])/',
                function ($match) {
                    return strtoupper($match[0]);
                },
                $key
            );
            $this->requestHeader[] = "$key: $value";
        }
    }
1204556
public function addHeader(string $key, string $value): Response
    {
        $this->headers->add($key, $value);
        return $this;
    }
572692
protected function writeQueuedCookies(Response $response)
    {
        foreach ($this->queue->getQueuedCookies() as $cookie) {
            $response->headers->setCookie($cookie);
        }
    }
711543
public function addResponseContent(ResponseContent $content, $key = '')
    {
        if (empty($key)) {
            $this->responseContent[] = $content->toArray();
        } else {
            $this->responseContent[$key] = $content->toArray();
        }

        return $this;
    }