コード例 #1
0
ファイル: Helper.php プロジェクト: spryker/Application
 /**
  * @param string $destination
  *
  * @throws \LogicException
  *
  * @return string
  */
 public function getRouteFromDestination($destination)
 {
     if (strpos($destination, '::') !== false) {
         list($controllerNamespaceName, $actionName) = explode('::', $destination);
     } elseif (strpos($destination, ':') !== false) {
         list($serviceName, $actionName) = explode(':', $destination);
         $controllerNamespaceName = get_class($this->app[$serviceName]);
     } else {
         throw new LogicException('Cannot parse destination');
     }
     list($namespace, $application, $bundle, $layer, $controllerName) = explode('\\', $controllerNamespaceName);
     $filter = new CamelCaseToSeparatorFilter('-');
     $bundle = str_replace(Store::getInstance()->getStoreName(), '', $bundle);
     $controller = $filter->filter(str_replace('Controller', '', $controllerName));
     $action = $filter->filter(str_replace('Action', '', $actionName));
     return $bundle . '/' . $controller . '/' . $action;
 }
コード例 #2
0
 /**
  * @dataProvider dataProvider
  *
  * @return void
  */
 public function testWithDifferentSeparator($camelCase, $separator, $expected)
 {
     $filter = new CamelCaseToSeparatorFilter($separator);
     $this->assertEquals($expected, $filter->filter($camelCase));
 }