diff --git a/cake/libs/i18n.php b/cake/libs/i18n.php index 2ebdd8662..3db3a47fe 100644 --- a/cake/libs/i18n.php +++ b/cake/libs/i18n.php @@ -24,7 +24,7 @@ App::import('Core', 'l10n'); /** - * Short description for file. + * I18n handles translation of Text and time format strings. * * @package cake * @subpackage cake.cake.libs @@ -120,10 +120,10 @@ class I18n extends Object { * * @param string $singular String to translate * @param string $plural Plural string (if any) - * @param string $domain Domain - * @param string $category Category - * @param integer $count Count - * @return string translated strings. + * @param string $domain Domain The domain of the translation. Domains are often used by plugin translations + * @param string $category Category The integer value of the category to use. + * @param integer $count Count Count is used with $plural to choose the correct plural form. + * @return string translated string. * @access public */ function translate($singular, $plural = null, $domain = null, $category = 6, $count = null) { diff --git a/cake/libs/inflector.php b/cake/libs/inflector.php index 8c0d5900e..5a117c076 100644 --- a/cake/libs/inflector.php +++ b/cake/libs/inflector.php @@ -269,14 +269,19 @@ class Inflector { /** * Adds custom inflection $rules, of either 'plural' or 'singular' $type. * + * ### Usage: + * + * {{{ + * Inflector::rules('plural', array('/^(inflect)or$/i' => '\1ables')); + * Inflector::rules('plural', array( + * 'rules' => array('/^(inflect)ors$/i' => '\1ables'), + * 'uninflected' => array('dontinflectme'), + * 'irregular' => array('red' => 'redlings') + * )); + * }}} + * * @param string $type The type of inflection, either 'singular' or 'plural' - * @param array $rules Array of rules to be added. Example usage: - * Inflector::rules('plural', array('/^(inflect)or$/i' => '\1ables')); - * Inflector::rules('plural', array( - * 'rules' => array('/^(inflect)ors$/i' => '\1ables'), - * 'uninflected' => array('dontinflectme'), - * 'irregular' => array('red' => 'redlings') - * )); + * @param array $rules Array of rules to be added. * @param boolean $reset If true, will unset default inflections for all * new rules that are being defined in $rules. * @access public diff --git a/cake/libs/l10n.php b/cake/libs/l10n.php index cff50caba..b9eca5b7c 100644 --- a/cake/libs/l10n.php +++ b/cake/libs/l10n.php @@ -336,8 +336,8 @@ class L10n extends Object { /** * Gets the settings for $language. - * If $language is null it attempt to get settings from I10n::__autoLanguage(); if this fails - * the method will get the settings from I10n::__setLanguage(); + * If $language is null it attempt to get settings from L10n::__autoLanguage(); if this fails + * the method will get the settings from L10n::__setLanguage(); * * @param string $language Language (if null will use DEFAULT_LANGUAGE if defined) * @access public @@ -432,7 +432,8 @@ class L10n extends Object { * Attempts to find locale for language, or language for locale * * @param mixed $mixed 2/3 char string (language/locale), array of those strings, or null - * @return mixed string language/locale, array of those values, whole map as an array, or false when language/locale doesn't exist + * @return mixed string language/locale, array of those values, whole map as an array, + * or false when language/locale doesn't exist * @access public */ function map($mixed = null) { @@ -459,7 +460,9 @@ class L10n extends Object { * Attempts to find catalog record for requested language * * @param mixed $language string requested language, array of requested languages, or null for whole catalog - * @return mixed array catalog record for requested language, array of catalog records, whole catalog, or false when language doesn't exist + * @return mixed array catalog record for requested language, array of catalog records, whole catalog, + * or false when language doesn't exist + * @access public */ function catalog($language = null) { if (is_array($language)) { diff --git a/cake/libs/object.php b/cake/libs/object.php index a9669b009..3c0535f3c 100644 --- a/cake/libs/object.php +++ b/cake/libs/object.php @@ -67,12 +67,14 @@ class Object { } /** - * Calls a controller's method from any location. + * Calls a controller's method from any location. Can be used to connect controllers together + * or tie plugins into a main application. requestAction can be used to return rendered views + * or fetch the return value from controller actions. * * @param mixed $url String or array-based url. * @param array $extra if array includes the key "return" it sets the AutoRender to true. * @return mixed Boolean true or false on success/failure, or contents - * of rendered action if 'return' is set in $extra. + * of rendered action if 'return' is set in $extra. * @access public */ function requestAction($url, $extra = array()) { @@ -95,8 +97,7 @@ class Object { /** * Calls a method on this object with the given parameters. Provides an OO wrapper - * for call_user_func_array, and improves performance by using straight method calls - * in most cases. + * for `call_user_func_array` * * @param string $method Name of the method to call * @param array $params Parameter list to use when calling $method @@ -124,7 +125,8 @@ class Object { } /** - * Stop execution of the current script + * Stop execution of the current script. Wraps exit() making + * testing easier. * * @param $status see http://php.net/exit for values * @return void @@ -135,7 +137,8 @@ class Object { } /** - * API for logging events. + * Convience method to write a message to CakeLog. See CakeLog::write() + * for more information on writing to logs. * * @param string $msg Log message * @param integer $type Error type constant. Defined in app/config/core.php. @@ -153,7 +156,8 @@ class Object { } /** - * Allows setting of multiple properties of the object in a single line of code. + * Allows setting of multiple properties of the object in a single line of code. Will only set + * properties that are part of a class declaration. * * @param array $properties An associative array containing properties and corresponding values. * @return void diff --git a/cake/libs/router.php b/cake/libs/router.php index ee135624f..29707676c 100644 --- a/cake/libs/router.php +++ b/cake/libs/router.php @@ -27,7 +27,7 @@ class Router { /** - * Array of routes + * Array of routes connected with Router::connect() * * @var array * @access public @@ -110,18 +110,6 @@ class Router { array('action' => 'edit', 'method' => 'POST', 'id' => true) ); -/** - * HTTP header shortcut map. Used for evaluating header-based route expressions. - * - * @var array - * @access private - */ - var $__headerMap = array( - 'type' => 'content_type', - 'method' => 'request_method', - 'server' => 'server_name' - ); - /** * List of resource-mapped controllers * @@ -193,7 +181,7 @@ class Router { /** * Gets a reference to the Router object instance * - * @return object Object instance + * @return Router Instance of the Router. * @access public * @static */ @@ -248,6 +236,15 @@ class Router { * Shows connecting a route with custom route parameters as well as providing patterns for those parameters. * Patterns for routing parameters do not need capturing groups, as one will be added for each route params. * + * $options offers two 'special' keys. `pass` and `persist` have special meaning in the $options array. + * + * `pass` is used to define which of the routed parameters should be shifted into the pass array. Adding a + * parameter to pass will remove it from the regular route array. Ex. `'pass' => array('slug')` + * + * `persist` is used to define which route parameters should be automatically included when generating + * new urls. You can override peristent parameters by redifining them in a url or remove them by + * setting the parameter to `false`. Ex. `'persist' => array('lang')` + * * @param string $route A string describing the template of the route * @param array $defaults An array describing the default route parameters. These parameters will be used by default * and can supply routing parameters that are not dynamic. See above. @@ -292,24 +289,41 @@ class Router { * Specifies what named parameters CakePHP should be parsing. The most common setups are: * * Do not parse any named parameters: + * * {{{ Router::connectNamed(false); }}} * * Parse only default parameters used for CakePHP's pagination: + * * {{{ Router::connectNamed(false, array('default' => true)); }}} * * Parse only the page parameter if its value is a number: + * * {{{ Router::connectNamed(array('page' => '[\d]+'), array('default' => false, 'greedy' => false)); }}} * * Parse only the page parameter no mater what. + * * {{{ Router::connectNamed(array('page'), array('default' => false, 'greedy' => false)); }}} * * Parse only the page parameter if the current action is 'index'. - * {{{ Router::connectNamed(array('page' => array('action' => 'index')), array('default' => false, 'greedy' => false)); }}} + * + * {{{ + * Router::connectNamed( + * array('page' => array('action' => 'index')), + * array('default' => false, 'greedy' => false) + * ); + * }}} * * Parse only the page parameter if the current action is 'index' and the controller is 'pages'. - * {{{ Router::connectNamed(array('page' => array('action' => 'index', 'controller' => 'pages')), array('default' => false, 'greedy' => false)); }}} * - * @param array $named A list of named parameters. Key value pairs are accepted where values are either regex strings to match, or arrays as seen above. + * {{{ + * Router::connectNamed( + * array('page' => array('action' => 'index', 'controller' => 'pages')), + * array('default' => false, 'greedy' => false) + * ); + * }}} + * + * @param array $named A list of named parameters. Key value pairs are accepted where values are + * either regex strings to match, or arrays as seen above. * @param array $options Allows to control all settings: separator, greedy, reset, default * @return array * @access public @@ -366,7 +380,7 @@ class Router { /** * Creates REST resource routes for the given controller(s) * - * Options: + * ### Options: * * - 'id' - The regular expression fragment to use when matching IDs. By default, matches * integer values and UUIDs. @@ -412,7 +426,7 @@ class Router { } /** - * Parses given URL and returns an array of controllers, action and parameters + * Parses given URL and returns an array of controller, action and parameters * taken from that URL. * * @param string $url URL to be parsed @@ -521,8 +535,20 @@ class Router { } /** - * Connects the default, built-in routes, including admin routes, and (deprecated) web services - * routes. + * Connects the default, built-in routes, including prefix and plugin routes. The following routes are created + * in the order below: + * + * - `/:prefix/:plugin/:controller` + * - `/:prefix/:plugin/:controller/:action/*` + * - `/:prefix/:controller` + * - `/:prefix/:controller/:action/*` + * - `/:plugin/:controller` + * - `/:plugin/:controller/:action/*` + * - `/:controller' + * - `/:controller/:action/*' + * + * A prefix route is generated for each Routing.prefixes declared in core.php. You can disable the + * connection of default routes with Router::defaults(). * * @return void * @access private @@ -560,7 +586,9 @@ class Router { } /** - * Takes parameter and path information back from the Dispatcher + * Takes parameter and path information back from the Dispatcher, sets these + * parameters as the current request parameters that are merged with url arrays + * created later in the request. * * @param array $params Parameters and path information * @return void @@ -586,7 +614,7 @@ class Router { /** * Gets parameter information * - * @param boolean $current Get current parameter (true) + * @param boolean $current Get current request parameter, useful when using requestAction * @return array Parameter information * @access public * @static @@ -606,7 +634,7 @@ class Router { * Gets URL parameter by name * * @param string $name Parameter name - * @param boolean $current Current parameter + * @param boolean $current Current parameter, useful when using requestAction * @return string Parameter value * @access public * @static @@ -622,7 +650,7 @@ class Router { /** * Gets path information * - * @param boolean $current Current parameter + * @param boolean $current Current parameter, useful when using requestAction * @return array * @access public * @static @@ -639,7 +667,8 @@ class Router { } /** - * Reloads default Router settings + * Reloads default Router settings. Resets all class variables and + * removes all connected routes. * * @access public * @return void @@ -657,7 +686,7 @@ class Router { * Promote a route (by default, the last one added) to the beginning of the list * * @param $which A zero-based array index representing the route to move. For example, - * if 3 routes have been added, the last route would be 2. + * if 3 routes have been added, the last route would be 2. * @return boolean Retuns false if no route exists at the position specified by $which. * @access public * @static @@ -1039,7 +1068,7 @@ class Router { /** * Returns the route matching the current request URL. * - * @return array Matching route + * @return CakeRoute Matching route object. * @access public * @static */ @@ -1051,7 +1080,7 @@ class Router { /** * Returns the route matching the current request (useful for requestAction traces) * - * @return array Matching route + * @return CakeRoute Matching route object. * @access public * @static */ @@ -1175,7 +1204,7 @@ class CakeRoute { /** * An array of named segments in a Route. - * `/:controller/:action/:id` has 3 named elements + * `/:controller/:action/:id` has 3 key elements * * @var array * @access public @@ -1189,6 +1218,7 @@ class CakeRoute { * @access public */ var $options = array(); + /** * Default parameters for a Route * @@ -1260,7 +1290,7 @@ class CakeRoute { } /** - * Compiles the routes regular expression. Modifies defaults property so all necessary keys are set + * Compiles the route's regular expression. Modifies defaults property so all necessary keys are set * and populates $this->names with the named routing elements. * * @return array Returns a string regular expression of the compiled route. @@ -1276,7 +1306,7 @@ class CakeRoute { /** * Builds a route regular expression. Uses the template, defaults and options - * properties to compile a regular expression that can be used to match/parse request strings. + * properties to compile a regular expression that can be used to parse request strings. * * @return void * @access protected @@ -1324,7 +1354,7 @@ class CakeRoute { /** * Checks to see if the given URL can be parsed by this route. * If the route can be parsed an array of parameters will be returned if not - * false will be returned. + * false will be returned. String urls are parsed if they match a routes regular expression. * * @param string $url The url to attempt to parse. * @return mixed Boolean false on failure, otherwise an array or parameters @@ -1377,7 +1407,9 @@ class CakeRoute { } /** - * Apply persistent parameters to a url array. + * Apply persistent parameters to a url array. Persistant parameters are a special + * key used during route creation to force route parameters to persist when omitted from + * a url array. * * @param array $url The array to apply persistent parameters to. * @param array $params An array of persistent values to replace persistent ones. @@ -1394,9 +1426,9 @@ class CakeRoute { } /** - * Attempt to match a url array. If the url matches the routes pattern, then - * return an array of parsed params. If the url doesn't match the routes compiled pattern - * returns false. + * Attempt to match a url array. If the url matches the route parameters + settings, then + * return a generated string url. If the url doesn't match the route parameters false will be returned. + * This method handles the reverse routing or conversion of url arrays into string urls. * * @param array $url An array of parameters to check matching with. * @return mixed Either a string url for the parameters if they match or false. @@ -1476,10 +1508,11 @@ class CakeRoute { } /** - * Converts a matching route array into a url string. + * Converts a matching route array into a url string. Composes the string url using the template + * used to create the route. * * @param array $params The params to convert to a string url. - * @return string Compiled route string. + * @return string Composed route string. * @access protected */ function _writeUrl($params) { diff --git a/cake/libs/security.php b/cake/libs/security.php index fe65c7e81..8b08c251f 100644 --- a/cake/libs/security.php +++ b/cake/libs/security.php @@ -19,7 +19,7 @@ */ /** - * Short description for file. + * Security Library contains utility methods related to security * * @package cake * @subpackage cake.cake.libs @@ -105,7 +105,7 @@ class Security extends Object { * @param string $string String to hash * @param string $type Method to use (sha1/sha256/md5) * @param boolean $salt If true, automatically appends the application's salt - * value to $string (Security.salt) + * value to $string (Security.salt) * @return string Hash * @access public * @static diff --git a/cake/libs/set.php b/cake/libs/set.php index 2f9551a99..09bc6f563 100644 --- a/cake/libs/set.php +++ b/cake/libs/set.php @@ -21,8 +21,6 @@ /** * Class used for manipulation of arrays. * - * Long description for class - * * @package cake * @subpackage cake.cake.libs */ @@ -37,7 +35,8 @@ class Set { /** * This function can be thought of as a hybrid between PHP's array_merge and array_merge_recursive. The difference * to the two is that if an array key contains another array then the function behaves recursive (unlike array_merge) - * but does not do if for keys containing strings (unlike array_merge_recursive). See the unit test for more information. + * but does not do if for keys containing strings (unlike array_merge_recursive). + * See the unit test for more information. * * Note: This function will work with an unlimited amount of arguments and typecasts non-array parameters into arrays. * @@ -289,10 +288,10 @@ class Set { /** * Returns a series of values extracted from an array, formatted in a format string. * - * @param array $data Source array from which to extract the data - * @param string $format Format string into which values will be inserted, see sprintf() - * @param array $keys An array containing one or more Set::extract()-style key paths - * @return array An array of strings extracted from $keys and formatted with $format + * @param array $data Source array from which to extract the data + * @param string $format Format string into which values will be inserted, see sprintf() + * @param array $keys An array containing one or more Set::extract()-style key paths + * @return array An array of strings extracted from $keys and formatted with $format * @access public * @static */ @@ -345,7 +344,7 @@ class Set { } /** - * Implements partial support for XPath 2.0. If $path is an array or $data is empty it the call + * Implements partial support for XPath 2.0. If $path is an array or $data is empty it the call * is delegated to Set::classicExtract. * * #### Currently implemented selectors: @@ -366,8 +365,8 @@ class Set { * * - Only absolute paths starting with a single '/' are supported right now * - * **Warning**: Even so it has plenty of unit tests the XPath support has not gone through a lot of - * real-world testing. Please report Bugs as you find them. Suggestions for additional features to + * **Warning**: Even so it has plenty of unit tests the XPath support has not gone through a lot of + * real-world testing. Please report Bugs as you find them. Suggestions for additional features to * implement are also very welcome! * * @param string $path An absolute XPath 2.0 path diff --git a/cake/libs/string.php b/cake/libs/string.php index 10ec4cb34..12e8c7718 100644 --- a/cake/libs/string.php +++ b/cake/libs/string.php @@ -2,7 +2,6 @@ /** * String handling methods. * - * * PHP versions 4 and 5 * * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) @@ -108,8 +107,10 @@ class String { * $leftBound and $rightBound * * @param string $data The data to tokenize - * @param string $separator The token to split the data on - * @return array + * @param string $separator The token to split the data on. + * @param string $leftBound The left boundary to ignore separators in. + * @param string $rightBound The right boundary to ignore separators in. + * @return array Array of tokens in $data. * @access public * @static */