* @license MIT * * @link https://github.com/adhocore/cli */ trait InflectsString { /** * Convert a string to camel case. */ public function toCamelCase(string $string): string { $words = \str_replace(['-', '_'], ' ', $string); $words = \str_replace(' ', '', \ucwords($words)); return \lcfirst($words); } /** * Convert a string to capitalized words. */ public function toWords(string $string): string { $words = \trim(\str_replace(['-', '_'], ' ', $string)); return \ucwords($words); } }