|
9 | 9 |
|
10 | 10 | namespace Joomla\String; |
11 | 11 |
|
12 | | -use Doctrine\Common\Inflector\Inflector as DoctrineInflector; |
| 12 | +use Doctrine\Inflector\InflectorFactory; |
13 | 13 |
|
14 | 14 | /** |
15 | 15 | * Joomla Framework String Inflector Class |
|
19 | 19 | * @since 1.0 |
20 | 20 | * @deprecated 5.0 Use doctrine/inflector package as complete replacement instead. |
21 | 21 | */ |
22 | | -class Inflector extends DoctrineInflector |
| 22 | +class Inflector |
23 | 23 | { |
24 | 24 | /** |
25 | 25 | * The inflector rules for countability. |
@@ -123,4 +123,76 @@ public function isSingular($word) |
123 | 123 | { |
124 | 124 | return static::singularize($word) === $word; |
125 | 125 | } |
| 126 | + |
| 127 | + /** |
| 128 | + * Proxy for Inflector::tableize() |
| 129 | + */ |
| 130 | + public static function tableize(string $word) : string |
| 131 | + { |
| 132 | + $inflector = InflectorFactory::create()->build(); |
| 133 | + |
| 134 | + return $inflector->tableize($word); |
| 135 | + } |
| 136 | + |
| 137 | + /** |
| 138 | + * Proxy for Inflector::classify() |
| 139 | + */ |
| 140 | + public static function classify(string $word) : string |
| 141 | + { |
| 142 | + $inflector = InflectorFactory::create()->build(); |
| 143 | + |
| 144 | + return $inflector->classify($word); |
| 145 | + } |
| 146 | + |
| 147 | + /** |
| 148 | + * Proxy for Inflector::camelize() |
| 149 | + */ |
| 150 | + public static function camelize(string $word) : string |
| 151 | + { |
| 152 | + $inflector = InflectorFactory::create()->build(); |
| 153 | + |
| 154 | + return $inflector->camelize($word); |
| 155 | + } |
| 156 | + |
| 157 | + /** |
| 158 | + * Proxy for Inflector::ucwords() |
| 159 | + */ |
| 160 | + public static function ucwords(string $string, string $delimiters = " \n\t\r\0\x0B-") : string |
| 161 | + { |
| 162 | + return ucwords($string, $delimiters); |
| 163 | + } |
| 164 | + |
| 165 | + /** |
| 166 | + * Empty method to suffice the former interface |
| 167 | + */ |
| 168 | + public static function reset() : void |
| 169 | + { |
| 170 | + } |
| 171 | + |
| 172 | + /** |
| 173 | + * Empty method to suffice the former interface |
| 174 | + */ |
| 175 | + public static function rules(string $type, iterable $rules, bool $reset = false) : void |
| 176 | + { |
| 177 | + } |
| 178 | + |
| 179 | + /** |
| 180 | + * Proxy for Inflector::pluralize() |
| 181 | + */ |
| 182 | + public static function pluralize(string $word) : string |
| 183 | + { |
| 184 | + $inflector = InflectorFactory::create()->build(); |
| 185 | + |
| 186 | + return $inflector->pluralize($word); |
| 187 | + } |
| 188 | + |
| 189 | + /** |
| 190 | + * Proxy for Inflector::singularize() |
| 191 | + */ |
| 192 | + public static function singularize(string $word) : string |
| 193 | + { |
| 194 | + $inflector = InflectorFactory::create()->build(); |
| 195 | + |
| 196 | + return $inflector->singularize($word); |
| 197 | + } |
126 | 198 | } |
0 commit comments