diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2019-11-17 20:45:02 +0100 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2019-11-17 20:45:02 +0100 |
commit | 8df3db566a3a937b45ebf11adb90d265e6f5e2d4 (patch) | |
tree | 4d541098d751d5a9acf8c12f6fb9f308ace066ac /vendor/guzzle/guzzle/src/Guzzle/Inflection/Inflector.php | |
download | flyspray-8df3db566a3a937b45ebf11adb90d265e6f5e2d4.tar.xz |
initial checking of customized version 1.0rc9
Diffstat (limited to 'vendor/guzzle/guzzle/src/Guzzle/Inflection/Inflector.php')
-rw-r--r-- | vendor/guzzle/guzzle/src/Guzzle/Inflection/Inflector.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/vendor/guzzle/guzzle/src/Guzzle/Inflection/Inflector.php b/vendor/guzzle/guzzle/src/Guzzle/Inflection/Inflector.php new file mode 100644 index 0000000..c699773 --- /dev/null +++ b/vendor/guzzle/guzzle/src/Guzzle/Inflection/Inflector.php @@ -0,0 +1,38 @@ +<?php + +namespace Guzzle\Inflection; + +/** + * Default inflection implementation + */ +class Inflector implements InflectorInterface +{ + /** @var InflectorInterface */ + protected static $default; + + /** + * Get the default inflector object that has support for caching + * + * @return MemoizingInflector + */ + public static function getDefault() + { + // @codeCoverageIgnoreStart + if (!self::$default) { + self::$default = new MemoizingInflector(new self()); + } + // @codeCoverageIgnoreEnd + + return self::$default; + } + + public function snake($word) + { + return ctype_lower($word) ? $word : strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $word)); + } + + public function camel($word) + { + return str_replace(' ', '', ucwords(strtr($word, '_-', ' '))); + } +} |