/** * @return array|bool */ private function getControllerClassAndMethod() { $target = false; $method = CamelCase::to($this->route['action'], false) . 'Action'; foreach ((array) $this->route['namespace'] as $namespace) { $class = sprintf('%s\\%s\\Controller\\%sController', $namespace, CamelCase::to($this->route['module']), CamelCase::to($this->route['controller'])); if (method_exists($class, $method)) { $target = [$class, $method]; break; } } return $target; }
/** * Get translation(s) for given module (or module and key) * * @param string $language * @param string $module * @param string|null $key * @return string|array */ public function get($language, $module, $key = null) { $translation = null; if (false === isset($this->translations[$language][$module])) { $this->translations[$language][$module] = []; foreach (array_reverse((array) $this->registry->get('routing.namespace')) as $namespace) { $path = [ROOT, 'src', str_replace("\\", DS, $namespace), CamelCase::to($module), 'View', 'Translation']; $file = implode(DS, $path) . DS . sprintf('%s.xml', $language); if (is_readable($file)) { if (false !== ($xml = simplexml_load_file($file))) { foreach ($this->parse($xml) as $index => $value) { $this->translations[$language][$module][$index] = $value; } } } } } if (null === $key) { $translation = $this->translations[$language][$module]; } elseif (isset($this->translations[$language][$module][$key])) { $translation = $this->translations[$language][$module][$key]; } return $translation; }
/** * @param \Janeiro\Request\AbstractRequest $request * @template Schema/Repository.phtml */ public function repositoryAction(AbstractRequest $request) { $this->view->set('entity', CamelCase::to($request->getParameter(2))); echo $this->view->render(); }