Skip to content

Instantly share code, notes, and snippets.

@chrisamoore
Created February 13, 2014 17:09
Show Gist options
  • Save chrisamoore/8979331 to your computer and use it in GitHub Desktop.
Save chrisamoore/8979331 to your computer and use it in GitHub Desktop.
How can I make this Leaner ?
<?php
//TODO: MAke Gooder Codes here
public function convertToBundle($str)
{
//$str = 'UE\Stampede\TestBundle\Controller\TestController::getTestsAction';
/// find :: shift back to before controller
// strip action
$str = preg_replace('/Action/', '', $str);
$str = preg_replace('/::/', ':', $str);
$str = str_replace('\Controller\\', ':', $str);
$str = preg_replace('/Controller/', '', $str);
$str = str_replace('\\', '', $str);
return $str;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment