Protected Uses

@param string & $controller
@param string & $namespace = NULL
979574
protected function namespace(String & $controller, String & $namespace = NULL)
    {
        if( ! empty($this->settings['namespace']) )
        {
            $namespace   = $this->settings['namespace'];
            $controller .= "namespace ".$namespace.";".EOL.EOL;
        }
    }
763270
public static function contentcontrollerInit($controller)
    {
        $subsite = Subsite::currentSubsite();

        if ($subsite && $subsite->Theme) {
            SSViewer::add_themes([$subsite->Theme]);
        }

        if ($subsite && i18n::getData()->validate($subsite->Language)) {
            i18n::set_locale($subsite->Language);
        }
    }
784907
public function clearFrom($namespace, $key = null)
    {
        $oldNamespace = $this->namespace;
        $this->setNamespace($namespace);
        $this->clear($key);
        $this->setNamespace($oldNamespace);
    }
1142310
private function getControllerLocator($controller)
    {
        $class = null;
        $prefix = null;

        if (0 === strpos($controller, '@')) {
            $file = $this->locator->locate($controller);
            $controllerClass = ClassUtils::findClassInFile($file);

            if (false === $controllerClass) {
                throw new \InvalidArgumentException(sprintf('Can\'t find class for controller "%s"', $controller));
            }

            $controller = $controllerClass;
        }

        if ($this->container->has($controller)) {
            // service_id
            $prefix = $controller.':';

            if (Kernel::VERSION_ID >= 40100) {
                $prefix .= ':';
            }

            $useScope = method_exists($this->container, 'enterScope') && $this->container->hasScope('request');
            if ($useScope) {
                $this->container->enterScope('request');
                $this->container->set('request', new Request());
            }
            $class = get_class($this->container->get($controller));
            if ($useScope) {
                $this->container->leaveScope('request');
            }
        } elseif (class_exists($controller)) {
            // full class name
            $class = $controller;
            $prefix = $class.'::';
        } elseif (false !== strpos($controller, ':')) {
            // bundle:controller notation
            try {
                $notation = $this->controllerParser->parse($controller.':method');
                list($class) = explode('::', $notation);
                $prefix = $class.'::';
            } catch (\Exception $e) {
                throw new \InvalidArgumentException(
                    sprintf('Can\'t locate "%s" controller.', $controller)
                );
            }
        }

        if (empty($class)) {
            throw new \InvalidArgumentException(sprintf(
                'Class could not be determined for Controller identified by "%s".', $controller
            ));
        }

        return [$prefix, $class];
    }
702313
protected function _setLayout(Controller &$controller) {
		if ($controller->name == 'CakeError') {
			$controller->layout = 'CakeTheme.error';

			return;
		}

		$isAjax = $controller->request->is('ajax');
		$isPjax = $controller->request->is('pjax');
		$isHtml = $this->_controller->ViewExtension->isHtml();
		if ($isPjax) {
			$controller->layout = 'CakeTheme.pjax';
		} elseif ($isHtml && !$isAjax) {
			if ($controller->request->param('controller') === 'users') {
				$controller->layout = 'CakeTheme.login';
			} else {
				if ($controller->layout === 'default') {
					$controller->layout = 'CakeTheme.main';
				}
			}
		}
	}
496061
public function initialize(Controller $controller) {
		if ($this->settings['isTest']) {
			return;
		}

		$this->user = $this->Session->read("{$this->settings['path']}");

		$this->routes = Permit::$routes;
		Permit::$user = $this->user;

		$this->request = $controller->request;

		foreach (array('controller', 'plugin') as $inflected) {
			if (isset($this->request->params[$inflected])) {
				$this->request->params[$inflected] = strtolower(Inflector::underscore($this->request->params[$inflected]));
			}
		}
	}
573668
private function setupNamespace($namespace)
	{
		if(!is_null($namespace)) {
			if(!isset($_SESSION[$namespace]) || !is_array($_SESSION[$namespace])) {
				$_SESSION[$namespace] = array();
			}
			$this->data = &$_SESSION[$namespace];
		} else {
			$this->data = &$_SESSION;
		}
	}
1199254
private function controller($module, $controller, $injetion = null) {

        // Check if exist
        if(class_exists($namespace = 'App\\Modules\\' . ucfirst($module) . '\\Controllers\\' . $controller)) {

            return (new $namespace($injetion));
        }
    }
1292971
protected function implements(String & $controller)
    {
        if( ! empty($this->settings['implements']) )
        {
            $controller .= " implements ".( is_array($this->settings['implements'])
                                            ? implode(', ', $this->settings['implements'])
                                            : $this->settings['implements']
                                          );
        }
    }
257020
protected function traits(String & $controller)
    {
        if( ! empty($this->settings['traits']) )
        {
            if( is_array($this->settings['traits']) ) foreach( $this->settings['traits'] as $trait )
            {
                $controller .= HT."use {$trait};".EOL;
            }
            else
            {
                $controller .= HT."use ".$this->settings['traits'].";".EOL;
            }

            $controller .= EOL;
        }
    }
582491
private function getClassAndMethod(string $controller)
    {
        if (!isset($this->controllers[$controller])) {
            $this->controllers[$controller] = $this->detectClassAndMethod($controller);
        }

        return $this->controllers[$controller];
    }
1322961
public function controller($controller)
    {

        // Instantiate a string controller
        if (is_string($controller)
            && class_exists($controller)
            && is_subclass_of($controller, 'Bkwld\Decoy\Controllers\Base')) {
            $this->controller_name = $controller;
            $this->controller = new $controller;

            // Apply the parent if one was set
            if ($this->parent_item && $this->controller) {
                $this->controller->parent($this->parent_item);
            }

        // Or, validate a passed controller instance
        } elseif (is_object($controller)
            && is_a($controller, 'Bkwld\Decoy\Controllers\Base')) {
            $this->controller_name = get_class($controller);
            $this->controller = $controller;
        }

        // Chain
        return $this;
    }
348966
public function setControllerData($controller)
    {
        if (is_string($controller)) {
            $controller = $this->app->normalizeClassName($controller, 'Data');
        } elseif (!$controller instanceof Controller_Data) {
            throw $this->exception('Inappropriate Controller. Must extend Controller_Data');
        }
        $this->controller = $this->setController($controller);

        return $this->controller;
    }
804476
public function controller($uri, $controller, $names = array())
	{
		$prepended = $controller;

		// First, we will check to see if a controller prefix has been registered in
		// the route group. If it has, we will need to prefix it before trying to
		// reflect into the class instance and pull out the method for routing.
		if (count($this->groupStack) > 0)
		{
			$prepended = $this->prependGroupUses($controller);
		}

		$routable = $this->getInspector()->getRoutable($prepended, $uri);

		// When a controller is routed using this method, we use Reflection to parse
		// out all of the routable methods for the controller, then register each
		// route explicitly for the developers, so reverse routing is possible.
		foreach ($routable as $method => $routes)
		{
			foreach ($routes as $route)
			{
				$this->registerInspected($route, $controller, $method, $names);
			}
		}

		$this->addFallthroughRoute($controller, $uri);
	}
1082003
public function resource($name, $controller, array $options = array())
    {
        $registrar = $this->getRegistrar();

        $registrar->register($name, $controller, $options);
    }
898083
public function setController(Controller $controller)
    {
        $this->_Controller = $controller;
        $this->setEventManager($controller->getEventManager());
    }
1135727
public function call(App $app, string $namespace, string $prefix = "Controller"){
		//is a Controller
		if(is_string($this->callable)){
			$params = explode('#', $this->callable);
			$params[0] = ((isset($namespace) && strpos($params[0], '\\') === false) ? ($namespace.$params[0].$prefix) : $params[0]);
			if(!class_exists($params[0]))
				throw new HttpException(404, 'Class Not Found : '.$params[0]);
			$controller = new $params[0]($app);
			if(!method_exists($controller,$params[1]))
				throw new HttpException(404, 'Function Not Found : '.$params[0].'::'.$params[1]);
			return call_user_func_array(array($controller, $params[1]), $this->matches);
		} else {
			return call_user_func_array($this->callable, $this->matches);
		}
	}