camelize() public static method

Takes a under_scored word and turns it into a CamelCased or camelBack word
public static camelize ( string $word, boolean $cased = true ) : string
$word string An under_scored or slugged word (i.e. `'red_bike'` or `'red-bike'`).
$cased boolean If false, first character is not upper cased
return string CamelCased version of the word (i.e. `'RedBike'`).
Exemplo n.º 1
0
 public function describe($entity, array $meta = array())
 {
     $var = "_" . Inflector::camelize($entity, false);
     if ($this->{$var}) {
         return $this->{$var};
     }
     return array();
 }
Exemplo n.º 2
0
 /**
  * undocumented function
  *
  * @return void
  */
 protected function _init()
 {
     $class = Inflector::camelize($this->_config['reporter']);
     if (!($reporter = Libraries::locate('test.reporter', $class))) {
         throw new Exception("{$class} is not a valid reporter");
     }
     $this->reporter = new $reporter();
     $this->group = $this->_config['group'];
     $this->filters = $this->_config['filters'];
     $this->title = $this->_config['title'] ?: $this->_config['title'];
 }
Exemplo n.º 3
0
 /**
  * Auto run the help command.
  *
  * @param string $command Name of the command to return help about.
  * @return boolean
  */
 public function run($command = null)
 {
     $message = 'Lithium console started in the ' . Environment::get() . ' environment.';
     $message .= ' Use the --env=environment key to alter this.';
     $this->out($message);
     if (!$command) {
         $this->_renderCommands();
         return true;
     }
     if (!preg_match('/\\\\/', $command)) {
         $command = Inflector::camelize($command);
     }
     if (!($class = Libraries::locate('command', $command))) {
         $this->error("Command `{$command}` not found");
         return false;
     }
     if (strpos($command, '\\') !== false) {
         $command = join('', array_slice(explode("\\", $command), -1));
     }
     $command = strtolower(Inflector::slug($command));
     $run = null;
     $methods = $this->_methods($class);
     $properties = $this->_properties($class);
     $info = Inspector::info($class);
     $this->out('USAGE', 'heading');
     if (isset($methods['run'])) {
         $run = $methods['run'];
         unset($methods['run']);
         $this->_renderUsage($command, $run, $properties);
     }
     foreach ($methods as $method) {
         $this->_renderUsage($command, $method);
     }
     if (!empty($info['description'])) {
         $this->nl();
         $this->_renderDescription($info);
         $this->nl();
     }
     if ($properties || $methods) {
         $this->out('OPTIONS', 'heading');
     }
     if ($run) {
         $this->_render($run['args']);
     }
     if ($methods) {
         $this->_render($methods);
     }
     if ($properties) {
         $this->_render($properties);
     }
     return true;
 }
 public function apply($testable, array $config = array())
 {
     $tokens = $testable->tokens();
     $filtered = $testable->findAll(array(T_VARIABLE));
     foreach ($filtered as $id) {
         $token = $tokens[$id];
         $isntSuperGlobal = !isset($this->_superglobals[$token['content']]);
         if ($isntSuperGlobal) {
             $name = preg_replace('/(\\$_?|_+$)/', '', $token['content']);
             if ($name !== Inflector::camelize($name, false)) {
                 $this->addViolation(array('message' => "Variable {$name} is not camelBack style", 'line' => $token['line']));
             }
         }
     }
 }
 /**
  * Will iterate the tokens looking for a T_CLASS which should be
  * in CamelCase and match the file name
  *
  * @param  Testable $testable The testable object
  * @return void
  */
 public function apply($testable, array $config = array())
 {
     $tokens = $testable->tokens();
     $pathinfo = pathinfo($testable->config('path'));
     if ($pathinfo['extension'] !== 'php') {
         return;
     }
     $filtered = $testable->findAll(array(T_CLASS));
     foreach ($filtered as $key) {
         $token = $tokens[$key];
         $className = $tokens[$key + 2]['content'];
         if ($className !== Inflector::camelize($className)) {
             $this->addViolation(array('message' => 'Class name is not in CamelCase style', 'line' => $token['line']));
         } elseif ($className !== $pathinfo['filename']) {
             $this->addViolation(array('message' => 'Class name and file name should match', 'line' => $token['line']));
         }
     }
 }
 /**
  * Will iterate the tokens looking for functions validating they have the
  * correct camelBack naming style.
  *
  * @param  Testable $testable The testable object
  * @return void
  */
 public function apply($testable, array $config = array())
 {
     $tokens = $testable->tokens();
     $filtered = $testable->findAll(array(T_FUNCTION));
     foreach ($filtered as $key) {
         $token = $tokens[$key];
         $label = Parser::label($key, $tokens);
         $modifiers = Parser::modifiers($key, $tokens);
         $isClosure = Parser::closure($key, $tokens);
         if (in_array($label, $this->_magicMethods)) {
             continue;
         }
         if ($testable->findNext(array(T_PROTECTED), $modifiers) !== false) {
             $label = preg_replace('/^_/', '', $label);
         }
         if (!$isClosure && $label !== Inflector::camelize($label, false)) {
             $this->addViolation(array('message' => 'Function "' . $label . '" is not in camelBack style', 'line' => $tokens[$tokens[$key]['parent']]['line']));
         }
     }
 }
Exemplo n.º 7
0
 /**
  * Get an instance of a sub-command
  *
  * @param string $name the name of the sub-command to instantiate
  * @param array $config
  * @return object;
  */
 protected function _instance($name, array $config = array())
 {
     if ($class = Libraries::locate('command.create', Inflector::camelize($name))) {
         $this->request->params['template'] = $this->template;
         return new $class(array('request' => $this->request, 'classes' => $this->_classes));
     }
     return parent::_instance($name, $config);
 }
Exemplo n.º 8
0
 /**
  * Returns the field name of a relation name (camelBack).
  *
  * @param string The type of the relation.
  * @param string The name of the relation.
  * @return string
  */
 public function relationFieldName($type, $name)
 {
     $fieldName = Inflector::camelize($name, false);
     if (preg_match('/Many$/', $type)) {
         $fieldName = Inflector::pluralize($fieldName);
     } else {
         $fieldName = Inflector::singularize($fieldName);
     }
     return $fieldName;
 }
Exemplo n.º 9
0
<?php
/**
 * li3_flash_message plugin for Lithium: the most rad php framework.
 *
 * @copyright     Copyright 2010, Michael Hüneburg
 * @license       http://opensource.org/licenses/bsd-license.php The BSD License
 */
$class = (!empty($class)) ? $class : null;
$class = \lithium\util\Inflector::camelize($class);
?>
<div class="message<?= $class;  ?>">
	<?= $message; ?>
</div>
Exemplo n.º 10
0
	/**
	 *  requestAction() is a shortcut method to pulling back return data from any controller's method.
	 *  Normally, you'd have to manually instantiate the class, call the method, and pass arguments...
	 *  Which really isn't a big deal, but this is a convience to that. It also let's you pass a conveient library option.
	 *
	 *  @param $options array[required] This is your basic controller/action url in array format, you can also pass 'library'
	 *  @return Mixed data from the controller's method to use in your view template
	*/
	public function requestAction($options=array()) {
		$defaults = array('library' => null, 'args' => null);
		$options += $defaults;
		
		if((!isset($options['controller'])) || (!isset($options['action']))) {
			return false;
		}
		
		$controller_name = Inflector::camelize($options['controller']);
		if(empty($options['library'])) {
			$class = '\minerva\controllers\\'.$controller_name.'Controller';
		} else {
			$class = '\minerva\libraries\\'.$options['library'].'\controllers\\'.$controller_name.'Controller'; 			
		}
		$controller = new $class();		
		
		return $controller->{$options['action']}($options['args']);		
	}
Exemplo n.º 11
0
 /**
  * Determines Command to use for current request. If
  *
  * @param string $request
  * @param string $params
  * @param string $options
  * @return class \lithium\console\COmmand
  */
 protected static function _callable($request, $params, $options)
 {
     $params = compact('request', 'params', 'options');
     return static::_filter(__FUNCTION__, $params, function ($self, $params, $chain) {
         extract($params, EXTR_OVERWRITE);
         $name = $class = $params['command'];
         if (!$name) {
             $request->params['args'][0] = $name;
             $name = $class = '\\lithium\\console\\command\\Help';
         }
         if ($class[0] !== '\\') {
             $name = Inflector::camelize($class);
             $class = Libraries::locate('command', $name);
         }
         if (class_exists($class)) {
             return new $class(compact('request'));
         }
         throw new UnexpectedValueException("Command `{$name}` not found");
     });
 }
Exemplo n.º 12
0
 public function testConfigManipulation()
 {
     $config = MockDispatcher::config();
     $expected = array('rules' => array());
     $this->assertEqual($expected, $config);
     MockDispatcher::config(array('rules' => array('admin' => array('action' => 'admin_{:action}'))));
     Router::connect('/', array('controller' => 'test', 'action' => 'test', 'admin' => true));
     MockDispatcher::run(new Request(array('url' => '/')));
     $result = end(MockDispatcher::$dispatched);
     $expected = array('action' => 'admin_test', 'controller' => 'Test', 'admin' => true);
     $this->assertEqual($expected, $result->params);
     MockDispatcher::config(array('rules' => array('action' => array('action' => function ($params) {
         return Inflector::camelize(strtolower($params['action']), false);
     }))));
     MockDispatcher::$dispatched = array();
     Router::reset();
     Router::connect('/', array('controller' => 'test', 'action' => 'TeST-camelize'));
     MockDispatcher::run(new Request(array('url' => '/')));
     $result = end(MockDispatcher::$dispatched);
     $expected = array('action' => 'testCamelize', 'controller' => 'Test');
     $this->assertEqual($expected, $result->params);
     MockDispatcher::config(array('rules' => function ($params) {
         if (isset($params['admin'])) {
             return array('special' => array('action' => 'special_{:action}'));
         }
         return array();
     }));
     MockDispatcher::$dispatched = array();
     Router::reset();
     Router::connect('/', array('controller' => 'test', 'action' => 'test', 'admin' => true));
     Router::connect('/special', array('controller' => 'test', 'action' => 'test', 'admin' => true, 'special' => true));
     MockDispatcher::run(new Request(array('url' => '/')));
     $result = end(MockDispatcher::$dispatched);
     $expected = array('action' => 'test', 'controller' => 'Test', 'admin' => true);
     $this->assertEqual($expected, $result->params);
     MockDispatcher::run(new Request(array('url' => '/special')));
     $result = end(MockDispatcher::$dispatched);
     $expected = array('action' => 'special_test', 'controller' => 'Test', 'admin' => true, 'special' => true);
     $this->assertEqual($expected, $result->params);
 }
Exemplo n.º 13
0
 /**
  * Get the class name for the migration.
  *
  * @param string $request
  * @return string
  */
 protected function _class($request)
 {
     return Inflector::camelize($request->action);
 }
Exemplo n.º 14
0
 /**
  * Get record data as an array
  *
  * @param bool $allProperties If true, get also properties without getter methods
  * @return array Data
  */
 protected function _getData($allProperties = false)
 {
     $data = array();
     foreach ($this->_getEntityFields() as $field) {
         $method = 'get' . Inflector::camelize($field);
         if (method_exists($this, $method) && is_callable(array($this, $method))) {
             $data[$field] = $this->{$method}();
         } elseif ($allProperties && property_exists($this, $field)) {
             $data[$field] = $this->{$field};
         }
     }
     if (isset($name)) {
         return array_key_exists($name, $data) ? $data[$name] : null;
     }
     return $data;
 }
Exemplo n.º 15
0
 /**
  * Attempts to apply a set of formatting rules from `$_rules` to a `$params` array, where each
  * formatting rule is applied if the key of the rule in `$_rules` is present and not empty in
  * `$params`.  Also performs sanity checking against `$params` to ensure that no value
  * matching a rule is present unless the rule check passes.
  *
  * @param array $params An array of route parameters to which rules will be applied.
  * @return array Returns the `$params` array with formatting rules applied to array values.
  */
 public static function applyRules(&$params)
 {
     $values = array();
     $rules = static::$_rules;
     if (!$params) {
         return false;
     }
     if (isset($params['controller']) && is_string($params['controller'])) {
         $controller = $params['controller'];
         if (strpos($controller, '.') !== false) {
             list($library, $controller) = explode('.', $controller);
             $controller = $library . '.' . Inflector::camelize($controller);
             $params += compact('library');
         } elseif (strpos($controller, '\\') === false) {
             $controller = Inflector::camelize($controller);
             if (isset($params['library'])) {
                 $controller = "{$params['library']}.{$controller}";
             }
         }
         $values = compact('controller');
     }
     $values += $params;
     if (is_callable($rules)) {
         $rules = $rules($params);
     }
     foreach ($rules as $rule => $value) {
         if (!isset($values[$rule])) {
             continue;
         }
         foreach ($value as $k => $v) {
             if (is_callable($v)) {
                 $values[$k] = $v($values);
                 continue;
             }
             $match = preg_replace('/\\{:\\w+\\}/', '@', $v);
             $match = preg_replace('/@/', '.+', preg_quote($match, '/'));
             if (preg_match('/' . $match . '/i', $values[$k])) {
                 continue;
             }
             $values[$k] = String::insert($v, $values);
         }
     }
     return $values;
 }
Exemplo n.º 16
0
 protected static function _parseController(array $params)
 {
     if (!isset($params['controller'])) {
         return $params;
     }
     if (strpos($params['controller'], '.')) {
         $separated = explode('.', $params['controller'], 2);
         list($params['library'], $params['controller']) = $separated;
     }
     if (strpos($params['controller'], '\\') === false) {
         $params['controller'] = Inflector::camelize($params['controller']);
     }
     return $params;
 }
Exemplo n.º 17
0
 public function __construct(array $config = array())
 {
     $self =& $this;
     $defaults = array('base' => array(), 'text' => array(), 'textarea' => array(), 'select' => array('multiple' => false), 'attributes' => array('id' => function ($method, $name, $options) use(&$self) {
         if (in_array($method, array('create', 'end', 'label', 'error'))) {
             return;
         }
         if (!$name || $method == 'hidden' && $name == '_method') {
             return;
         }
         $id = Inflector::camelize(Inflector::slug($name));
         $model = ($binding = $self->binding()) ? $binding->model() : null;
         return $model ? basename(str_replace('\\', '/', $model)) . $id : $id;
     }, 'name' => function ($method, $name, $options) {
         if (!strpos($name, '.')) {
             return $name;
         }
         $name = explode('.', $name);
         $first = array_shift($name);
         return $first . '[' . join('][', $name) . ']';
     }));
     parent::__construct(Set::merge($defaults, $config));
 }
Exemplo n.º 18
0
 /**
  * Accepts parameters generated by the `Router` class in `Dispatcher::run()`, and produces a
  * callable controller object. By default, this method uses the `'controller'` path lookup
  * configuration in `Libraries::locate()` to return a callable object.
  *
  * @param object $request The instance of the `Request` class either passed into or generated by
  *               `Dispatcher::run()`.
  * @param array $params The parameter array generated by routing the request.
  * @param array $options Not currently implemented.
  * @return object Returns a callable object which the request will be routed to.
  */
 protected static function _callable($request, $params, $options)
 {
     $params = compact('request', 'params', 'options');
     return static::_filter(__FUNCTION__, $params, function ($self, $params, $chain) {
         extract($params, EXTR_OVERWRITE);
         $library = '';
         if (strpos($params['controller'], '.')) {
             list($library, $params['controller']) = explode('.', $params['controller']);
             $library .= '.';
         }
         $controller = $library . Inflector::camelize($params['controller']);
         $class = Libraries::locate('controllers', $controller);
         if (class_exists($class)) {
             return new $class(compact('request'));
         }
         throw new Exception("Controller {$controller} not found");
     });
 }
Exemplo n.º 19
0
 /**
  * Tests the storage mechanism for `$_underscored`, `$_camelized`,
  *  `$_humanized` and `$_pluralized`.
  *
  * @return void
  */
 public function testStorageMechanism()
 {
     Inflector::reset();
     $expected = array('TestField' => 'test_field');
     $this->assertFalse($this->getProtectedValue('$_underscored'));
     $this->assertEqual(Inflector::underscore('TestField'), 'test_field');
     $this->assertEqual($expected, $this->getProtectedValue('$_underscored'));
     $this->assertEqual(Inflector::underscore('TestField'), 'test_field');
     $expected = array('test_field' => 'TestField');
     $this->assertFalse($this->getProtectedValue('$_camelized'));
     $this->assertEqual(Inflector::camelize('test_field', true), 'TestField');
     $this->assertEqual($expected, $this->getProtectedValue('$_camelized'));
     $this->assertEqual(Inflector::camelize('test_field', true), 'TestField');
     $expected = array('test_field:_' => 'Test Field');
     $this->assertFalse($this->getProtectedValue('$_humanized'));
     $this->assertEqual(Inflector::humanize('test_field'), 'Test Field');
     $this->assertEqual($expected, $this->getProtectedValue('$_humanized'));
     $this->assertEqual(Inflector::humanize('test_field'), 'Test Field');
     $expected = array('field' => 'fields');
     $this->assertFalse($this->getProtectedValue('$_pluralized'));
     $this->assertEqual(Inflector::pluralize('field'), 'fields');
     $this->assertEqual($expected, $this->getProtectedValue('$_pluralized'));
     $this->assertEqual(Inflector::pluralize('field'), 'fields');
 }
Exemplo n.º 20
0
 public function testRunWithGenericActionRule()
 {
     MockDispatcher::config(array('rules' => array('action' => array('action' => function ($params) {
         return Inflector::camelize(strtolower($params['action']), false);
     }))));
     Router::connect('/', array('controller' => 'test', 'action' => 'TeST-camelize'));
     MockDispatcher::run(new Request(array('url' => '/')));
     $result = end(MockDispatcher::$dispatched);
     $expected = array('action' => 'testCamelize', 'controller' => 'Test');
     $this->assertEqual($expected, $result->params);
 }
Exemplo n.º 21
0
 /**
  * testVariableNaming method
  *
  * @return void
  */
 public function testVariableNaming()
 {
     $this->assertEqual(Inflector::camelize('test_field', false), 'testField');
     $this->assertEqual(Inflector::camelize('test_fieLd', false), 'testFieLd');
     $this->assertEqual(Inflector::camelize('test field', false), 'testField');
     $this->assertEqual(Inflector::camelize('Test_field', false), 'testField');
 }
Exemplo n.º 22
0
 public function describe($entity, $schema = array(), array $meta = array())
 {
     $source = '_' . Inflector::camelize($entity, false);
     $fields = isset($this->{$source}) ? $this->{$source} : array();
     return $this->_instance('schema', compact('fields'));
 }
Exemplo n.º 23
0
 public function __construct(array $config = array())
 {
     $self =& $this;
     $defaults = array('base' => array(), 'text' => array(), 'textarea' => array(), 'select' => array('multiple' => false), 'attributes' => array('id' => function ($method, $name, $options) use(&$self) {
         if (in_array($method, array('create', 'end', 'label', 'error'))) {
             return;
         }
         if (!$name || $method === 'hidden' && $name === '_method') {
             return;
         }
         $info = $self->binding($name);
         $model = $info->class;
         $id = Inflector::camelize(Inflector::slug($info->name));
         return $model ? basename(str_replace('\\', '/', $model)) . $id : $id;
     }, 'name' => function ($method, $name, $options) {
         if (!strpos($name, '.')) {
             return $name;
         }
         $name = explode('.', $name);
         $first = array_shift($name);
         return $first . '[' . join('][', $name) . ']';
     }), 'binding' => function ($object, $name = null) {
         $result = compact('name') + array('data' => null, 'errors' => null, 'class' => null);
         if (is_object($object)) {
             $result = compact('name') + array('data' => $object->data($name), 'errors' => $object->errors($name), 'class' => $object->model());
         }
         return (object) $result;
     });
     parent::__construct(Set::merge($defaults, $config));
 }
Exemplo n.º 24
0
 /**
  * Create a `Swift_Message` from `li3_mailer\net\mail\Message`.
  *
  * @see li3_mailer\net\mail\transport\adapter\Swift::$_messageProperties
  * @see li3_mailer\net\mail\transport\adapter\Swift::$_attachmentProperties
  * @see li3_mailer\net\mail\Message
  * @see Swift_Message
  * @param object $message The `Message` object to translate.
  * @return object The translated `Swift_Message` object.
  */
 protected function _message($message)
 {
     $swiftMessage = Swift_Message::newInstance();
     foreach ($this->_messageProperties as $prop => $translated) {
         if (is_int($prop)) {
             $prop = $translated;
         }
         if (!is_null($message->{$prop})) {
             $value = $message->{$prop};
             if ($translated === 'address') {
                 $translated = $prop;
                 if (is_array($value)) {
                     $newvalue = array();
                     foreach ($value as $name => $address) {
                         if (is_int($name)) {
                             $newvalue[] = $address;
                         } else {
                             $newvalue[$address] = $name;
                         }
                     }
                     $value = $newvalue;
                 }
             }
             $method = "set" . Inflector::camelize($translated);
             $swiftMessage->{$method}($value);
         }
     }
     $first = true;
     foreach ($message->types() as $type => $contentType) {
         if ($first) {
             $first = false;
             $swiftMessage->setBody($message->body($type), $contentType);
         } else {
             $swiftMessage->addPart($message->body($type), $contentType);
         }
     }
     $headers = $swiftMessage->getHeaders();
     foreach ($message->headers as $header => $value) {
         $headers->addTextHeader($header, $value);
     }
     foreach ($message->attachments() as $attachment) {
         if (isset($attachment['path'])) {
             $path = $attachment['path'];
             $swiftAttachment = Swift_Attachment::fromPath($path);
         } else {
             $data = $attachment['data'];
             $swiftAttachment = Swift_Attachment::newInstance($data);
         }
         foreach ($this->_attachmentProperties as $prop => $translated) {
             if (is_int($prop)) {
                 $prop = $translated;
             }
             if (isset($attachment[$prop])) {
                 $method = "set" . Inflector::camelize($translated);
                 $swiftAttachment->{$method}($attachment[$prop]);
             }
         }
         $swiftMessage->attach($swiftAttachment);
     }
     return $swiftMessage;
 }
Exemplo n.º 25
0
 /**
  * Get the parent for the mock.
  *
  * @param string $request
  * @return string
  */
 protected function _parent($request)
 {
     $namespace = parent::_namespace($request);
     $class = Inflector::camelize($request->action);
     return "\\{$namespace}\\{$class}";
 }
Exemplo n.º 26
0
 /**
  * Get the singular variable to use for data in controller methods.
  *
  * @param string $request
  * @return string
  */
 protected function _singular($request)
 {
     return Inflector::singularize(Inflector::camelize($request->action, false));
 }
Exemplo n.º 27
0
 /**
  * Attempts to apply a set of formatting rules from `$_rules` to a `$params` array, where each
  * formatting rule is applied if the key of the rule in `$_rules` is present and not empty in
  * `$params`.  Also performs sanity checking against `$params` to ensure that no value
  * matching a rule is present unless the rule check passes.
  *
  * @param array $params An array of route parameters to which rules will be applied.
  * @return array Returns the `$params` array with formatting rules applied to array values.
  */
 public static function applyRules($params)
 {
     $result = array();
     if (!$params) {
         return false;
     }
     if (isset($params['controller']) && is_string($params['controller'])) {
         $controller = $params['controller'];
         if (strpos($controller, '.') !== false) {
             list($library, $controller) = explode('.', $controller);
             $controller = $library . '.' . Inflector::camelize($controller);
         } elseif (strpos($controller, '\\') === false) {
             $controller = Inflector::camelize($controller);
         }
         $params['controller'] = $controller;
     }
     foreach (static::$_rules as $rule => $value) {
         foreach ($value as $k => $v) {
             if (!empty($params[$rule])) {
                 $result[$k] = String::insert($v, $params);
             }
             $match = preg_replace('/\\{:\\w+\\}/', '@', $v);
             $match = preg_replace('/@/', '.+', preg_quote($match, '/'));
             if (preg_match('/' . $match . '/i', $params[$k])) {
                 return false;
             }
         }
     }
     return $result + array_diff_key($params, $result);
 }
Exemplo n.º 28
0
 /**
  * Document relationships.
  *
  * @param string $class
  * @param string $type Relationship type, e.g. `belongsTo`.
  * @param string $name
  * @param array $config
  * @return array
  */
 public function relationship($class, $type, $name, array $config = array())
 {
     $key = Inflector::camelize($type == 'belongsTo' ? $class::meta('name') : $name, false);
     $config += compact('name', 'type', 'key');
     $config['from'] = $class;
     $relationship = $this->_classes['relationship'];
     $defaultLinks = array('hasOne' => $relationship::LINK_EMBEDDED, 'hasMany' => $relationship::LINK_EMBEDDED, 'belongsTo' => $relationship::LINK_CONTAINED);
     $config += array('link' => $defaultLinks[$type]);
     return new $relationship($config);
 }
Exemplo n.º 29
0
 /**
  * testVariableNaming method
  *
  * @return void
  */
 public function testCamelize()
 {
     $this->assertEqual(Inflector::camelize('test-field'), 'TestField');
     $this->assertEqual(Inflector::camelize('test_field'), 'TestField');
     $this->assertEqual(Inflector::camelize('test_fieLd', false), 'testFieLd');
     $this->assertEqual(Inflector::camelize('test field', false), 'testField');
     $this->assertEqual(Inflector::camelize('Test_field', false), 'testField');
 }