Example #1
0
 public function testCamelize()
 {
     $tests = array('foo' => 'Foo', 'foo_bar' => 'FooBar', 'foo__bar' => 'Foo_bar');
     foreach ($tests as $input => $expected) {
         $this->assertEquals($expected, Str::camelize($input));
     }
 }
Example #2
0
 protected function request($url, $default_controller, $default_action)
 {
     $tmp = array_filter(explode('/', $url), function ($str) {
         return $str !== '';
     });
     $name = is_array($tmp) && count($tmp) ? array_shift($tmp) : $default_controller;
     $action = is_array($tmp) && count($tmp) ? array_shift($tmp) : $default_action;
     $params = is_array($tmp) && count($tmp) ? $tmp : array();
     $name = Str::camelize($name);
     $class = 'App\\' . APP . '\\Controller\\' . $name . 'Controller';
     $path = DIR_CONTROLLERS . "/{$name}Controller.php";
     return array('url' => $url, 'name' => $name, 'class' => $class, 'path' => $path, 'action' => strtolower($action), 'params' => $params);
 }
Example #3
0
 /**
  * Converts from underscored to camel case, i.e. foo_bar_baz -> FooBarBaz
  * Inspired by Symfony
  *
  * @return StrObject
  */
 public function camelize()
 {
     $value = Str::camelize($this->value);
     return new self($value);
 }