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)); } }
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); }
/** * 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); }