Zend\Mvc\View\Http\InjectTemplateListener::inflectName PHP Method

inflectName() protected method

Inlines the logic from zend-filter's Word\CamelCaseToDash filter.
protected inflectName ( string $name ) : string
$name string
return string
    protected function inflectName($name)
    {
        if (StringUtils::hasPcreUnicodeSupport()) {
            $pattern = ['#(?<=(?:\\p{Lu}))(\\p{Lu}\\p{Ll})#', '#(?<=(?:\\p{Ll}|\\p{Nd}))(\\p{Lu})#'];
            $replacement = ['-\\1', '-\\1'];
        } else {
            $pattern = ['#(?<=(?:[A-Z]))([A-Z]+)([A-Z][a-z])#', '#(?<=(?:[a-z0-9]))([A-Z])#'];
            $replacement = ['\\1-\\2', '-\\1'];
        }
        $name = preg_replace($pattern, $replacement, $name);
        return strtolower($name);
    }