Class SGL_Inflector

Description

Performs transformations on resource names, ie, urls, classes, methods, variables.

Located in /SGL/Inflector.php (line 46)


	
			
Method Summary
 static mixed caseFix (string $str, [boolean $force = false])
 static string getManagerNameFromSimplifiedName (string $name)
 static string getSimplifiedNameFromManagerName (string $name)
 string camelise (string $s)
 string camelise2 (string $lowerCaseAndUnderscoredWord)
 void getTitleFromCamelCase ( $camelCaseWord)
 string humanise ( $lowerCaseAndUnderscoredWord, string $lower_case_and_underscored_word)
 void isCamelCase ( $str)
 void isConstant ( $str)
 boolean isMgrNameOmitted (array $aParsedUri)
 boolean isUrlSimplified (string $querystring, string $sectionName)
 void underscore ( $camelCasedWord)
 boolean urlContainsDuplicates (string $url)
 void variable ( $string)
Methods
static caseFix (line 288)

Makes up for case insensitive classnames in php4 with get_class().

  • return: Either correct case classname or original classname if no key found
  • access: public
mixed caseFix (string $str, [boolean $force = false])
  • string $str: Classname
  • boolean $force: Force the operation regardless of php version
static getManagerNameFromSimplifiedName (line 140)

Returns the full Manager name given the short name, ie, faq becomes FaqMgr.

string getManagerNameFromSimplifiedName (string $name)
  • string $name
static getSimplifiedNameFromManagerName (line 156)

Returns the short name given the full Manager name, ie FaqMgr becomes faq.

string getSimplifiedNameFromManagerName (string $name)
  • string $name
camelise (line 179)

Converts "string with spaces" to "camelCase" string.

string camelise (string $s)
  • string $s
camelise2 (line 204)

accepts strings with underscores

string camelise2 (string $lowerCaseAndUnderscoredWord)
  • string $lowerCaseAndUnderscoredWord
getTitleFromCamelCase (line 209)
void getTitleFromCamelCase ( $camelCaseWord)
  • $camelCaseWord
humanise (line 273)

Returns a human-readable string from $lower_case_and_underscored_word, by replacing underscores with a space, and by upper-casing the initial characters.

  • return: Human-readable string
string humanise ( $lowerCaseAndUnderscoredWord, string $lower_case_and_underscored_word)
  • string $lower_case_and_underscored_word: String to be made more readable
  • $lowerCaseAndUnderscoredWord
isCamelCase (line 237)
void isCamelCase ( $str)
  • $str
isConstant (line 251)
void isConstant ( $str)
  • $str
isMgrNameOmitted (line 109)

Determine if a simplified notation is being used.

If the url was of the form example.com/index.php/contactus/contactus/ and it got simplifeid too example.com/index.php/contactus/ it is important to determine if that simplification happened, so subsequent parameters don't get interpreted as 'managerName'

boolean isMgrNameOmitted (array $aParsedUri)
  • array $aParsedUri
isUrlSimplified (line 61)

Returns true if querystring has been simplified.

This happens when a manager name is the same as its module name, ie UserManger in the 'user' module would become user/user which gets reduced to user

$querystring does not include the frontScriptName, ie, index.php

boolean isUrlSimplified (string $querystring, string $sectionName)
  • string $querystring: From the querystring fragment onwards, ie /user/account/userid/2/
  • string $sectionName: From the database
underscore (line 232)
void underscore ( $camelCasedWord)
  • $camelCasedWord
urlContainsDuplicates (line 85)

Returns true if manager name is the same of module name, ie, index.php/faq/faq/.

boolean urlContainsDuplicates (string $url)
  • string $url
variable (line 224)
void variable ( $string)
  • $string

Documentation generated on Tue, 23 Feb 2010 18:14:30 +0000 by phpDocumentor 1.4.3