summaryrefslogtreecommitdiff
path: root/vendor/guzzle/guzzle/src/Guzzle/Inflection/Inflector.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/guzzle/guzzle/src/Guzzle/Inflection/Inflector.php')
-rw-r--r--vendor/guzzle/guzzle/src/Guzzle/Inflection/Inflector.php38
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, '_-', ' ')));
+ }
+}