Open Journal Systems  3.3.0
Inflector.php
1 <?php
2 
3 namespace Guzzle\Inflection;
4 
8 class Inflector implements InflectorInterface
9 {
11  protected static $default;
12 
18  public static function getDefault()
19  {
20  // @codeCoverageIgnoreStart
21  if (!self::$default) {
22  self::$default = new MemoizingInflector(new self());
23  }
24  // @codeCoverageIgnoreEnd
25 
26  return self::$default;
27  }
28 
29  public function snake($word)
30  {
31  return ctype_lower($word) ? $word : strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $word));
32  }
33 
34  public function camel($word)
35  {
36  return str_replace(' ', '', ucwords(strtr($word, '_-', ' ')));
37  }
38 }
Guzzle\Inflection\Inflector\snake
snake($word)
Definition: Inflector.php:29
Guzzle\Inflection\Inflector\getDefault
static getDefault()
Definition: Inflector.php:18
Guzzle\Inflection\Inflector\camel
camel($word)
Definition: Inflector.php:34
Guzzle\Inflection\InflectorInterface
Definition: InflectorInterface.php:8
Guzzle\Inflection\Inflector\$default
static $default
Definition: Inflector.php:11
Guzzle\Inflection
Definition: Inflector.php:3
Guzzle\Inflection\MemoizingInflector
Definition: MemoizingInflector.php:8
Guzzle\Inflection\Inflector
Definition: Inflector.php:8