mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Updating docblocks and adding @link tags.
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7816 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
0fd3badee4
commit
5a0ab7b220
1 changed files with 27 additions and 14 deletions
|
@ -43,34 +43,37 @@ if (!class_exists('Set')) {
|
|||
*
|
||||
* @package cake
|
||||
* @subpackage cake.cake.libs
|
||||
* @link http://book.cakephp.org/view/491/Inflector
|
||||
*/
|
||||
class Inflector extends Object {
|
||||
/**
|
||||
* Pluralized words
|
||||
* Pluralized words.
|
||||
*
|
||||
* @var array
|
||||
* @access private
|
||||
**/
|
||||
var $pluralized = array();
|
||||
/**
|
||||
* All plural rules
|
||||
* List of pluralization rules in the form of pattern => replacement.
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
* @link http://book.cakephp.org/view/47/Custom-Inflections
|
||||
**/
|
||||
var $pluralRules = array();
|
||||
/**
|
||||
* Singularized words
|
||||
* Singularized words.
|
||||
*
|
||||
* @var array
|
||||
* @access private
|
||||
**/
|
||||
var $singularized = array();
|
||||
/**
|
||||
* All singular rules
|
||||
* List of singularization rules in the form of pattern => replacement.
|
||||
*
|
||||
* @var array
|
||||
* @access public
|
||||
* @link http://book.cakephp.org/view/47/Custom-Inflections
|
||||
**/
|
||||
var $singularRules = array();
|
||||
/**
|
||||
|
@ -140,7 +143,7 @@ class Inflector extends Object {
|
|||
return $instance[0];
|
||||
}
|
||||
/**
|
||||
* Initializes plural inflection rules
|
||||
* Initializes plural inflection rules.
|
||||
*
|
||||
* @return void
|
||||
* @access private
|
||||
|
@ -228,6 +231,7 @@ class Inflector extends Object {
|
|||
* @return string Word in plural
|
||||
* @access public
|
||||
* @static
|
||||
* @link http://book.cakephp.org/view/572/Class-methods
|
||||
*/
|
||||
function pluralize($word) {
|
||||
$_this =& Inflector::getInstance();
|
||||
|
@ -267,7 +271,7 @@ class Inflector extends Object {
|
|||
return $word;
|
||||
}
|
||||
/**
|
||||
* Initializes singular inflection rules
|
||||
* Initializes singular inflection rules.
|
||||
*
|
||||
* @return void
|
||||
* @access protected
|
||||
|
@ -364,6 +368,7 @@ class Inflector extends Object {
|
|||
* @return string Word in singular
|
||||
* @access public
|
||||
* @static
|
||||
* @link http://book.cakephp.org/view/572/Class-methods
|
||||
*/
|
||||
function singularize($word) {
|
||||
$_this =& Inflector::getInstance();
|
||||
|
@ -403,73 +408,79 @@ class Inflector extends Object {
|
|||
return $word;
|
||||
}
|
||||
/**
|
||||
* Returns given $lower_case_and_underscored_word as a CamelCased word.
|
||||
* Returns the given lower_case_and_underscored_word as a CamelCased word.
|
||||
*
|
||||
* @param string $lower_case_and_underscored_word Word to camelize
|
||||
* @return string Camelized word. LikeThis.
|
||||
* @access public
|
||||
* @static
|
||||
* @link http://book.cakephp.org/view/572/Class-methods
|
||||
*/
|
||||
function camelize($lowerCaseAndUnderscoredWord) {
|
||||
$replace = str_replace(" ", "", ucwords(str_replace("_", " ", $lowerCaseAndUnderscoredWord)));
|
||||
return $replace;
|
||||
}
|
||||
/**
|
||||
* Returns an underscore-syntaxed (like_this_dear_reader) version of the $camel_cased_word.
|
||||
* Returns the given camelCasedWord as an underscored_word.
|
||||
*
|
||||
* @param string $camelCasedWord Camel-cased word to be "underscorized"
|
||||
* @return string Underscore-syntaxed version of the $camelCasedWord
|
||||
* @access public
|
||||
* @static
|
||||
* @link http://book.cakephp.org/view/572/Class-methods
|
||||
*/
|
||||
function underscore($camelCasedWord) {
|
||||
$replace = strtolower(preg_replace('/(?<=\\w)([A-Z])/', '_\\1', $camelCasedWord));
|
||||
return $replace;
|
||||
}
|
||||
/**
|
||||
* Returns a human-readable string from $lower_case_and_underscored_word,
|
||||
* by replacing underscores with a space, and by upper-casing the initial characters.
|
||||
* Returns the given underscored_word_group as a Human Readable Word Group.
|
||||
* (Underscores are replaced by spaces and capitalized following words.)
|
||||
*
|
||||
* @param string $lower_case_and_underscored_word String to be made more readable
|
||||
* @return string Human-readable string
|
||||
* @access public
|
||||
* @static
|
||||
* @link http://book.cakephp.org/view/572/Class-methods
|
||||
*/
|
||||
function humanize($lowerCaseAndUnderscoredWord) {
|
||||
$replace = ucwords(str_replace("_", " ", $lowerCaseAndUnderscoredWord));
|
||||
return $replace;
|
||||
}
|
||||
/**
|
||||
* Returns corresponding table name for given $className. ("posts" for the model class "Post").
|
||||
* Returns corresponding table name for given model $className. ("people" for the model class "Person").
|
||||
*
|
||||
* @param string $className Name of class to get database table name for
|
||||
* @return string Name of the database table for given class
|
||||
* @access public
|
||||
* @static
|
||||
* @link http://book.cakephp.org/view/572/Class-methods
|
||||
*/
|
||||
function tableize($className) {
|
||||
$replace = Inflector::pluralize(Inflector::underscore($className));
|
||||
return $replace;
|
||||
}
|
||||
/**
|
||||
* Returns Cake model class name ("Post" for the database table "posts".) for given database table.
|
||||
* Returns Cake model class name ("Person" for the database table "people".) for given database table.
|
||||
*
|
||||
* @param string $tableName Name of database table to get class name for
|
||||
* @return string Class name
|
||||
* @access public
|
||||
* @static
|
||||
* @link http://book.cakephp.org/view/572/Class-methods
|
||||
*/
|
||||
function classify($tableName) {
|
||||
$replace = Inflector::camelize(Inflector::singularize($tableName));
|
||||
return $replace;
|
||||
}
|
||||
/**
|
||||
* Returns camelBacked version of a string.
|
||||
* Returns camelBacked version of an underscored string.
|
||||
*
|
||||
* @param string $string
|
||||
* @return string in variable form
|
||||
* @access public
|
||||
* @static
|
||||
* @link http://book.cakephp.org/view/572/Class-methods
|
||||
*/
|
||||
function variable($string) {
|
||||
$string = Inflector::camelize(Inflector::underscore($string));
|
||||
|
@ -478,13 +489,15 @@ class Inflector extends Object {
|
|||
return $variable;
|
||||
}
|
||||
/**
|
||||
* Returns a string with all spaces converted to $replacement and non word characters removed.
|
||||
* Returns a string with all spaces converted to underscores (by default), accented
|
||||
* characters converted to non-accented characters, and non word characters removed.
|
||||
*
|
||||
* @param string $string
|
||||
* @param string $replacement
|
||||
* @return string
|
||||
* @access public
|
||||
* @static
|
||||
* @link http://book.cakephp.org/view/572/Class-methods
|
||||
*/
|
||||
function slug($string, $replacement = '_') {
|
||||
if (!class_exists('String')) {
|
||||
|
|
Loading…
Reference in a new issue