Get the formatted steps

@param CheckoutStepController $controller

@return ArrayList
514162
public static function get(CheckoutStepController $controller)
    {
        $list = new ArrayList();
        $steps = self::getSteps();
        foreach ($steps as $step) {
            $data = new ViewableData();
            $data->Link = $controller->Link($step);
            $data->Title = _t("CheckoutSteps.$step", ucfirst($step));
            $data->InPast = self::inPast($step, $controller);
            $data->InFuture = self::inFuture($step, $controller);
            $data->Current = self::current($step, $controller);
            $list->add($data);
        }

        return $list;
    }
926287
public function getRoutes(string $controller): array{
        if(!class_exists($controller)){
            throw new \InvalidArgumentException();
        }

        $result = [];
        $class  = new \ReflectionClass($controller);
        $parent = null;

        $this->isController($class, true);

        try{
            $parent = $this->reader->getClassAnnotation($class, Route::class);
        }catch(\Exception $e){
            throw new Exception\AnnotationException(
                "Annotation error occurred in {$controller}. ({$e->getMessage()})",
                $e->getCode(),
                $e
            );
        }

        foreach($class->getMethods(\ReflectionMethod::IS_PUBLIC) as $method){
            try{
                $route = $this->reader->getMethodAnnotation($method, Route::class);
            }catch(\Exception $e){
                throw new Exception\AnnotationException(
                    "Annotation error occurred in {$controller}::{$method}(). ({$e->getMessage()})",
                    $e->getCode(),
                    $e
                );
            }

            if(null === $route){
                continue;
            }

            $this->isAction($method, true);

            if(null !== $parent){
                $route->setParent($parent);
            }

            $route  = $route->cerateRoute();

            if(null === $route->getName()){
                $route  = $route->withName($this->getRouteName($method));
            }

            $result[]   = $route->withData([
                "action"    => [
                    "class"     => $class->getName(),
                    "method"    => $method->getName(),
                ],
            ]);
        }

        return $result;
    }
1307249
public function getControllerAndAction($controller, $action, $controllerDir = '')
    {
        $controller = $this->getControllerName($controller, $controllerDir);
        $action = $this->getActionName($action);

        return [$controller, $action];
    }
395140
public function serializePayload(ControllerContext $controllerContext)
    {
        return [
            'contextPath' => $this->getNode()->getContextPath(),
            'parentContextPath' => $this->getNode()->getParent()->getContextPath()
        ];
    }
1242960
private function getPartsFromControllerName($controller)
    {
        if (3 != count($parts = explode(':', $controller))) {
            throw new \InvalidArgumentException(sprintf('The "%s" controller is not a valid a:b:c controller string.', $controller));
        }

        list($moduleName, $controller, $action) = $parts;
        $controller = str_replace('/', '\\', $controller);
        $module     = $this->moduleManager->getModule($moduleName);

        if (!is_object($module)) {
            throw new \RuntimeException(sprintf(
                'Unable to locate module: %s, when parsing controller: %s',
                $moduleName, $controller
            ));
        }

        $moduleName = $module->getName();

        return [$module, $moduleName, $controller, $action];
    }
609357
public function submit($controller)
    {
        $result = $controller->getSubmitted('uploaded', array());

        $vars = array(
            '@num_errors' => count($result['errors']),
            '@num_success' => count($result['transferred'])
        );

        $files = $controller->getSubmitted('files');

        /* @var $file \SplFileInfo */
        $file = reset($files);

        $query = array(
            'cmd' => 'list',
            'path' => $this->getRelativeFilePath($file->getRealPath())
        );

        return array(
            'redirect' => $controller->url('', $query),
            'severity' => empty($result['errors']) ? 'success' : 'warning',
            'message' => $this->translation->text('Uploaded @num_success, errors: @num_errors', $vars)
        );
    }
356884
private function getControllers ($dir = FALSE, $recursive = TRUE)
	{
		
		// Excluded Controllers

		$ignore		= array ('.', '..', '.svn', 'Developer.php');
		
		// Append / to dir if it doesnt end in one
		
		if ($dir && substr ($dir, -1) != '/')
		{
			$dir	.= DIRECTORY_SEPARATOR;
		}
		
		// Set path with seperator

		$path	= __DIR__ . DIRECTORY_SEPARATOR . $dir;
		
		// Extract Actual Controllers

		$controllers	= array ();
		
		foreach (scandir ($path) as $entry)
		{
			
			$name	= str_replace ('.php', '', $entry);
			
			// If the entry is . or .. move on
			
			if (in_array ($entry, $ignore))
			{
				continue;
			}
			
			// Else if the entry is a .php file
			
			else if (is_file ($path . $entry) && stripos ($entry, '.php'))
			{
				if (!array_key_exists ($name, $controllers))
				{
					$controllers[$name] = 0;
				}
			}
			
			// Else if we're calling recursively and the entry is a directory 
			
			else if ($recursive && is_dir ($path . $entry))
			{
				$controllers[$name] = $this->getControllers ($dir . $entry, TRUE);
			}
			
		}
		
		return $controllers;

	}
1304169
protected function _getCommands($controller)
    {
        $commands = [];
        try {
            $controllerClassName = $this->_getControllerClassName($controller);

            if (!class_exists($controllerClassName)) {
                return [];
            }

            foreach ((new \ReflectionClass($controllerClassName))->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
                if (!$method->isStatic() && $method->isPublic() && preg_match('#^(.*)Command$#', $method->getShortName(), $matches) === 1) {
                    $commands[] = Text::underscore($matches[1]);
                }
            }
        } catch (\Exception $e) {

        }

        return $commands;
    }
1004319
public function get_stored_controllers_hashes()
	{
	    $file = new File($this->controllers_hash_file);
		$file_content = $file->read();
		
		if(!empty($file_content))
		{
			$stored_controller_hashes = unserialize($file_content);
		}
		else
		{
			$stored_controller_hashes = array();
		}
		
		return $stored_controller_hashes;
	}
953492
protected function getTemplate(Request $request, $controller)
    {
        if ($request->attributes->has('_template')) {
            return null;
        }

        $format    = $request->attributes->get('_format', 'html');
        $templates = [];

        if ($controllerInfo = $this->parseController($controller)) {
            $template = sprintf('%s/%s.%s.twig', $controllerInfo['name'], $controllerInfo['action'], $format);

            if ($this->templateExists($template)) {
                return $template;
            } else {
                $templates[] = $template;
            }
        }

        $route = $this->routes->get($request->attributes->get('_route'));

        if ($route && $route->hasContent()) {
            $template = sprintf('%s/%s.%s.twig', $route->getContent(), $route->isList() ? 'list' : 'show', $format);

            if ($this->templateExists($template)) {
                return $template;
            } else {
                $templates[] = $template;
            }
        }

        return array_pop($templates);
    }
661272
public static function build($controller)
    {
        $routes = array();
        $actions = self::parseActionMethods($controller);

        foreach ($actions as $actionName => $actionInfo) {
            list($annotations, $meta) = $actionInfo;

            if (isset($annotations['Route'])) {
                $path = $annotations['Route'];
            } else {
                if ($actionName === 'indexAction') {
                    $path = '';
                } else {
                    $path = self::translatePath($actionName); // '/' . preg_replace_callback('/[A-Z]/', function($matches) {
                }
            }

            $route = array($path, $actionName);

            if (isset($annotations['Method'])) {
                $route[] = array('method' => Mux::convertRequestMethodConstant($annotations['Method']));
            } else {
                $route[] = array();
            }
            $routes[] = $route;
        }

        return $routes;
    }
1313575
protected function searchController(
        /*# string */ $controller,
        /*# string */ $action
    )/*# : callable */ {
        $controllerName = $controller . $this->controller_suffix;
        $actionName = $action . $this->action_suffix;
        foreach ($this->namespaces as $ns) {
            $class = $ns . '\\' . $controllerName;
            if (class_exists($class)) {
                $obj = new $class();
                return [$obj, $actionName];
            }
        }
        throw new LogicException(
            Message::get(Message::RTE_HANDLER_UNKNOWN, $controller),
            Message::RTE_HANDLER_UNKNOWN
        );
    }
1198723
public function getSkipActions(string $controller): array
    {
        return !empty($this->skipActions[$controller]) ? $this->skipActions[$controller] : [];
    }
129058
public function getMenuLinkRoutes($controller, $belongsTo = '')
    {
        $this->getAllMenuLinkRoutes();

        $routes = [];
        // Get routes of this post type
        if(isset($this->allMenuLinkRoutes[$controller][$belongsTo])) {
            $routes = $this->allMenuLinkRoutes[$controller][$belongsTo];
        }else if(isset($this->allMenuLinkRoutes[$controller])) {
            $routes = $this->allMenuLinkRoutes[$controller];
        }
        return $routes;
    }
916303
public function need_confirm_regrading($controller) {
        $data = $this->get_data();
        if (isset($data->rubric['regrade'])) {
            // we have already displayed the confirmation on the previous step
            return false;
        }
        if (!isset($data->saverubric) || !$data->saverubric) {
            // we only need confirmation when button 'Save rubric' is pressed
            return false;
        }
        if (!$controller->has_active_instances()) {
            // nothing to re-grade, confirmation not needed
            return false;
        }
        $changelevel = $controller->update_or_check_rubric($data);
        if ($changelevel == 0) {
            // no changes in the rubric, no confirmation needed
            return false;
        }

        // freeze form elements and pass the values in hidden fields
        // TODO MDL-29421 description_editor does not freeze the normal way, uncomment below when fixed
        $form = $this->_form;
        foreach (array('rubric', 'name'/*, 'description_editor'*/) as $fieldname) {
            $el =& $form->getElement($fieldname);
            $el->freeze();
            $el->setPersistantFreeze(true);
            if ($fieldname == 'rubric') {
                $el->add_regrade_confirmation($changelevel);
            }
        }

        // replace button text 'saverubric' and unfreeze 'Back to edit' button
        $this->findButton('saverubric')->setValue(get_string('continue'));
        $el =& $this->findButton('editrubric');
        $el->setValue(get_string('backtoediting', 'gradingform_rubric'));
        $el->unfreeze();

        return true;
    }
1144860
public function initialize(Controller $controller) {
		$this->_controller = $controller;
		if (!$this->_controller->Components->loaded('RequestHandler')) {
			$this->_controller->RequestHandler = $this->_controller->Components->load('RequestHandler');
			$this->_controller->RequestHandler->initialize($this->_controller);
		}
		if (!$this->_controller->Components->loaded('Session')) {
			$this->_controller->Session = $this->_controller->Components->load('Session');
			$this->_controller->Session->initialize($this->_controller);
		}
		if ($this->_controller->Auth->loggedIn() ||
			$this->_controller->RequestHandler->prefers('json')) {
			return;
		}

		$isAuthCfg = $this->_modelSetting->isAuthGroupConfigured();
		if ($isAuthCfg) {
			if ($this->_controller->Session->read('Settings.FirstLogon')) {
				$this->_controller->Session->delete('Settings.FirstLogon');

				return $this->_controller->redirect($this->_controller->Auth->logout());
			}

			return;
		}

		$pluginName = $this->_controller->request->param('plugin');
		$controllerName = $this->_controller->request->param('controller');
		$actionName = $this->_controller->request->param('action');
		if (($pluginName !== 'cake_settings_app') ||
			($controllerName !== 'settings') ||
			($actionName !== 'index')) {
			return;
		}

		$this->_controller->Auth->allow('index');
		$this->_controller->Session->write('Settings.FirstLogon', true);
	}
1007817
public static function get_previous_cron($controller,$action){
        return self::find()->where(['controller'=>$controller,'action'=>$action, 'success' => 1])->orderBy('id_cron_job DESC')->one();
    }