Skip to content

Commit

Permalink
Updating doc blocks for CakeRequest and CakeResponse.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Aug 28, 2010
1 parent d8b2bcd commit a2186c4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 11 deletions.
18 changes: 14 additions & 4 deletions cake/libs/cake_request.php
Expand Up @@ -3,7 +3,7 @@
* A class that helps wrap Request information and particulars about a single request.
* Provides methods commonly used to introspect on the request headers and request body.
*
* Has both an Array and Object interface. You can access framework parameters using indexes
* Has both an Array and Object interface. You can access framework parameters using indexes:
*
* `$request['controller']` or `$request->controller`.
*
Expand Down Expand Up @@ -428,6 +428,8 @@ public function __call($name, $params) {
/**
* Magic get method allows access to parsed routing parameters directly on the object.
*
* Allows access to `$this->params['controller']` via `$this->controller`
*
* @param string $name The property being accessed.
* @return mixed Either the value of the parameter or null.
*/
Expand All @@ -441,7 +443,7 @@ public function __get($name) {
/**
* Check whether or not a Request is a certain type. Uses the built in detection rules
* as well as additional rules defined with CakeRequest::addDetector(). Any detector can be called
* with `is($type)` or `is$Type()`.
* as `is($type)` or `is$Type()`.
*
* @param string $type The type of request you want to check.
* @return boolean Whether or not the request is the type you are checking.
Expand Down Expand Up @@ -513,7 +515,7 @@ public function addDetector($name, $options) {
}

/**
* Add parameters to the request's parsed parameter set.
* Add parameters to the request's parsed parameter set. This will overwrite any existing parameters
*
* @param array $params Array of parameters to merge in
* @return The current object, you can chain this method.
Expand All @@ -524,7 +526,7 @@ public function addParams($params) {
}

/**
* Add paths to the requests' paths vars
* Add paths to the requests' paths vars. This will overwrite any existing paths.
*
* @param array $paths Array of paths to merge in
* @return the current object, you can chain this method.
Expand Down Expand Up @@ -597,6 +599,14 @@ function subdomains($tldLength = 1) {
* Find out which content types the client accepts or check if they accept a
* particular type of content.
*
* #### Get all types:
*
* `$request->accepts();`
*
* #### Check for a single type:
*
* `$request->accepts('json');`
*
* @param string $type The content type to check for. Leave null to get all types a client accepts.
* @return mixed Either an array of all the types the client accepts or a boolean if they accept the
* provided type.
Expand Down
19 changes: 12 additions & 7 deletions cake/libs/cake_response.php
@@ -1,7 +1,9 @@
<?php
/**
* A class reposible for managing the response text, status and headers of a HTTP response
* CakeResponse is responsible for managing the response text, status and headers of a HTTP response.
*
* By default controllers will use this class to render their response. If you are going to use
* a custom response class it should subclass this object in order to ensure compatibility.
*
* PHP 5
*
Expand All @@ -18,7 +20,6 @@
* @since CakePHP(tm) v 2.0
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/

class CakeResponse {

/**
Expand Down Expand Up @@ -330,8 +331,10 @@ public function __construct(array $options = array()) {
}

/**
* Sends the complete response to the client including headers and message body
* Sends the complete response to the client including headers and message body.
* Will echo out the content in the response body.
*
* @return void
*/
public function send() {
if (isset($this->_headers['Location']) && $this->_status === 200) {
Expand All @@ -349,10 +352,11 @@ public function send() {
}

/**
* Sends a header to the client
* Sends a header to the client.
*
* @param $name the header name
* @param $value the header value
* @return void
*/
protected function _sendHeader($name, $value = null) {
if (is_null($value)) {
Expand All @@ -363,9 +367,10 @@ protected function _sendHeader($name, $value = null) {
}

/**
* Sends a content string to the client
* Sends a content string to the client.
*
* @param $content string to send as response body
* @return void
*/
protected function _sendContent($content) {
echo $content;
Expand Down Expand Up @@ -584,7 +589,7 @@ public function charset($charset = null) {
}

/**
* Sets the correct headers to instruct the client to not cache te response
* Sets the correct headers to instruct the client to not cache the response
*
* @return void
*/
Expand All @@ -598,7 +603,7 @@ public function disableCache() {
}

/**
* Sets the correct headers to instruct the client to cache the response
* Sets the correct headers to instruct the client to cache the response.
*
* @param string $since a valid time since the response text has not been modified
* @param string $time a valid time for cache expiry
Expand Down

0 comments on commit a2186c4

Please sign in to comment.