Create a task instance from the given task name

@param string $taskName
@return \TYPO3\Surf\Domain\Model\Task
@throws \TYPO3\Surf\Exception\InvalidConfigurationException
433992
protected function createTaskInstance($taskName)
    {
        $taskClassName = $this->mapTaskNameToTaskClass($taskName);
        $task = new $taskClassName();
        if ($task instanceof ShellCommandServiceAwareInterface) {
            $task->setShellCommandService(new ShellCommandService());
        }
        return $task;
    }
460317
public function runTaskNow($taskName)
    {
        $tasks = $this->loader->loadTasks();

        foreach ($tasks as $task) {
            if ($task->getName() === $taskName) {
                return $this->executeTask($task);
            }
        }

        throw new \InvalidArgumentException('Task ' . $taskName . ' not found');
    }
199588
private function getTableTaskInfo($taskName)
    {
        $table = TableManager::getInstance()->get(self::$__swooleTableName);
        if ($table) {
            if ($table->exist($taskName)) {
                return $table->get($taskName);
            } else {
                throw new CronTaskNotExist($taskName);
            }
        } else {
            throw new \Exception('Crontab tasks have not yet started!');
        }
    }
824524
public function setTask(Task $task = null)
    {
        $this->task = $task;
        if (null !== $task) {
            $task->addComment($this);
        }

        return $this;
    }
409525
public function getConfigurationOptions($configurationName)
    {
        if (!array_key_exists($configurationName, $this->configurations)) {
            $errMsg = sprintf('Invalid configuration name %s', $configurationName);
            throw new Exception\InvalidConfigurationNameException($errMsg);
        }

        return new ConfigurationOptions($this->configurations[$configurationName]);
    }
683638
public function create($name)
    {
        $this->checkName($name);

        $configuration = new Configuration();

        $configuration->setName($name);

        $configuration->setModel($this->getParameter($name, 'model'));
        $configuration->setForm($this->getParameter($name, 'form'));
        $configuration->setFormTemplate($this->getParameter($name, 'template.form'));
        $configuration->setRecipientTemplate($this->getParameter($name, 'template.recipient'));
        $configuration->setRecipient($this->getParameter($name, 'recipient'));
        $configuration->setConfirmTemplate($this->getParameter($name, 'template.confirm'));
        $configuration->setPageTemplate($this->getParameter($name, 'template.page'));
        $configuration->setFrom($this->getParameter($name, 'from'));
        $configuration->setSenderName($this->getParameter($name, 'sender_name'));
        $configuration->setSubject($this->getParameter($name, 'subject'));
        $configuration->setTranslationDomain($this->getParameter($name, 'translation_domain'));
        $configuration->setConfirmMail($this->getParameter($name, 'confirm_mail'));

        return $configuration;
    }
392254
public function defineTask($taskName, $baseTask, $options)
    {
        $this->tasks['defined'][$taskName] = [
            'task' => $baseTask,
            'options' => $options
        ];
        return $this;
    }
252034
public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
    {
        try {
            $className = $this->getFormaterIndex($serviceLocator)[$this->removeTermination($requestedName)];
            $reflectionClass = new \ReflectionClass($className);
            $instance = $reflectionClass->newInstance();
        } catch (\Exception $e) {
            throw new ProcessException($reflectionClass, $e->getCode(), $e);
        }
        
        return $instance;
    }
588532
public function get($name)
    {
        $names = explode(self::SEPARATOR, $name);
        $method = array_pop($names);
        if ($names) {
            $class_name = 'Task\\' . join('\\', array_map('ucfirst', $names)) . 'TaskList';
        } else {
            $class_name = 'Task\\TaskList';
        }
        $class_path = $this->loader->getPathByClass($class_name, false);
        if ($class_path === null || ! $class_path->isExists()) throw new NotFoundException("No such task. -> {$name}");

        require_once $class_path;
        $class_name = $class_path->getClassName();
        $taskList = new $class_name();
        $taskList->setOutput($this->output);
        $taskList->setContainer($this->raikiri());
        if (! $taskList->has($method)) throw new NotImplementsException("No such task. -> {$name}");

        return $taskList->get($method);
    }
981260
public function createTask($taskType)
    {
        try {
            $classname = "";
            $tasklwr = strtolower($taskType);
            foreach ($this->taskdefs as $name => $class) {
                if (strtolower($name) === $tasklwr) {
                    $classname = $class;
                    break;
                }
            }

            if ($classname === "") {
                return null;
            }

            $o = $this->createObject($classname);

            if ($o instanceof Task) {
                $task = $o;
            } else {
                $this->project->log("  (Using TaskAdapter for: $taskType)", Project::MSG_DEBUG);
                // not a real task, try adapter
                $taskA = new TaskAdapter();
                $taskA->setProxy($o);
                $task = $taskA;
            }
            $task->setProject($this->project);
            $task->setTaskType($taskType);
            // set default value, can be changed by the user
            $task->setTaskName($taskType);
            $this->project->log("  +Task: " . $taskType, Project::MSG_DEBUG);
        } catch (Exception $t) {
            throw new BuildException("Could not create task of type: " . $taskType, $t);
        }
        // everything fine return reference
        return $task;
    }
395686
public function execute(AbstractTask $task, $parameters = array()) {

        $this->task = $task;

        $this->loadHtml($this->obtainHtml($parameters));

        $ignore_rules = $task->getIgnoreRules();

        foreach ($ignore_rules as $rule) {
            $this->useIgnoreRule($rule);
        }

        $class = $task->getClassName();

        $entity = new $class;

        $task->setEntity($entity);

        $rules = $task->getParseRules();

        foreach ($rules as $rule) {
            $this->useParseRule($rule, $entity);
        }
        return $entity;
    }
340810
public function configureWorkflow($workflowName)
    {
        $this->workflowName = $workflowName;

        $this->workflow = $this->container->getParameter('free_agent_workflow.workflows.'.$this->workflowName, null);

        if (is_null($this->workflow)) {
            throw new WorkflowException('The workflow "'.$this->workflowName.'" does not exist');
        }

        $defaultStep = $this->workflow['default_step'];
        if (!array_key_exists($defaultStep, $this->workflow['steps'])) {
            throw new WorkflowException('The default step of "'.$this->workflowName.'" does not exist');
        }

        foreach ($this->workflow['steps'] as $stepName => $stepConfiguration) {
            $this->steps->offsetSet($stepName, new Step($stepName, $stepConfiguration));
        }

        $this->defaultStep = new Step($defaultStep, $this->workflow['steps'][$defaultStep]);
        $this->actions     = array_key_exists('actions', $this->workflow) ? $this->workflow['actions'] : array();
        $this->validations = array_key_exists('validations', $this->workflow) ? $this->workflow['validations'] : array();

        return $this->getSteps();
    }
839538
protected function createInstance($className, $name)
    {
        $formConfiguration = $this->typoScriptService->getFormConfiguration($className);

        /** @var FormObject $instance */
        $instance = Core::instantiate(FormObject::class, $className, $name, $formConfiguration);

        $this->insertObjectProperties($instance);

        $instance->getHash();

        return $instance;
    }
190968
public static function create($strategyName): StrategyInterface
    {
        if ($strategyName instanceof StrategyInterface) {
            return $strategyName;
        }

        if (\is_callable($strategyName)) {
            return new CallbackStrategy($strategyName);
        }

        if (\is_string($strategyName)) {
            $requiredInterface = StrategyInterface::class;
            $predefinedStrategy = '\\Elastica\\Connection\\Strategy\\'.$strategyName;

            if (\class_exists($predefinedStrategy) && \class_implements($predefinedStrategy, $requiredInterface)) {
                return new $predefinedStrategy();
            }

            if (\class_exists($strategyName) && \class_implements($strategyName, $requiredInterface)) {
                return new $strategyName();
            }
        }

        throw new InvalidException('Can\'t create strategy instance by given argument');
    }
213110
public function createTask($name) {
    $this->init();
    $class = Code::expandNamespace(\Webforge\Common\String::expand($name, 'Task'), 'Psc\System\Deploy');
    
    $gClass = GClass::factory($class);
    $params = array();
    if ($gClass->hasMethod('__construct')) {
      $constructor = $gClass->getMethod('__construct');
      foreach ($constructor->getParameters() as $parameter) {
        $params[] = $this->resolveTaskDependency($parameter, $gClass);
      }
    }
    
    return $gClass->newInstance($params);
  }
1257704
private function createTaskFromMetaData(JsonArray $config)
    {
        $typeName = $config->get(Task::SETTING_TYPE);
        if ($this->factory->isTypeSupported($typeName)) {
            return $this->factory->createInstance($typeName, $config);
        }

        return null;
    }
422299
public function load($pathname)
    {
        if (empty($pathname)) {
            throw new ConfigurationException('Configuration file pathname cannot be empty.');
        }

        $config = $this->getMergedConfig($pathname);

        return $this->processConfiguration($config, $pathname);
    }