Пример #1
0
 /**
  * Return the name of the controller, extracted from its class name.
  *
  * @return string|null The underscored name of the controller, or `null` if it cannot be
  * extracted.
  */
 protected function get_name()
 {
     $controller_class = get_class($this);
     if (preg_match('/(\\w+)Controller$/', $controller_class, $matches)) {
         return \ICanBoogie\underscore($matches[1]);
     }
     return null;
 }
Пример #2
0
 protected function resolve_block_class($name)
 {
     $module = $this;
     $class_name = \ICanBoogie\camelize(\ICanBoogie\underscore($name)) . 'Block';
     while ($module) {
         $try = $module->descriptor[self::T_NAMESPACE] . '\\' . $class_name;
         if (class_exists($try, true)) {
             return $try;
         }
         $module = $module->parent;
     }
 }
 /**
  * 
  * @return string
  */
 private function getOptionsAndValues()
 {
     $optionsAndValues = array();
     $rawValues = explode('_', \ICanBoogie\underscore(str_replace('test', '', strtolower($this->getName()))));
     $currentKey = null;
     foreach ($rawValues as $index => $value) {
         if ($index % 2 == 0) {
             $currentKey = $value;
         } else {
             if (isset($optionsAndValues[$currentKey])) {
                 if (!is_array($optionsAndValues[$currentKey])) {
                     $optionsAndValues[$currentKey] = array($optionsAndValues[$currentKey]);
                 }
                 $optionsAndValues[$currentKey][] = $value;
             } else {
                 $optionsAndValues[$currentKey] = $value;
             }
         }
     }
     return $optionsAndValues;
 }