Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • ActiveRecord
  • Cache
  • Configs
  • Core
  • DateTime
  • Debug
  • DeleteOperation
  • Errors
  • Event
  • EventHook
  • Events
  • FileCache
  • FormattedString
  • Helpers
  • I18n
  • Image
  • Inflections
  • Inflector
  • Models
  • Module
  • Modules
  • Object
  • Operation
  • PingOperation
  • Prototype
  • Route
  • Routes
  • SaveOperation
  • Session
  • TimeZone
  • TimeZoneLocation
  • Uploaded
  • Vars
  • VarsIterator

Interfaces

  • StorageInterface
  • ToArray
  • ToArrayRecursive

Traits

  • PrototypeTrait
  • ToArrayRecursiveTrait

Exceptions

  • AlreadyAuthenticated
  • AuthenticationRequired
  • Exception
  • ModuleConstructorMissing
  • ModuleIsDisabled
  • ModuleNotDefined
  • OffsetError
  • OffsetNotDefined
  • OffsetNotReadable
  • OffsetNotWritable
  • PermissionRequired
  • PropertyError
  • PropertyIsReserved
  • PropertyNotDefined
  • PropertyNotReadable
  • PropertyNotWritable
  • RouteNotDefined
  • SecurityException

Constants

  • TOKEN_ALPHA
  • TOKEN_ALPHA_UPCASE
  • TOKEN_NUMERIC
  • TOKEN_SYMBOL
  • TOKEN_SYMBOL_WIDE

Functions

  • array_flatten
  • array_insert
  • array_merge_recursive
  • camelize
  • capitalize
  • downcase
  • dump
  • escape
  • escape_all
  • exact_array_merge_recursive
  • excerpt
  • format
  • generate_token
  • generate_token_wide
  • generate_v4_uuid
  • get_autoconfig
  • humanize
  • hyphenate
  • log
  • log_error
  • log_info
  • log_success
  • log_time
  • normalize
  • normalize_namespace_part
  • normalize_url_path
  • pbkdf2
  • pluralize
  • remove_accents
  • shorten
  • singularize
  • sort_by_weight
  • stable_sort
  • strip_root
  • titleize
  • unaccent_compare
  • unaccent_compare_ci
  • underscore
  • upcase

Class Inflector

The Inflector transforms words from singular to plural, class names to table names, modularized class names to ones without, and class names to foreign keys. Inflections can be localized, the default english inflections for pluralization, singularization, and uncountable words are kept in lib/inflections/en.php.

Namespace: ICanBoogie
Located at vendor/icanboogie/inflector/lib/inflector.php

Methods summary

public static ICanBoogie\Inflector
# get( string $locale = 'en' )

Returns an inflector for the specified locale.

Returns an inflector for the specified locale.

Note: Inflectors are shared for the same locale. If you need to alter an inflector you MUST clone it first.

Parameters

$locale
string
$locale

Returns

ICanBoogie\Inflector
protected
# __construct( ICanBoogie\Inflections $inflections = null )

Initializes the ICanBoogie\Inflector::$inflections property.

Initializes the ICanBoogie\Inflector::$inflections property.

Parameters

$inflections
ICanBoogie\Inflections
$inflections
public
# __get( string $property )

Returns the ICanBoogie\Inflector::$inflections property.

Returns the ICanBoogie\Inflector::$inflections property.

Parameters

$property
string
$property

Throws

ICanBoogie\PropertyNotDefined
in attempt to read an unaccessible property. If the ICanBoogie\PropertyNotDefined class is not available a InvalidArgumentException is thrown instead.
public
# __clone( )

Clone inflections.

Clone inflections.

public string
# pluralize( string $word )

Returns the plural form of the word in the string.

Returns the plural form of the word in the string.

$this->pluralize('post');       // "posts"
$this->pluralize('children');   // "child"
$this->pluralize('sheep');      // "sheep"
$this->pluralize('words');      // "words"
$this->pluralize('CamelChild'); // "CamelChild"

Parameters

$word
string
$word

Returns

string
public string
# singularize( string $word )

The reverse of ICanBoogie\pluralize(), returns the singular form of a word in a string.

The reverse of ICanBoogie\pluralize(), returns the singular form of a word in a string.

$this->singularize('posts');         // "post"
$this->singularize('childred');      // "child"
$this->singularize('sheep');         // "sheep"
$this->singularize('word');          // "word"
$this->singularize('CamelChildren'); // "CamelChild"

Parameters

$word
string
$word

Returns

string
public string
# camelize( string $term, boolean $downcase_first_letter = false )

By default, ICanBoogie\camelize() converts strings to UpperCamelCase.

By default, ICanBoogie\camelize() converts strings to UpperCamelCase.

ICanBoogie\camelize() will also convert "/" to "\" which is useful for converting paths to namespaces.

$this->camelize('active_model');                // 'ActiveModel'
$this->camelize('active_model', true);          // 'activeModel'
$this->camelize('active_model/errors');         // 'ActiveModel\Errors'
$this->camelize('active_model/errors', true);   // 'activeModel\Errors'

As a rule of thumb you can think of ICanBoogie\camelize() as the inverse of ICanBoogie\underscore(), though there are cases where that does not hold:

$this->camelize($this->underscore('SSLError')); // "SslError"

Parameters

$term
string
$term
$downcase_first_letter
boolean
$downcase_first_letter If false then ICanBoogie\camelize() produces lowerCamelCase.

Returns

string
public string
# underscore( string $camel_cased_word )

Makes an underscored, lowercase form from the expression in the string.

Makes an underscored, lowercase form from the expression in the string.

Changes "\" to "/" to convert namespaces to paths.

$this->underscore('ActiveModel');        // 'active_model'
$this->underscore('ActiveModel\Errors'); // 'active_model/errors'

As a rule of thumb you can think of ICanBoogie\underscore() as the inverse of ICanBoogie\camelize(), though there are cases where that does not hold:

$this->camelize($this->underscore('SSLError')); // "SslError"

Parameters

$camel_cased_word
string
$camel_cased_word

Returns

string
public string
# humanize( string $lower_case_and_underscored_word )

Capitalizes the first word and turns underscores into spaces and strips a trailing "_id", if any. Like ICanBoogie\titleize(), this is meant for creating pretty output.

Capitalizes the first word and turns underscores into spaces and strips a trailing "_id", if any. Like ICanBoogie\titleize(), this is meant for creating pretty output.

$this->humanize('employee_salary'); // "Employee salary"
$this->humanize('author_id');       // "Author"

Parameters

$lower_case_and_underscored_word
string
$lower_case_and_underscored_word

Returns

string
public string
# titleize( string $str )

Capitalizes all the words and replaces some characters in the string to create a nicer looking title. ICanBoogie\titleize() is meant for creating pretty output. It is not used in the Rails internals.

Capitalizes all the words and replaces some characters in the string to create a nicer looking title. ICanBoogie\titleize() is meant for creating pretty output. It is not used in the Rails internals.

$this->titleize('man from the boondocks');  // "Man From The Boondocks"
$this->titleize('x-men: the last stand');   // "X Men: The Last Stand"
$this->titleize('TheManWithoutAPast');      // "The Man Without A Past"
$this->titleize('raiders_of_the_lost_ark'); // "Raiders Of The Lost Ark"

Parameters

$str
string
$str

Returns

string
public string
# dasherize( string $underscored_word )

Replaces underscores with dashes in the string.

Replaces underscores with dashes in the string.

$this->dasherize('puni_puni'); // "puni-puni"

Parameters

$underscored_word
string
$underscored_word

Returns

string
public string
# hyphenate( string $str )

Makes an hyphenated, lowercase form from the expression in the string.

Makes an hyphenated, lowercase form from the expression in the string.

This is a combination of ICanBoogie\underscore() and ICanBoogie\Inflector::dasherize().

Parameters

$str
string
$str

Returns

string
public
# ordinal( mixed $number )

Returns the suffix that should be added to a number to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.

Returns the suffix that should be added to a number to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.

$this->ordinal(1);     // "st"
$this->ordinal(2);     // "nd"
$this->ordinal(1002);  // "nd"
$this->ordinal(1003);  // "rd"
$this->ordinal(-11);   // "th"
$this->ordinal(-1021); // "st"
public
# ordinalize( mixed $number )

Turns a number into an ordinal string used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.

Turns a number into an ordinal string used to denote the position in an ordered sequence such as 1st, 2nd, 3rd, 4th.

$this->ordinalize(1);     // "1st"
$this->ordinalize(2);     // "2nd"
$this->ordinalize(1002);  // "1002nd"
$this->ordinalize(1003);  // "1003rd"
$this->ordinalize(-11);   // "-11th"
$this->ordinalize(-1021); // "-1021st"

Magic methods summary

Properties summary

protected ICanBoogie\Inflections $inflections
#

Inflections used by the inflector.

Inflections used by the inflector.

Magic properties

public read-only ICanBoogie\Inflections $inflections
#

Inflections used by the inflector.

Inflections used by the inflector.

Autodoc API documentation generated by ApiGen 2.8.0