Skip to content

Instantly share code, notes, and snippets.

@cameri
Created February 13, 2015 20:00
Show Gist options
  • Save cameri/4cb4b52a75b9f86b87c0 to your computer and use it in GitHub Desktop.
Save cameri/4cb4b52a75b9f86b87c0 to your computer and use it in GitHub Desktop.
protected function setResponse($code, $response = null, $headers = null) {
if (!is_array($response)) {
throw new InvalidArgumentException('Second argument only accepts arrays.');
}
$keys = array_keys($response);
$this->_keys = array_merge($this->_keys, $keys);
$this->set($response);
$this->set('_serialize', $this->_keys);
$this->response->statusCode($code);
if (is_array($headers)) {
$this->response->header($this->flatten($headers));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment