lithium\util\Inflector::humanize PHP Method

humanize() public static method

Takes an under_scored version of a word and turns it into an human- readable form by replacing underscores with a space, and by upper casing the initial character.
public static humanize ( string $word, string $separator = '_' ) : string
$word string Under_scored version of a word (i.e. `'red_bike'`).
$separator string The separator character used in the initial string.
return string Human readable version of the word (i.e. `'Red Bike'`).
    public static function humanize($word, $separator = '_')
    {
        if (isset(static::$_humanized[$key = $word . ':' . $separator])) {
            return static::$_humanized[$key];
        }
        return static::$_humanized[$key] = ucwords(str_replace($separator, " ", $word));
    }

Usage Example

 public function testIndexScaffold()
 {
     $this->_controller->index();
     $scaffold = $this->_controller->access('scaffold');
     $expected = array('base' => '/radium/configurations', 'controller' => 'Configurations', 'library' => 'radium', 'class' => 'MockConfigurations', 'model' => 'radium\\tests\\mocks\\data\\MockConfigurations', 'slug' => Inflector::underscore('MockConfigurations'), 'singular' => Inflector::singularize('MockConfigurations'), 'plural' => Inflector::pluralize('MockConfigurations'), 'table' => Inflector::tableize('MockConfigurations'), 'human' => Inflector::humanize('MockConfigurations'));
     $this->assertEqual($expected, $scaffold);
 }
All Usage Examples Of lithium\util\Inflector::humanize