Esempio n. 1
0
 /**
  * Set the controller as Route Controller
  * Cygnite Router knows how to respond to routes controller
  * request automatically
  * @param $controller
  * @return $this
  */
 public function routeController($controller)
 {
     $actions = $this->getActions();
     foreach ($actions as $key => $action) {
         $method = ucfirst(Inflector::pathAction($action));
         if (method_exists($this, 'set' . $method . 'Route')) {
             $this->{'set' . $method . 'Route'}(Inflector::deCamelize($controller), $action);
         }
     }
     return $this;
 }
Esempio n. 2
0
 public function getPlainUri($name, $prefix)
 {
     return $prefix . '/' . implode('-', array_slice(explode('_', Inflector::deCamelize($name)), 1));
 }
Esempio n. 3
0
 /**
  * Replace the controller name with original name.
  *
  * @param $content
  *
  * @return mixed
  */
 private function replaceControllerName($content)
 {
     $content = str_replace('{%ControllerClassName%}', $this->controller, $content);
     $content = str_replace('%ControllerName%', $this->controller, $content);
     $content = str_replace('%controllerName%', Inflector::deCamelize($this->controller), $content);
     return $content;
 }
Esempio n. 4
0
 public function testDeCamelizeMethod()
 {
     $this->assertEquals('foo_bar_baz', Inflector::deCamelize('fooBarBaz'));
 }
Esempio n. 5
0
 private function __construct($command = null)
 {
     $this->command = $command;
     $this->controller = Inflector::deCamelize(str_replace('Controller', '', $command->controller));
 }