Created
September 27, 2016 09:49
-
-
Save garex/40158209878d59b96320f5d2a58a4611 to your computer and use it in GitHub Desktop.
Transform "Vendor\FooBundle\Command\BarCommand" transforms to "vendor_foo.command.bar" id
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Transforms "Vendor\FooBundle\Command\BarCommand" transforms to "vendor_foo.command.bar" id | |
* | |
* @param string $className | |
* @return string | |
*/ | |
private function convertClassToId($className) | |
{ | |
$id = preg_replace('/^(\w+)\\\(\w+)Bundle.*\\\(\w+)(Command)$/', '$1_$2.$4.$3', $className); | |
return strtolower($id); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment