Function to ease the components

@param   string  baseTask  Task to use as root. Example: 'clean:modules.frontend'

@return  array
762161
function getComponentsTasks(baseTask) {
	var components = getComponents();
	var tasks = [];

	for (index = 0; index < components.length; ++index) {
	    tasks.push(baseTask + '.' + components[index]);
	}

	return tasks;
}
62343
public static function &getComponents(): array
    {
        if (empty(self::$runtimeComponents)) {
            foreach (self::getAddons() as $addon) {
                self::$runtimeComponents = array_merge(self::$runtimeComponents, $addon->getComponents());
            }
        }
        
        return self::$runtimeComponents;
    }
844148
public function getMainComponents() {
    $base_path = $this->getBaseComponentPath();

    $filter = function (Extension $module) use ($base_path) {
      return dirname($module->getPath()) == $base_path;
    };

    return array_filter($this->getAll(), $filter);
  }
1123853
public function get_element_properties(base_task $task = null, renderer_base $output = null) {
        $icon = $this->get_icon();
        $context = context_course::instance($task->get_courseid());
        $label = format_string($this->get_label($task), true, array('context' => $context));
        if (!empty($icon)) {
            $label .= $output->render($icon);
        }
        // Name, label, options, attributes.
        return $this->apply_options(array(
            'element' => 'select',
            'name' => self::NAME_PREFIX.$this->name,
            'label' => $label,
            'options' => $this->values,
            'attributes' => $this->attributes
        ));
    }
1116745
public function get_label(base_task $task = null) {
        // If a task has been provided and the label is not already set meaningfully
        // we will attempt to improve it.
        if (!is_null($task) && $this->label == $this->setting->get_name() && strpos($this->setting->get_name(), '_include') !== false) {
            if ($this->setting->get_level() == backup_setting::SECTION_LEVEL) {
                $this->label = get_string('includesection', 'backup', $task->get_name());
            } else if ($this->setting->get_level() == backup_setting::ACTIVITY_LEVEL) {
                $this->label = $task->get_name();
            }
        }
        return $this->label;
    }
1208720
private static function taskbarArrayTemplate():array
    {
        $options = array();
        try {
            $um =  new MasterCore();
            $options['css'] =  FEnv::get("host.web.components.libs.framework")."assets/css/iumioTaskBar.css";
            $options['css_icon'] =
                FEnv::get("host.web.components.libs.framework")."iumio-manager/css/pe-icon-7-stroke.css";
            $options['js'] = FEnv::get("host.web.components.libs.framework")."assets/js/iumioTaskBar.js";
            $options['logo'] =  FEnv::get("host.web.components.libs.framework")."img/logo_white_small.png";
            $options['ve']  =  \iumioFramework\Core\Requirement\FrameworkCore::
                getInfo('EDITION_VERSION')." ".\iumioFramework\Core\Requirement\FrameworkCore::
                getInfo('EDITION_SHORTNAME');
            $options['env'] = FEnv::get("framework.env");
            $options['call_app'] = ((!FEnv::isset("app.call"))? "No apps called" : FEnv::get("app.call"));
            $options['manager'] =  $um->generateRoute(
                "iumio_manager_index",
                null,
                "ManagerApp",
                true
            );
            $options['cache_clear_all']     =  $um->generateRoute(
                "iumio_manager_cache_manager_remove_all",
                null,
                "ManagerApp",
                true
            );
            $options['cache_clear_dev']     =  $um->generateRoute(
                "iumio_manager_cache_manager_remove",
                array("env" => "dev"),
                "ManagerApp",
                true
            );
            $options['cache_clear_prod']    =  $um->generateRoute(
                "iumio_manager_cache_manager_remove",
                array("env" => "prod"),
                "ManagerApp",
                true
            );
            $options['publish_assets_all']  =  $um->generateRoute(
                "iumio_manager_assets_manager_publish",
                array("env" => "all", "appname" => "_all"),
                "ManagerApp",
                true
            );
            $options['publish_assets_dev']  =  $um->generateRoute(
                "iumio_manager_assets_manager_publish",
                array("env" => "dev", "appname" => "_all"),
                "ManagerApp",
                true
            );
            $options['publish_assets_prod'] =  $um->generateRoute(
                "iumio_manager_assets_manager_publish",
                array("env" => "prod", "appname" => "_all"),
                "ManagerApp",
                true
            );
            $options['clear_assets_all']    =  $um->generateRoute(
                "iumio_manager_assets_manager_clear",
                array("env" => "all", "appname" => "_all"),
                "ManagerApp",
                true
            );
            $options['clear_assets_dev']    =  $um->generateRoute(
                "iumio_manager_assets_manager_clear",
                array("env" => "dev", "appname" => "_all"),
                "ManagerApp",
                true
            );
            $options['clear_assets_prod']   =  $um->generateRoute(
                "iumio_manager_assets_manager_clear",
                array("env" => "prod", "appname" => "_all"),
                "ManagerApp",
                true
            );
            $options['all_simple_apps']     =  $um->generateRoute(
                "iumio_manager_app_manager_get_simple_apps",
                null,
                "ManagerApp",
                true
            );
            $options['get_logs']            =  $um->generateRoute(
                "iumio_manager_logs_get",
                null,
                "ManagerApp",
                true
            );
        } catch (\Exception $e) {
            echo $e->getMessage();
        }
        return ($options);
    }
806711
function client (root) {
	return {

		tasks: {

			// Create a new task
			create: function (task, done) {
				post(root + 'tasks', task, done);
			},

			// Get all tasks
			get: function (query, done) {
				get(root + 'tasks', query, done);
			},

			// Get results for all tasks
			results: function (query, done) {
				get(root + 'tasks/results', query, done);
			}

		},

		task: function (id) {
			return {

				// Get a task
				get: function (query, done) {
					get(root + 'tasks/' + id, query, done);
				},

				// Edit a task
				edit: function (edits, done) {
					patch(root + 'tasks/' + id, edits, done);
				},

				// Remove a task
				remove: function (done) {
					del(root + 'tasks/' + id, null, done);
				},

				// Run a task
				run: function (done) {
					post(root + 'tasks/' + id + '/run', null, done);
				},

				// Get results for a task
				results: function (query, done) {
					get(root + 'tasks/' + id + '/results', query, done);
				},

				result: function (rid) {
					return {

						// Get a result
						get: function (query, done) {
							get(root + 'tasks/' + id + '/results/' + rid, query, done);
						}

					};
				}

			};
		}

	};
}
1235876
protected function replaceSubTasks()
    {
        foreach ($this->tasks as $name => &$script) {
            $callback = function ($m) {
                return $m[1].$this->tasks[$m[2]];
            };

            $script = $this->trimSpaces(
                preg_replace_callback("/(\s*)@run\('(.*)'\)/", $callback, $script)
            );
        }
    }
939514
function filterTasks (type, tasks, alltasks) {
    var contains = function (task) {
        return _.includes(tasks, task.name);
    };

    if (type === 'include') {
        return _.filter(alltasks, contains);
    } else if (type === 'exclude') {
        return _.reject(alltasks, contains);
    }
    return alltasks;
}
69938
public function bootstrapTasks()
    {
        $tasks = [
            Check::class,
            Cleanup::class,
            CreateRelease::class,
            CurrentRelease::class,
            Dependencies::class,
            Deploy::class,
            FridayDeploy::class,
            Ignite::class,
            Installer::class,
            Migrate::class,
            Notify::class,
            Primer::class,
            Rollback::class,
            Setup::class,
            SwapSymlink::class,
            Teardown::class,
            Test::class,
            Update::class,
            Updater::class,
        ];

        foreach ($tasks as $task) {
            $task = new $task();
            $task->setContainer($this->container);
            $this->builder->buildTask($task);
        }
    }
97563
public function getTaskList()
    {
        $tasks = $this->loader->loadTasks();

        return array_map(function (Task $task) {
            return $task->getName();
        }, $tasks);
    }
890661
private function loadAppTask(array $task)
    {
        //if task name contains more than 2 parts then it comes from module
        if (count($task) > 2) {
            $moduleName = ucfirst($task[1]);
            $taskName = ucfirst($task[2]);
            $taskName = $this->loadAppModuleTask($moduleName, $taskName);
        } else {
            $taskName = ucfirst($task[1]);
        }

        return $taskName;
    }
1263402
public function getPreTasks()
    {
        if ($this->preTasks != null) {
            return $this->preTasks;
        }

        /** @noinspection PhpUndefinedFieldInspection */
        return $this->preTasks = $this->getScripts($this->configFile->preTasks);
    }
536972
public function indexTask()
	{
		// var to hold output
		$output = new stdClass();
		$output->component = substr($this->_option, 4);
		$bits = explode('v', get_class($this));
		$output->version   = str_replace('_', '.', end($bits));
		$output->tasks     = array();
		$output->errors    = array();

		// create reflection class of file
		$classReflector = new ReflectionClass($this);

		if ($this->isDynamic)
		{
			$model = $this->resolveModel();
			$properties = $model->getStructure()->getTableColumns($model->getTableName());
			$properties = $this->normalizeProperties($properties);

			$output->version = 1;
		}

		// loop through each method and process doc
		foreach ($classReflector->getMethods() as $method)
		{
			// create docblock object & make sure we have something
			$phpdoc = new \phpDocumentor\Reflection\DocBlock($method);

			// skip constructor
			if (substr($method->getName(), -4) != 'Task' || in_array($method->getName(), array('registerTask', 'unregisterTask')))
			{
				continue;
			}

			// skip method in the parent class (already processed), 
			/*if ($className != $method->getDeclaringClass()->getName())
			{
				//continue;
			}*/

			// skip if we dont have a short desc
			// but put in error
			if (!$phpdoc->getShortDescription())
			{
				$output->errors[] = Lang::txt(
					'JLIB_APPLICATION_ERROR_DOCBLOCK_MISSING',
					$method->getName(),
					str_replace(PATH_ROOT, '', $classReflector->getFileName())
				);
				continue;
			}

			// create endpoint data array
			$endpoint = array(
				'name'        => substr($method->getName(), 0, -4),
				'description' => preg_replace('/\s+/', ' ', $phpdoc->getShortDescription()),
				'method'      => '',
				'uri'         => '',
				'parameters'  => array()
			);

			// loop through each tag
			foreach ($phpdoc->getTags() as $tag)
			{
				// get tag name and content
				$name    = strtolower(str_replace('api', '', $tag->getName()));
				$content = $tag->getContent();

				// handle parameters separately
				// json decode param input
				if ($name == 'parameter')
				{
					$parameter = json_decode($content);

					if (json_last_error() != JSON_ERROR_NONE)
					{
						$output->errors[] = Lang::txt(
							'JLIB_APPLICATION_ERROR_DOCLBOCK_PARSING',
							$method->getName(),
							str_replace(PATH_ROOT, '', $classReflector->getFileName())
						);
						continue;
					}

					$endpoint['parameters'][] = (array) $parameter;
					continue;
				}

				if ($name == 'uri' && $method->getName() == 'indexTask')
				{
					$content .= $output->component;

					if ($this->isDynamic)
					{
						$content .= '/' . $this->_controller;
					}
				}

				// add data to endpoint data
				$endpoint[$name] = $content;
			}

			if ($this->isDynamic && $endpoint['name'] != 'index')
			{
				$endpoint['uri'] = str_replace('{component}', $output->component, $endpoint['uri']);
				$endpoint['uri'] = str_replace('{controller}', $this->_controller, $endpoint['uri']);
				$endpoint['uri'] = str_replace('{primary key}', '{' . $model->getPrimaryKey() . '}', $endpoint['uri']);

				foreach ($properties as $prop => $type)
				{
					$parameter = array(
						'name'        => $prop,
						'description' => '',
						'type'        => $type,
						'required'    => false,
						'default'     => null
					);

					if ($prop == $model->getPrimaryKey() && in_array($endpoint['name'], array('read', 'update', 'delete')))
					{
						$parameter['required'] = true;

						if (in_array($endpoint['name'], array('read', 'delete')))
						{
							$endpoint['parameters'] = array($parameter);
							break;
						}
					}

					$endpoint['parameters'][] = $parameter;
				}
			}

			// add endpoint to output
			$output->tasks[] = $endpoint;
		}

		if (count($output->errors) <= 0)
		{
			unset($output->errors);
		}

		$this->send($output);
	}
883946
private function getAvailableTasks()
    {
        $tasks = array_map(function ($task) {
            return substr($task, 0, -4);
        }, array_diff(scandir(__DIR__.'/../../Task'), array('.', '..')));

        sort($tasks);

        return $tasks;
    }
650251
function getTemplatesTasks(baseTask, app) {
	var tasks = [];
	var templates = getTemplates(app);

	if (templates) {
		for (index = 0; index < templates.length; ++index) {
		    tasks.push(baseTask + '.' + templates[index]);
		}
	}

	return tasks;
}
757581
function(task, suppressCallbacks) {
  // subtask is now done
  task.state = DONE;

  delete sTasks[task.id];
  if(sVL >= 1) {
    forge.log.verbose(cat, '[%s][%s] finish',
      task.id, task.name, task);
  }

  // only do queue processing for root tasks
  if(task.parent === null) {
    // report error if queue is missing
    if(!(task.type in sTaskQueues)) {
      forge.log.error(cat,
        '[%s][%s] task queue missing [%s]',
        task.id, task.name, task.type);
    } else if(sTaskQueues[task.type].length === 0) {
      // report error if queue is empty
      forge.log.error(cat,
        '[%s][%s] task queue empty [%s]',
        task.id, task.name, task.type);
    } else if(sTaskQueues[task.type][0] !== task) {
      // report error if this task isn't the first in the queue
      forge.log.error(cat,
        '[%s][%s] task not first in queue [%s]',
        task.id, task.name, task.type);
    } else {
      // remove ourselves from the queue
      sTaskQueues[task.type].shift();
      // clean up queue if it is empty
      if(sTaskQueues[task.type].length === 0) {
        if(sVL >= 1) {
          forge.log.verbose(cat, '[%s][%s] delete queue [%s]',
            task.id, task.name, task.type);
        }
        /* Note: Only a task can delete a queue of its own type. This
         is used as a way to synchronize tasks. If a queue for a certain
         task type exists, then a task of that type is running.
         */
        delete sTaskQueues[task.type];
      } else {
        // dequeue the next task and start it
        if(sVL >= 1) {
          forge.log.verbose(cat,
            '[%s][%s] queue start next [%s] remain:%s',
            task.id, task.name, task.type,
            sTaskQueues[task.type].length);
        }
        sTaskQueues[task.type][0].start();
      }
    }

    if(!suppressCallbacks) {
      // call final callback if one exists
      if(task.error && task.failureCallback) {
        task.failureCallback(task);
      } else if(!task.error && task.successCallback) {
        task.successCallback(task);
      }
    }
  }
}