for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the PHINT package.
*
* (c) Jitendra Adhikari <[email protected]>
* <https://github.com/adhocore>
* Licensed under MIT license.
*/
namespace Ahc\Phint\Util;
class Inflector
{
/**
* StuldyCase.
* @param string $path
* @return string
public function stuldyCase(string $string): string
return str_replace(' ', '', ucwords(str_replace(['-', '_'], ' ', $string)));
}
* Separate words.
public function words(string $string): string
return ucwords(str_replace(['-', '_'], ' ', $string));
* Snakeize.
public function snakeCase(string $string): string
$string = \str_replace([' ', '-'], '_', $string);
return \ltrim(\strtolower(\preg_replace('/[A-Z]([A-Z](?![a-z]))*/', '_$0', $string)), '_');