for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Nip\Inflector\Traits;
/**
* Trait InflectionUnderscoreTrait
* @package Nip\Inflector\Traits
*
* @method underscore($string)
*/
trait InflectionUnderscoreTrait
{
* @param $word
* @return string
protected function doUnderscore($word)
return strtolower(
preg_replace(
'/[^A-Z^a-z^0-9]+/',
'_',
'/([a-zd])([A-Z])/',
'\1_\2',
'/([A-Z]+)([A-Z][a-z])/',
$word
)
);
}