lithium\util\Inflector::underscore PHP Method

underscore() public static method

Takes a CamelCased version of a word and turns it into an under_scored one.
public static underscore ( string $word ) : string
$word string CamelCased version of a word (i.e. `'RedBike'`).
return string Under_scored version of the workd (i.e. `'red_bike'`).
    public static function underscore($word)
    {
        if (isset(static::$_underscored[$word])) {
            return static::$_underscored[$word];
        }
        return static::$_underscored[$word] = strtolower(static::slug($word, '_'));
    }

Usage Example

Ejemplo n.º 1
0
 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::underscore