grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026container = $container; } /** * Create a new Controller object * * @param string $viewName The name of the view we're getting a Controller for. * @param array $config Optional MVC configuration values for the Controller object. * * @return Controller */ public function controller($viewName, array $config = array()) { $controllerClass = $this->container->getNamespacePrefix($this->getSection()) . 'Controller\\' . ucfirst($viewName); try { return $this->createController($controllerClass, $config); } catch (ControllerNotFound $e) { } $controllerClass = $this->container->getNamespacePrefix($this->getSection()) . 'Controller\\' . ucfirst($this->container->inflector->singularize($viewName)); try { $controller = $this->createController($controllerClass, $config); } catch(ControllerNotFound $e) { // Do I have to create and save the class file? If not, let's rethrow the exception if(!$this->saveControllerScaffolding) { throw $e; } $scaffolding = new ControllerBuilder($this->container); // Was the scaffolding successful? If so let's call ourself again, otherwise throw a not found exception if($scaffolding->make($controllerClass, $viewName)) { $controller = $this->controller($viewName, $config); } else { throw $e; } } return $controller; } /** * Create a new Model object * * @param string $viewName The name of the view we're getting a Model for. * @param array $config Optional MVC configuration values for the Model object. * * @return Model */ public function model($viewName, array $config = array()) { $modelClass = $this->container->getNamespacePrefix($this->getSection()) . 'Model\\' . ucfirst($viewName); try { return $this->createModel($modelClass, $config); } catch (ModelNotFound $e) { } $modelClass = $this->container->getNamespacePrefix($this->getSection()) . 'Model\\' . ucfirst($this->container->inflector->singularize($viewName)); try { $model = $this->createModel($modelClass, $config); } catch(ModelNotFound $e) { // Do I have to create and save the class file? If not, let's rethrow the exception if(!$this->saveModelScaffolding) { throw $e; } // By default model classes are plural $modelClass = $this->container->getNamespacePrefix($this->getSection()) . 'Model\\' . ucfirst($viewName); $scaffolding = new ModelBuilder($this->container); // Was the scaffolding successful? If so let's call ourself again, otherwise throw a not found exception if($scaffolding->make($modelClass, $viewName)) { $model = $this->model($viewName, $config); } else { throw $e; } } return $model; } /** * Create a new View object * * @param string $viewName The name of the view we're getting a View object for. * @param string $viewType The type of the View object. By default it's "html". * @param array $config Optional MVC configuration values for the View object. * * @return View */ public function view($viewName, $viewType = 'html', array $config = array()) { $container = $this->container; $prefix = $this->container->getNamespacePrefix($this->getSection()); $viewClass = $prefix . 'View\\' . ucfirst($viewName) . '\\' . ucfirst($viewType); try { return $this->createView($viewClass, $config); } catch (ViewNotFound $e) { } $viewClass = $prefix . 'View\\' . ucfirst($container->inflector->singularize($viewName)) . '\\' . ucfirst($viewType); try { $view = $this->createView($viewClass, $config); } catch(ViewNotFound $e) { // Do I have to create and save the class file? If not, let's rethrow the exception. Note: I can only create HTML views if(!$this->saveViewScaffolding) { throw $e; } // By default view classes are plural $viewClass = $prefix . 'View\\' . ucfirst($container->inflector->pluralize($viewName)) . '\\' . ucfirst($viewType); $scaffolding = new ViewBuilder($this->container); // Was the scaffolding successful? If so let's call ourself again, otherwise throw a not found exception if($scaffolding->make($viewClass, $viewName, $viewType)) { $view = $this->view($viewName, $viewType, $config); } else { throw $e; } } return $view; } /** * Creates a new Dispatcher * * @param array $config The configuration values for the Dispatcher object * * @return Dispatcher */ public function dispatcher(array $config = array()) { $dispatcherClass = $this->container->getNamespacePrefix($this->getSection()) . 'Dispatcher\\Dispatcher'; try { return $this->createDispatcher($dispatcherClass, $config); } catch (DispatcherNotFound $e) { // Not found. Return the default Dispatcher return new Dispatcher($this->container, $config); } } /** * Creates a new Toolbar * * @param array $config The configuration values for the Toolbar object * * @return Toolbar */ public function toolbar(array $config = array()) { $toolbarClass = $this->container->getNamespacePrefix($this->getSection()) . 'Toolbar\\Toolbar'; try { return $this->createToolbar($toolbarClass, $config); } catch (ToolbarNotFound $e) { // Not found. Return the default Toolbar return new Toolbar($this->container, $config); } } /** * Creates a new TransparentAuthentication handler * * @param array $config The configuration values for the TransparentAuthentication object * * @return TransparentAuthentication */ public function transparentAuthentication(array $config = array()) { $authClass = $this->container->getNamespacePrefix($this->getSection()) . 'TransparentAuthentication\\TransparentAuthentication'; try { return $this->createTransparentAuthentication($authClass, $config); } catch (TransparentAuthenticationNotFound $e) { // Not found. Return the default TA return new TransparentAuthentication($this->container, $config); } } /** * Creates a new Form object * * @param string $name The name of the form. * @param string $source The form source filename without path and .xml extension e.g. "form.default" OR raw XML data * @param string $viewName The name of the view you're getting the form for. * @param array $options Options to the Form object * @param bool $replace Should form fields be replaced if a field already exists with the same group/name? * @param bool $xpath An optional xpath to search for the fields. * * @return Form|null The loaded form or null if the form filename doesn't exist * * @throws \RuntimeException If the form exists but cannot be loaded * * @deprecated 3.1 Support for XML forms will be removed in FOF 4 */ public function form($name, $source, $viewName, array $options = array(), $replace = true, $xpath = false) { $formClass = $this->container->getNamespacePrefix($this->getSection()) . 'Form\\Form'; try { $form = $this->createForm($formClass, $name, $options); } catch (FormNotFound $e) { // Not found. Return the default Toolbar $form = new Form($this->container, $name, $options); } // If $source looks like raw XML data, parse it directly if (strpos($source, '