Example #1
0
 /**
  * Generate unique name
  *
  * @param string      $module     Module name
  * @param string      $control Control path (or null for only module name)
  * @param string|null $action     Action name (or null for only control name)
  *
  * @return string
  */
 public static function generateName($module, $control = null, $action = null)
 {
     $parts = explode('/', $module);
     if ($control !== null) {
         $parts = array_merge($parts, explode('/', $control));
     }
     if ($action !== null) {
         $parts = array_merge($parts, array($action));
     }
     $converter = new Converter();
     foreach ($parts as $key => $value) {
         $parts[$key] = $converter->camelToDashed($value);
     }
     $name = implode('-', $parts);
     return $name;
 }
Example #2
0
 /**
  * Convert class with namespace to path
  *
  * @param string $class Class
  *
  * @return string
  */
 protected function getPath($class)
 {
     $converter = new Converter();
     $parts = explode('\\', rtrim($class, '\\'));
     foreach ($parts as $key => $part) {
         $parts[$key] = $converter->camelToDashed($part);
     }
     $path = implode('/', $parts);
     return $path;
 }