Overview

Namespaces

  • Contrib
    • Bundle
      • CoverallsBundle
        • Console
        • Entity
      • CoverallsV1Bundle
        • Api
        • Collector
        • Command
        • Config
        • Entity
          • Git
    • Component
      • File
      • Log
      • System
        • Git
  • Guzzle
    • Batch
      • Exception
    • Cache
    • Common
      • Exception
    • Http
      • Curl
      • Exception
      • Message
      • QueryAggregator
    • Inflection
    • Iterator
    • Log
    • Parser
      • Cookie
      • Message
      • UriTemplate
      • Url
    • Plugin
      • Async
      • Backoff
      • Cache
      • Cookie
        • CookieJar
        • Exception
      • CurlAuth
      • ErrorResponse
        • Exception
      • History
      • Log
      • Md5
      • Mock
      • Oauth
    • Service
      • Builder
      • Command
        • Factory
        • LocationVisitor
          • Request
          • Response
      • Description
      • Exception
      • Resource
    • Stream
  • PHP
  • Psr
    • Log
  • Symfony
    • Component
      • Config
        • Definition
          • Builder
          • Exception
        • Exception
        • Loader
        • Resource
        • Util
      • Console
        • Command
        • Formatter
        • Helper
        • Input
        • Output
        • Tester
      • EventDispatcher
        • Debug
      • Finder
        • Adapter
        • Comparator
        • Exception
        • Expression
        • Iterator
        • Shell
      • Stopwatch
      • Yaml
        • Exception

Classes

  • Inflector
  • MemoizingInflector
  • PreComputedInflector

Interfaces

  • InflectorInterface
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo
 1: <?php
 2: 
 3: namespace Guzzle\Inflection;
 4: 
 5: /**
 6:  * Default inflection implementation
 7:  */
 8: class Inflector implements InflectorInterface
 9: {
10:     /**
11:      * @var InflectorInterface
12:      */
13:     protected static $default;
14: 
15:     /**
16:      * Get the default inflector object that has support for caching
17:      *
18:      * @return MemoizingInflector
19:      */
20:     public static function getDefault()
21:     {
22:         // @codeCoverageIgnoreStart
23:         if (!self::$default) {
24:             self::$default = new MemoizingInflector(new self());
25:         }
26:         // @codeCoverageIgnoreEnd
27: 
28:         return self::$default;
29:     }
30: 
31:     /**
32:      * {@inheritdoc}
33:      */
34:     public function snake($word)
35:     {
36:         return ctype_lower($word) ? $word : strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $word));
37:     }
38: 
39:     /**
40:      * {@inheritdoc}
41:      */
42:     public function camel($word)
43:     {
44:         return str_replace(' ', '', ucwords(strtr($word, '_-', '  ')));
45:     }
46: }
47: 
php-coveralls API documentation generated by ApiGen 2.8.0