ConsoleKit\Utils::camelize PHP Method

camelize() public static method

Returns a dash-cased string into a camelCased string
public static camelize ( string $string ) : string
$string string
return string
    public static function camelize($string)
    {
        return lcfirst(str_replace(' ', '', ucwords(str_replace('-', ' ', $string))));
    }

Usage Example

Esempio n. 1
0
 /**
  * If not overriden, will execute the command specified
  * as the first argument
  * 
  * Commands must be defined as methods named after the
  * command, prefixed with execute (eg. create -> executeCreate)
  * 
  * @param array $args
  * @param array $options
  */
 public function execute(array $args, array $options = array())
 {
     if (!count($args)) {
         throw new ConsoleException("Missing subcommand name");
     }
     $command = ucfirst(Utils::camelize(array_shift($args)));
     $methodName = "execute{$command}";
     if (!method_exists($this, $methodName)) {
         throw new ConsoleException("Command '{$command}' does not exist");
     }
     $method = new ReflectionMethod($this, $methodName);
     $params = Utils::computeFuncParams($method, $args, $options);
     return $method->invokeArgs($this, $params);
 }
All Usage Examples Of ConsoleKit\Utils::camelize