Yet another string utility class

In my development daily odyssey my need to manipulate strings in a semi-intelligent way did skyrocket especially seeing my “as little parameters as possible” mania.
The following class, included in my own library, does cover my needs right now allowing me to transit from

doSometing($title = 'Some Thing', $id = 'some-thing', $script = 'some-thing.js'){} 

to a way more streamlined

doSometing($title = 'Some Thing'){} 

using, “under the hood”, functions like

$id = Str::hyphen($title); $script = $id . '.js'; 

The class handles many to many string separators and class conversions

<?php namespace tad\utils; class Str { public static function underscore($string) { return self::uniteUsing('_', $string, -1); } public static function hyphen($string) { return self::uniteUsing('-', $string, -1); } public static function camelCase($string) { $buffer = self::extractComponentsFrom($string); // print_r($buffer); $buffer = implode(' ', $buffer); $buffer = ucwords($buffer); $buffer = preg_replace('/\s+/', '', $buffer); return $buffer; } public static function camelBack($string) { return lcfirst(self::camelCase($string)); } protected static function uniteUsing($glue, $string, $flag = 0) { $elements = self::extractComponentsFrom($string); array_walk( $elements, function (&$str, $key, $flag) { switch ($flag) { case 1: $str = ucfirst($str); break; case -1: $str = strtolower($str); break; case 11: $str = strtoupper($str); break; default: $str = $str; break; } }, $flag ); return implode($glue, $elements); } protected static function extractComponentsFrom($string) { $elements = explode(' ', preg_replace('/[-_\s\\\\\/]/', ' ', $string)); // split elements further by uppercase and numbers $smallerElements = array(); foreach ($elements as $el) { $result = trim(preg_replace("/([A-Z]?[a-z]+|[0-9]+)/", " $1", $el)); $smallerElements= array_merge($smallerElements, explode(' ', $result)); } return $smallerElements; } public static function ucfirstUnderscore($string) { return self::uniteUsing('_', $string, 1); } public static function toPath($string) { return self::uniteUsing(DIRECTORY_SEPARATOR, $string); } } 

I appreciate your input