Calculates controller, action, model and all extra info.
349279
protected function updateURLData()
    {
        $uri = substr($this->currentURL, strlen($this->baseURL));
        if (!trim($uri) || '/' == $uri) {
            $this->language = $this->defaultLanguage;
            $this->module = $this->defaultModule;
            $this->controller = $this->defaultController;
            $this->action = null;
            $this->calculateModulePath();
            return;
        }
        $language = explode('/', $uri, 2); // search for language
        if (in_array($language[0], $this->availableLanguages)) {
            $this->language = $language[0];
            $uri = $language[1];
        }

        $module = explode('/', $uri, 2); // search for module
        foreach ($this->modules as $mod => $details) {
            if (is_array($details) && $module[0] == $mod) {
                $this->applyModuleConfig($details);
                $this->module = $module[0];
                $uri = isset($module[1]) ? $module[1] : '';
                break;
            }
            if ($details == $module[0]) {
                $this->module = $module[0];
                $uri = isset($module[1]) ? $module[1] : '';
                break;
            }
        }
        $this->calculateModulePath();
        if (!trim($uri)) {
            $this->controller = $this->defaultController;
            $this->action = null;
            return;
        }
        unset($module);
        if ($uri[0] == '/') {
            $uri = substr($uri, 1); // remove slash from start.
        }

        if (isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING']) { // remove query part from url.
            $uri = substr($uri, 0, strlen($uri) - strlen($_SERVER['QUERY_STRING']) - 1);
        }
        if ('.html' == substr($uri, -5)) {
            $uri = substr($uri, 0, strlen($uri) - 5); // remove .html from the end.
        }

        // search for the route.
        $this->params = $_GET;
        foreach ($this->urlRoutes as $route => $defined) {
            $expression = is_numeric($route) ? '/^' . $defined . '$/' : '/^' . $route . '$/';
            $result = preg_match($expression, $uri, $matches);
            if (!$result) {
                $expression = is_numeric($route) ? '/^' . $defined . '\/(?<params>.*)$/' : '/^' . $route . '\/(?<params>.*)$/';
                $result = preg_match($expression, $uri, $matches);
            }
            if (!$result) {
                continue; //not matched
            }
            if ($this->debug) {
                $this->debug($uri . ' -- ' . $expression);
            }
            $this->_updateURLDataUsingMatches($matches, is_numeric($route) ? "" : $defined);
            break;
        }
        $_GET = $this->params;
    }
678267
public function Process ()
	{

		// Set redirect path

		$redirect	= isset ($_SERVER['REQUEST_URI'])? strtok ($_SERVER['REQUEST_URI'], '?') : '';

		/**
		 * Action is the last section after the final /
		 * Controller is the path before it
		 */

		// Get the position of the last / in the URL

		$pos			= strrpos ($redirect, '/');

		// Set the action

		$this->action	= substr ($redirect, $pos+1);

		if (!$this->action)
		{
			$this->action	= 'index';
		}

		// Set controller, if there is no / besides the first one then there is no controller

		$controller		= ($pos < 1)? '' : substr ($redirect, 1, $pos-1);

		// If there is a controller
		// Split controller by module and uppercase first character of each module
		// to keep in fitting with the rest of the framework

		if ($controller)
		{

			$arrController	= explode ('/', $controller);

			foreach ($arrController as &$controllerModule)
			{
				$controllerModule	= ucfirst ($controllerModule);
			}

			// Replace / in controller with \ for correct path and set controller

			$this->controller	= join ('\\', $arrController);

		}

	}
572783
public function generateController()
    {
        if (!$this->confirm('Do you want to generate a controller?')) {
            return;
        }

        $this->console->call('generate:controller', [
            'name' => $this->getControllerName(),
            '--force' => $this->console->option('force'),
            '--scaffold' => true,
        ]);
    }
471524
public function process()
    {
        // Your controller name
        $this->controller = Inflector::classify($this->argument('name')).'Controller';

        // By default we will generate basic controller, if resource set then we will generate
        // REST-ful Resource controller
        $this->setControllerType();

        try {
            $this->makeController();
        } catch (\Exception $e) {
            throw $e;
        }

        $this->info('Controller '.$this->controller.' Generated Successfully By Cygnite Cli.');
    }
152307
def tasks(self):
        """"""
        tasks = set()
        for ctrl in self.controllers.values():
            tasks.update(ctrl.tasks)
        return tasks
338464
private function _info()
    {
        foreach ($this->_output as $ups) {

            $dev = new UPSDevice();

            // General info
            if (preg_match('/^UPSNAME\s*:\s*(.*)$/m', $ups, $data)) {
                $dev->setName(trim($data[1]));
            }
            if (preg_match('/^MODEL\s*:\s*(.*)$/m', $ups, $data)) {
                $model = trim($data[1]);
                if (preg_match('/^APCMODEL\s*:\s*(.*)$/m', $ups, $data)) {
                    $dev->setModel($model.' ('.trim($data[1]).')');
                } else {
                    $dev->setModel($model);
                }
            }
            if (preg_match('/^UPSMODE\s*:\s*(.*)$/m', $ups, $data)) {
                $dev->setMode(trim($data[1]));
            }
            if (preg_match('/^STARTTIME\s*:\s*(.*)$/m', $ups, $data)) {
                $dev->setStartTime(trim($data[1]));
            }
            if (preg_match('/^STATUS\s*:\s*(.*)$/m', $ups, $data)) {
                $dev->setStatus(trim($data[1]));
            }
            if (preg_match('/^ITEMP\s*:\s*(.*)$/m', $ups, $data)) {
                $temperatur = trim($data[1]);
                if (($temperatur !== "-273.1 C") && ($temperatur !== "-273.1 C Internal")) {
                    $dev->setTemperatur($temperatur);
                }
            }
            // Outages
            if (preg_match('/^NUMXFERS\s*:\s*(.*)$/m', $ups, $data)) {
                $dev->setOutages(trim($data[1]));
            }
            if (preg_match('/^LASTXFER\s*:\s*(.*)$/m', $ups, $data)) {
                $dev->setLastOutage(trim($data[1]));
            }
            if (preg_match('/^XOFFBATT\s*:\s*(.*)$/m', $ups, $data)) {
                $dev->setLastOutageFinish(trim($data[1]));
            }
            // Line
            if (preg_match('/^LINEV\s*:\s*(\d*\.\d*)(.*)$/m', $ups, $data)) {
                $dev->setLineVoltage(trim($data[1]));
            }
            if (preg_match('/^LINEFREQ\s*:\s*(\d*\.\d*)(.*)$/m', $ups, $data)) {
                $dev->setLineFrequency(trim($data[1]));
            }
            if (preg_match('/^LOADPCT\s*:\s*(\d*\.\d*)(.*)$/m', $ups, $data)) {
                $dev->setLoad(trim($data[1]));
            }
            // Battery
            if (preg_match('/^BATTDATE\s*:\s*(.*)$/m', $ups, $data)) {
                $dev->setBatteryDate(trim($data[1]));
            }
            if (preg_match('/^BATTV\s*:\s*(\d*\.\d*)(.*)$/m', $ups, $data)) {
                $dev->setBatteryVoltage(trim($data[1]));
            }
            if (preg_match('/^BCHARGE\s*:\s*(\d*\.\d*)(.*)$/m', $ups, $data)) {
                $dev->setBatterCharge(trim($data[1]));
            }
            if (preg_match('/^TIMELEFT\s*:\s*(\d*\.\d*)(.*)$/m', $ups, $data)) {
                $dev->setTimeLeft(trim($data[1]));
            }
            $this->upsinfo->setUpsDevices($dev);
        }
    }
87939
public function process(){
    if ( $this->check() ){
      $this->obj = new \stdClass();
      if ( !\is_array($this->info)){
        $this->log("No info in MVC", $this->info);
        die("No info in MVC");
      }
      if ( !$this->controller ){
        $this->controller = new mvc\controller($this, $this->info, $this->data, $this->obj);
      }
      $this->controller->process();
    }
	}
409392
public function getRouteInfo()
    {
        if ($this->isSingle()) {
            if (isset($this->containers['route_info']) && ($controller = $this->containers['route_info']->get('controller')) 
                && ($action = $this->containers['route_info']->get('action'))
            ) {
                return ['controller' => $controller, 'action' => $action];
            }
        }
        return ['controller' => 'index', 'action' => 'index'];
    }
269035
private function analyseAction($controller) {
        $urlParam = explode('-', $controller);
        switch (count($urlParam)) {
            case 0:
                break;
            case 1:
                $this->controller = $urlParam[0];
                break;
            case 2:
                $this->controller = $urlParam[0];
                $_REQUEST['_1'] = $_GET['_1'] = $urlParam[1];
                break;
            default:
                $this->controller = $urlParam[0];
                foreach ($urlParam as $k => $v) {
                    if ($k === 0) {
                        continue;
                    }
                    $_REQUEST['_' . $k] = $_GET['_' . $k] = $v;
                }
                break;
        }
    }
153266
public function importAction()
    {
        $controller   = $this->getRequest()->getControllerName();
        $importLoader = $this->loader->getImportLoader();
        $model        = $this->getModel();

        $params = array();
        $params['defaultImportTranslator'] = $importLoader->getDefaultTranslator($controller);
        $params['formatBoxClass']          = 'browser table';
        $params['importer']                = $importLoader->getImporter($controller, $model);
        $params['model']                   = $model;
        $params['tempDirectory']           = $importLoader->getTempDirectory();
        $params['importTranslators']       = $importLoader->getTranslators($controller);

        $this->addSnippets($this->importSnippets, $params);
    }
344309
def run(self):
        
        while True:
            data, sender = self.sock.recvfrom(1024)
            addr = sender[0]
            msg = data.decode('utf-8')
            if msg.startswith('/controller/'):
                try:
                    uid = msg.split('/')[2]
                    if uid == 'new':
                        port = int(msg.split('/')[3])
                        self._new_controller(addr, port)
                    else:
                        cmd = msg.split('/')[3]
                        if cmd == 'ping':
                            port = msg.split('/')[3]
                            self._ping(uid, addr, port)
                        elif cmd == 'kthxbye':
                            self._del_controller(uid)
                        elif cmd == 'states':
                            states = msg.split('/')[4]
                            self._update_states(uid, states)
                        elif cmd == 'text':
                            # /controller/<uid>/text/<text>
                            text = msg[12 + len(uid) + 6:]
                            self._got_message(uid, text)
                except IndexError or KeyError:
                    pass
            else:
                pass

            # find unused controllers and delete them
            ctlrs = self.controllers.items()
            for uid, state in ctlrs:
                if state[3] < time.time() - 60:
                    self.controllers.pop(uid)
628097
public function process()
	{
		$view = $this->getView();
		$basket = $view->orderBasket;
		$orderItem = $view->orderItem;
		$context = $this->_getContext();


		/** client/html/checkout/confirm/url/target
		 * Destination of the URL where the controller specified in the URL is known
		 *
		 * The destination can be a page ID like in a content management system or the
		 * module of a software development framework. This "target" must contain or know
		 * the controller that should be called by the generated URL.
		 *
		 * @param string Destination of the URL
		 * @since 2014.03
		 * @category Developer
		 * @see client/html/checkout/confirm/url/controller
		 * @see client/html/checkout/confirm/url/action
		 * @see client/html/checkout/confirm/url/config
		 */
		$target = $view->config( 'client/html/checkout/confirm/url/target' );

		/** client/html/checkout/confirm/url/controller
		 * Name of the controller whose action should be called
		 *
		 * In Model-View-Controller (MVC) applications, the controller contains the methods
		 * that create parts of the output displayed in the generated HTML page. Controller
		 * names are usually alpha-numeric.
		 *
		 * @param string Name of the controller
		 * @since 2014.03
		 * @category Developer
		 * @see client/html/checkout/confirm/url/target
		 * @see client/html/checkout/confirm/url/action
		 * @see client/html/checkout/confirm/url/config
		 */
		$controller = $view->config( 'client/html/checkout/confirm/url/controller', 'checkout' );

		/** client/html/checkout/confirm/url/action
		 * Name of the action that should create the output
		 *
		 * In Model-View-Controller (MVC) applications, actions are the methods of a
		 * controller that create parts of the output displayed in the generated HTML page.
		 * Action names are usually alpha-numeric.
		 *
		 * @param string Name of the action
		 * @since 2014.03
		 * @category Developer
		 * @see client/html/checkout/confirm/url/target
		 * @see client/html/checkout/confirm/url/controller
		 * @see client/html/checkout/confirm/url/config
		 */
		$action = $view->config( 'client/html/checkout/confirm/url/action', 'confirm' );

		/** client/html/checkout/confirm/url/config
		 * Associative list of configuration options used for generating the URL
		 *
		 * You can specify additional options as key/value pairs used when generating
		 * the URLs, like
		 *
		 *  client/html/<clientname>/url/config = array( 'absoluteUri' => true )
		 *
		 * The available key/value pairs depend on the application that embeds the e-commerce
		 * framework. This is because the infrastructure of the application is used for
		 * generating the URLs. The full list of available config options is referenced
		 * in the "see also" section of this page.
		 *
		 * @param string Associative list of configuration options
		 * @since 2014.03
		 * @category Developer
		 * @see client/html/checkout/confirm/url/target
		 * @see client/html/checkout/confirm/url/controller
		 * @see client/html/checkout/confirm/url/action
		 * @see client/html/url/config
		 */
		$config = $view->config( 'client/html/checkout/confirm/url/config', array( 'absoluteUri' => true ) );

		$confirmUrl = $view->url( $target, $controller, $action, array(), array(), $config );


		/** client/html/checkout/update/url/target
		 * Destination of the URL where the controller specified in the URL is known
		 *
		 * The destination can be a page ID like in a content management system or the
		 * module of a software development framework. This "target" must contain or know
		 * the controller that should be called by the generated URL.
		 *
		 * @param string Destination of the URL
		 * @since 2014.03
		 * @category Developer
		 * @see client/html/checkout/update/url/controller
		 * @see client/html/checkout/update/url/action
		 * @see client/html/checkout/update/url/config
		 */
		$target = $view->config( 'client/html/checkout/update/url/target' );

		/** client/html/checkout/update/url/controller
		 * Name of the controller whose action should be called
		 *
		 * In Model-View-Controller (MVC) applications, the controller contains the methods
		 * that create parts of the output displayed in the generated HTML page. Controller
		 * names are usually alpha-numeric.
		 *
		 * @param string Name of the controller
		 * @since 2014.03
		 * @category Developer
		 * @see client/html/checkout/update/url/target
		 * @see client/html/checkout/update/url/action
		 * @see client/html/checkout/update/url/config
		 */
		$controller = $view->config( 'client/html/checkout/update/url/controller', 'checkout' );

		/** client/html/checkout/update/url/action
		 * Name of the action that should create the output
		 *
		 * In Model-View-Controller (MVC) applications, actions are the methods of a
		 * controller that create parts of the output displayed in the generated HTML page.
		 * Action names are usually alpha-numeric.
		 *
		 * @param string Name of the action
		 * @since 2014.03
		 * @category Developer
		 * @see client/html/checkout/update/url/target
		 * @see client/html/checkout/update/url/controller
		 * @see client/html/checkout/update/url/config
		 */
		$action = $view->config( 'client/html/checkout/update/url/action', 'update' );

		/** client/html/checkout/update/url/config
		 * Associative list of configuration options used for generating the URL
		 *
		 * You can specify additional options as key/value pairs used when generating
		 * the URLs, like
		 *
		 *  client/html/<clientname>/url/config = array( 'absoluteUri' => true )
		 *
		 * The available key/value pairs depend on the application that embeds the e-commerce
		 * framework. This is because the infrastructure of the application is used for
		 * generating the URLs. The full list of available config options is referenced
		 * in the "see also" section of this page.
		 *
		 * @param string Associative list of configuration options
		 * @since 2014.03
		 * @category Developer
		 * @see client/html/checkout/update/url/target
		 * @see client/html/checkout/update/url/controller
		 * @see client/html/checkout/update/url/action
		 * @see client/html/url/config
		 */
		$config = $view->config( 'client/html/checkout/update/url/config', array( 'absoluteUri' => true ) );

		$updateUrl = $view->url( $target, $controller, $action, array(), array(), $config );


		$config = array( 'payment.url-success' => $confirmUrl, 'payment.url-update' => $updateUrl );


		try
		{
			$service = $basket->getService( 'payment' );

			$manager = MShop_Factory::createManager( $context, 'service' );
			$provider = $manager->getProvider( $manager->getItem( $service->getServiceId() ) );
			$provider->injectGlobalConfigBE( $config );

			$view->paymentForm = $provider->process( $orderItem );
		}
		catch( MShop_Order_Exception $e )
		{
			$view->paymentForm = new MShop_Common_Item_Helper_Form_Default( $confirmUrl, 'REDIRECT' );
		}

		if( !isset( $view->paymentForm ) || $view->paymentForm === null )
		{
			$msg = sprintf( 'Invalid process response from service provider with code "%1$s"', $service->getCode() );
			throw new Client_Html_Exception( $msg );
		}

		parent::process();
	}
930828
def get_action_params(controller, action)
      comment_lines = get_action_comments(controller, action)

      comments_raw = []
      has_param = false
      comment_lines.each do |line|
        if line.match(/\s*#\s*@param/) # @param id required Integer blah blah
          has_param = true
          comments_raw << ''
        end
        if has_param
          line = line.gsub(/\A\s*#\s*@param/, '')
          line = line.gsub(/\A\s*#\s*/, '').strip

          comments_raw.last << "\n" unless comments_raw.last.blank?
          comments_raw.last << line
        end
      end

      comments = []
      comments_raw.each do |comment|
        match_data = comment.match(/(?<name>[a-z0-9A-Z_\[\]]+)?\s*(?<required>#{PARAM_IMPORTANCES.join('|')})?\s*(?<type>#{PARAM_TYPES.join('|')})?\s*(?<description>.*)/m)

        if match_data
          comments << {
            name: match_data[:name],
            required: match_data[:required],
            type: match_data[:type],
            description: match_data[:description]
          }
        else
          comments << { description: comment }
        end
      end

      comments
    end
1254898
public function actionList ()
		{
			$class = $this->_modelClass;
			$list = $class::find()->select('name,value,description')->orderBy([ 'name' => SORT_ASC ])->asArray()->all();
			Console::printTable($list, [ 'Name', 'Value', 'Description' ]);
		}
607684
protected function mergeControllerProperties()
    {
        if (isset($this->action['uses']) && is_string($this->action['uses']) && Str::contains($this->action['uses'],
                '@')) {
            $this->action['controller'] = $this->action['uses'];

            $this->makeControllerInstance();
        }

        if (! $this->controllerUsesHelpersTrait()) {
            return;
        }

        $controller = $this->getControllerInstance();

        $controllerMiddleware = [];

        if (method_exists($controller, 'getMiddleware')) {
            $controllerMiddleware = $controller->getMiddleware();
        } elseif (method_exists($controller, 'getMiddlewareForMethod')) {
            $controllerMiddleware = $controller->getMiddlewareForMethod($this->controllerMethod);
        }

        $this->middleware = array_merge($this->middleware, $controllerMiddleware);

        if ($property = $this->findControllerPropertyOptions('throttles')) {
            $this->throttle = $property['class'];
        }

        if ($property = $this->findControllerPropertyOptions('scopes')) {
            $this->scopes = array_merge($this->scopes, $property['scopes']);
        }

        if ($property = $this->findControllerPropertyOptions('authenticationProviders')) {
            $this->authenticationProviders = array_merge($this->authenticationProviders, $property['providers']);
        }

        if ($property = $this->findControllerPropertyOptions('rateLimit')) {
            $this->rateLimit = $property['limit'];
            $this->rateExpiration = $property['expires'];
        }
    }
448979
protected function calculateTotal()
    {
        $otherConfig = $this->getOtherConfig();
        $total       = $this
            ->getEnvironment()
            ->getDataProvider()
            ->fetchAll($otherConfig->setIdOnly(true));

        if (\is_array($total)) {
            $this->intTotal = $total ? \count($total) : 0;

            return;
        }

        if (\is_object($total)) {
            $this->intTotal = $total->length();

            return;
        }

        $this->intTotal = 0;
    }
1213806
static function load($controller, $action = '', $params = array())
	{

		$class_name = ucfirst($controller);
		$method = $action;
		$tc = "Controller\\" . $class_name;
		if (!class_exists($tc)) return self::er("Class $tc does not exist.");
		$this_object = new $tc($params);


		if (!method_exists($this_object, $method)) {
			return self::er("Method $method in $tc does not exist.");
		}


		if (!is_callable(array($this_object, $method))) return self::er("Method $method in $tc is not callable.");
		if (is_callable(array($this_object, "__before"))) {
			call_user_func(array($this_object, "__before"));
		}


		call_user_func(array($this_object, $method));

		if (is_callable(array($this_object, "__after"))) {
			call_user_func(array($this_object, "__after"));
		}
		return $this_object;
	}