Skip to content

Instantly share code, notes, and snippets.

@bakura10 bakura10/file.php
Created May 14, 2014

Embed
What would you like to do?
class UnderscoreNamingStrategy implements NamingStrategyInterface
{
/**
* {@inheritDoc}
*/
public function getNameForExtraction($name, $context = null)
{
return ltrim(strtolower(preg_replace('/[A-Z]/', '_$0', $name)), '_');
}
/**
* {@inheritDoc}
*/
public function getNameForHydration($name, $context = null)
{
return lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($name)))));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.