{@inheritdoc}

This implementation will call the protected method named: "create<TaskTypeName>" if it exists.

@throws \InvalidArgumentException For unsupported task types.
333015
public function createInstance($taskType, JsonArray $metaData)
    {
        $methodName = $this->methodNameFromType($taskType);
        if ($this->isTypeSupported($taskType)) {
            return call_user_func([$this, $methodName], $metaData);
        }

        throw new \InvalidArgumentException('Do not know how to create task ' . $taskType);
    }
722801
protected function add($task) {
		if (is_string($task)) {
			$task = new $task($this->_config);
		}

		$class = get_class($task);
		if (!$task instanceof AbstractTask) {
			throw new InvalidArgumentException(
				"Cannot use '$class' as task, it is not implementing " . AbstractTask::class . '.'
			);
		}

		$this->tasks[$class] = $task;

		return $this;
	}
781697
public function execute(InputInterface $input, OutputInterface $output)
    {
        $bundleName = $input->getArgument('bundle');
        $name = $input->getArgument('name');
        $fileType = $input->getOption('format');

        if ($bundleName == $this->thisBundle) {
            throw new \InvalidArgumentException("It is not allowed to create workflows in bundle '$bundleName'");
        }

        if (!in_array($fileType, $this->availableWorkflowFormats)) {
            throw new \InvalidArgumentException('Unsupported workflow file format ' . $fileType);
        }

        $workflowDirectory = $this->getWorkflowDirectory($bundleName);

        if (!is_dir($workflowDirectory)) {
            $output->writeln(sprintf(
                "Workflows directory <info>%s</info> does not exist. I will create it now....",
                $workflowDirectory
            ));

            if (mkdir($workflowDirectory, self::DIR_CREATE_PERMISSIONS, true)) {
                $output->writeln(sprintf(
                    "Workflows directory <info>%s</info> has been created",
                    $workflowDirectory
                ));
            } else {
                throw new FileException(sprintf(
                    "Failed to create workflows directory %s.",
                    $workflowDirectory
                ));
            }
        }

        $date = date('YmdHis');

        if ($name == '') {
            $name = 'placeholder';
        }
        $fileName = $date . '_' . $name . '.' . $fileType;

        $path = $workflowDirectory . '/' . $fileName;

        $warning = $this->generateWorkflowFile($path, $fileType);

        $output->writeln(sprintf("Generated new workflow file: <info>%s</info>", $path));

        if ($warning != '') {
            $output->writeln("<comment>$warning</comment>");
        }
    }
1370147
public static function create($parameters)
    {
        if (is_string($parameters)) {
            return self::fromString($parameters);
        }

        if (is_array($parameters)) {
            return self::fromArray($parameters);
        }

        throw new InvalidArgumentException('Invalid parameters type');
    }
383221
public function add($child, $type, array $execOptions = array(), array $initOptions = array())
    {
        if (!is_string($child) && !is_int($child)) {
            throw new \InvalidArgumentException(sprintf('child name should be string or, integer'));
        }

        if (null !== $type && !is_string($type) && !$type instanceof JobTypeinterface) {
            throw new \InvalidArgumentException('type should be string or JobTypeinterface');
        }

        $this->children[$child] = null; // to keep order
        $this->unresolvedChildren[$child] = array(
            'type' => $type,
            'init_options' => $initOptions,
            'exec_options' => $execOptions
        );

        return $this;
    }
777725
private function setupTemplateEngine()
    {
        if (!isset($this->options[self::OPTION_TYPE])) {
            throw new InvalidArgumentException(
                'Cannot setup template engine. Option "' . self::OPTION_TYPE . '" is required.'
            );
        }

        $this->templateEngine = $this->createTemplateEngine($this->options[self::OPTION_TYPE], $this->options);
        $this->setupExtensionAdapter();
    }
683138
protected function scheduleTask(TaskInterface $task)
    {
        if (null !== ($execution = $this->taskExecutionRepository->findPending($task))) {
            return;
        }

        if ($task->getInterval() === null && 0 < count($this->taskExecutionRepository->findByTask($task))) {
            return;
        }

        $scheduleTime = $task->getInterval() ? $task->getInterval()->getNextRunDate() : $task->getFirstExecution();
        $execution = $this->taskExecutionRepository->create($task, $scheduleTime);
        $execution->setStatus(TaskStatus::PLANNED);

        $this->eventDispatcher->dispatch(
            Events::TASK_EXECUTION_CREATE,
            new TaskExecutionEvent($task, $execution)
        );

        $this->taskExecutionRepository->save($execution);
    }
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;
    }
275328
private function protect()
    {
        if (!in_array($this->certificateType, self::allAsString(), true)) {
            throw new \InvalidArgumentException(sprintf('Invalid certificate type %s', $this->certificateType));
        }
    }
561933
public function addTask(Task $t)
    {
        if ($this->nestedTask !== null) {
            throw new BuildException(
                'The retry task container accepts a single nested task'
                . ' (which may be a sequential task container)'
            );
        }
        $this->nestedTask = $t;
    }
238964
protected function createTask()
    {
        $task = \call_user_func_array(['parent', 'task'], \func_get_args());
        $task->setInput($this->input());
        $task->setOutput($this->output());

        return $task;
    }
338697
private function _getCreateTaskTemplateContext(TaskTemplate $taskTemplate)
    {
        $result = new HttpCallContext();
        $result->setMethod(Resources::HTTP_POST);
        $result->setHeaders($this->_batchHeaders);
        $result->setUri($this->getUri());
        $result->setPath('/$1/TaskTemplates');
        $result->setBody($this->wrapAtomEntry($taskTemplate));
        $result->addStatusCode(Resources::STATUS_CREATED);

        return $result;
    }
883103
@SuppressWarnings("static-method")
	protected <T> Callable<T> createTask(Callable<T> callable) {
		if (callable instanceof JanusCallable<?>) {
			return callable;
		}
		return new JanusCallable<>(callable);
	}
807431
public static <Result> TaskBuilder<Result> create(TaskCallback<Result> callback) {
        return new TaskBuilder<Result>().callback(callback);
    }
1209594
public function createNew()
    {
        $resource = $this->traitCreateNew();

        if (!$resource instanceof TranslatableInterface) {
            throw new \InvalidArgumentException('Resource must implement TranslatableInterface.');
        }

        $resource->setCurrentLocale($this->localeProvider->getCurrentLocale());
        $resource->setFallbackLocale($this->localeProvider->getFallbackLocale());

        return $resource;
    }
80699
static function ByCreationMethod($name)
    {
        $enumClass = new \ReflectionClass(get_class());
        $calledClass = get_called_class();
        $reflectionClass = new \ReflectionClass($calledClass);
        $methods = $reflectionClass->getMethods(\ReflectionMethod::IS_STATIC);
        foreach ($methods as $method)
        {
            if ($method->name != $name)
                continue;
            
            if ($method->isPublic() && $method->getNumberOfParameters() == 0)
            {
                if (!$enumClass->hasMethod($method->name))
                {
                    $result = $method->invoke(null);
                    if (get_class($result) == $calledClass)
                        return $result;
                }
            }
        }
        throw new \InvalidArgumentException("'Creation method '$name' not found");
    }
855179
public function create($rowOrName, $type = null, array $data = [])
    {
        // Check if row or name is defined
        if (!(
            $rowOrName instanceof Model\RowInterface ||
            (is_string($rowOrName) && 0 < strlen($rowOrName))
        )
        ) {
            throw new InvalidOperationException("Excepted instance of RowInterface or string.");
        }

        // Default type if null
        if (null === $type) {
            $type = $this->defaultType;
        }

        // New instance
        $block = $this->editor->getRepository()->createBlock();
        $block->setType($type);

        // Layout creation
//        $this->editor->getLayoutAdapter()->createBlock($block, $data);

        // Plugin creation
        $this->editor->getBlockPlugin($type)->create($block, $data);

        // Add to row if available
        if ($rowOrName instanceof Model\RowInterface) {
            $count = $rowOrName->getBlocks()->count();
            $block
                ->setPosition($count);

            $rowOrName->addBlock($block);
        } else {
            $block->setName($rowOrName);
        }

        return $block;
    }