Create task template from array.

@param array $options Array containing values for object properties

@return TaskTemplate
15925
public static function createFromOptions(array $options)
    {
        Validate::notNull(
            $options['NumberofInputAssets'],
            'options[NumberofInputAssets]'
        );
        Validate::notNull(
            $options['NumberofOutputAssets'],
            'options[NumberofOutputAssets]'
        );

        $taskTemplate = new self(
            $options['NumberofInputAssets'],
            $options['NumberofOutputAssets']
        );
        $taskTemplate->fromArray($options);

        return $taskTemplate;
    }
261314
public function createJobTemplate(JobTemplate $jobTemplate, array $taskTemplates)
    {
        $batch = new BatchRequest();
        $batch->appendContext(
            $this->_getCreateEmptyJobTemplateContext($jobTemplate)
        );

        if ($taskTemplates != null) {
            foreach ($taskTemplates as $taskTemplate) {
                $batch->appendContext(
                    $this->_getCreateTaskTemplateContext($taskTemplate)
                );
            }
        }

        $batch->encode();

        $method = Resources::HTTP_POST;
        $headers = $batch->getHeaders();
        $postParams = [];
        $queryParams = [];
        $path = '$batch';
        $statusCode = Resources::STATUS_ACCEPTED;
        $body = $batch->getBody();

        $response = $this->sendHttp(
            $method,
            $headers,
            $queryParams,
            $postParams,
            $path,
            $statusCode,
            $body
        );

        $responses = (new BatchResponse($response, $batch))->getResponses();
        $jobTemplateResponse = $responses[0];

        $entry = new Entry();
        $entry->parseXml($jobTemplateResponse->getBody());
        $properties = $this->getPropertiesFromAtomEntry($entry);

        return JobTemplate::createFromOptions($properties);
    }
990940
public static function create(array $options): Token
    {
        $token = new self($options);
        $token->token = $token->generate();

        return $token;
    }
1360287
protected function _groupTemplate($options)
    {
        $groupTemplate = $options['options']['type'] . 'FormGroup';
        if (!$this->templater()->get($groupTemplate)) {
            $groupTemplate = 'formGroup';
        }

        return $this->formatTemplate($groupTemplate, [
            'input' => isset($options['input']) ? $options['input'] : [],
            'label' => $options['label'],
            'error' => $options['error'],
            'templateVars' => isset($options['options']['templateVars']) ? $options['options']['templateVars'] : []
        ]);
    }
733657
public function createOrder(array $options)
    {
        $pay = new Order($this->config->get());
        return $pay->create($options);
    }
429039
public function make($name, $options)
    {
        if (!$name || !is_string($name)) {
            return null;
        }

        if (isset($this->objTemplates[$name])) {
            return clone $this->objTemplates[$name];
        }

        if (!$this->namespaceTransformer) {
            $this->namespaceTransformer = $this->objTemplates[self::NAMESPACE_TRANSFORMER] = new PrependNamespace();
        }

        $className = $this->namespaceTransformer->transform($name, ['namespace' => __NAMESPACE__]);

        if (!class_exists($className, true)) {
            return null;
        }

        $this->objTemplates[$name] = new $className();

        return clone $this->objTemplates[$name];
    }
83453
public static function createCustom($options)
    {
        // unpack optional arguments (merging with default values) into named variables
        // NOTE: the default value of stylesheet=null will not pass validation, this essentially
        //       means that stylesheet is not optional. its still purposely left as part of the
        //       $options argument so that it can become truly optional in the future.
        $defaults = array('stylesheet' => null);
        $options = array_merge($defaults, array_intersect_key($options, $defaults));
        list($stylesheet) = array_values($options);

        // validate arguments
        Validators::validateLayoutStylesheet($stylesheet);

        return new Layout('custom', $stylesheet);
    }
426649
public function fromArray($options)
    {
        if (!empty($options['AccessControl'])) {
            Validate::isArray($options['AccessControl'], 'options[AccessControl]');
            $this->_accessControl = ChannelPreviewAccessControl::createFromOptions($options['AccessControl']);
        }

        if (!empty($options['Endpoints'])) {
            Validate::isArray($options['Endpoints'], 'options[Endpoints]');
            foreach ($options['Endpoints'] as $endpoint) {
                $this->_endpoints[] = ChannelEndpoint::createFromOptions($endpoint);
            }
        }
    }
359974
public function createStructure(array $options): ItemInterface
    {
        /** @var ItemInterface|ItemInterface[] $menu */
        $menu = $this->factory->createItem('root');

        $menu->setChildren([
            self::ITEM__CREATE => $this->createMenuItem(
                self::ITEM__CREATE,
                [
                    'attributes' => [
                        'class' => 'btn--trigger',
                        'data-click' => '#ezrepoforms_user_create_create',
                    ],
                    'extras' => ['icon' => 'publish'],
                ]
            ),
            self::ITEM__CANCEL => $this->createMenuItem(
                self::ITEM__CANCEL,
                [
                    'attributes' => [
                        'class' => 'btn--trigger',
                        'data-click' => '#ezrepoforms_user_create_cancel',
                    ],
                    'extras' => ['icon' => 'circle-close'],
                ]
            ),
        ]);

        return $menu;
    }
1054481
public function generate($options = array()) {
		
		// double-checks options was properly set
		if (empty($options)) {
			Console::writeError("need to pass options to generate...");
		}
		
		// set the default vars
		$moveStatic    = (isset($options["moveStatic"]))    ? $options["moveStatic"] : true;
		$noCacheBuster = (isset($options["noCacheBuster"])) ? $options["noCacheBuster"] : false;
		$exportFiles   = (isset($options["exportFiles"]))   ? $options["exportFiles"] : false;
		$exportClean   = (isset($options["exportClean"]))   ? $options["exportClean"] : false;
		$watchMessage  = (isset($options["watchMessage"]))  ? $options["watchMessage"] : false;
		$watchVerbose  = (isset($options["watchVerbose"]))  ? $options["watchVerbose"] : false;
		
		if ($noCacheBuster) {
			Config::setOption("cacheBuster",0);
		}
		
		// gather up all of the data to be used in patterns
		Data::gather();
		
		// gather all of the various pattern info
		$options = array();
		$options["exportClean"] = $exportClean;
		$options["exportFiles"] = $exportFiles;
		PatternData::gather($options);
		
		// gather the annotations
		Annotations::gather();
		
		// clean the public directory to remove old files
		if ((Config::getOption("cleanPublic") == "true") && $moveStatic) {
			FileUtil::cleanPublic();
		}
		
		// render out the index and style guide
		$this->generateIndex();
		$this->generateStyleguide();
		$this->generateViewAllPages();
		
		// render out the patterns and move them to public/patterns
		$options = array();
		$options["exportFiles"] = $exportFiles;
		$this->generatePatterns($options);
		
		// render the annotations as a js file
		$this->generateAnnotations();
		
		// move all of the files unless pattern only is set
		if ($moveStatic) {
			$this->moveStatic();
		}
		
		// update the change time so the auto-reload will fire (doesn't work for the index and style guide)
		Util::updateChangeTime();
		
		if ($watchVerbose && $watchMessage) {
			Console::writeLine($watchMessage);
		} else {
			Console::writeLine("your site has been generated...");
			Timer::stop();
		}
		
	}
1206798
public function createFromSymlink($options = [
    'project-dir' => self::BLT_PROJECT_DIR,
    'vm' => TRUE,
  ]) {
    $test_project_dir = $this->bltRoot . "/" . $options['project-dir'];
    $bin = $test_project_dir . "/vendor/bin";
    $this->prepareTestProjectDir($test_project_dir);
    $this->taskFilesystemStack()
      ->mkdir($test_project_dir)
      ->copy($this->bltRoot . '/subtree-splits/blt-project/composer.json', $test_project_dir . '/composer.json')
      ->run();

    $template_composer_json_filepath = $test_project_dir . '/composer.json';
    $template_composer_json = json_decode(file_get_contents($template_composer_json_filepath));
    $template_composer_json->repositories->blt = [
      'type' => 'path',
      'url' => '../blt',
      'options' => [
        'symlink' => TRUE,
      ],
    ];
    $template_composer_json->require->{'acquia/blt'} = '*@dev';

    file_put_contents($template_composer_json_filepath, json_encode($template_composer_json, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));

    $this->taskExecStack()
      ->dir($test_project_dir)
      ->exec("git init")
      ->exec("git add -A")
      ->exec("git commit -m \"Initial commit.\"")
      ->run();
    if (!$options['vm']) {
      $this->taskReplaceInFile($test_project_dir . "/composer.json")
        ->from("../blt")
        ->to($this->bltRoot)
        ->run();
    }
    $task = $this->taskExecStack()
      ->dir($test_project_dir)
      // BLT is the only dependency at this point. Install it.
      ->exec("composer install");

    if ($options['vm']) {
      $task->exec("$bin/blt vm --no-boot --no-interaction -v")
        ->exec("$bin/yaml-cli update:value box/config.yml vagrant_synced_folders.1.local_path '../blt'")
        ->exec("$bin/yaml-cli update:value box/config.yml vagrant_synced_folders.1.destination '/var/www/blt'")
        ->exec("$bin/yaml-cli update:value box/config.yml vagrant_synced_folders.1.type nfs");
    }
    $task->run();
  }
966833
public function serialize(Template $template, array $options = [])
    {
        $serialized = [
            'id' => $template->getUuid(),
            'name' => $template->getName(),
            'type' => $this->serializer->serialize($template->getType()),
            'title' => $template->getTitle(),
            'content' => $template->getContent(),
            'lang' => $template->getLang(),
            'localized' => $this->serializeLocalized($template),
        ];

        return $serialized;
    }
432291
public function template($type, $options) {
		if (isset($options[$type])) {
			return $options[$type];
		}
		return isset($options['template']) ? $options['template'] : '';
	}
262287
public function precompile($template, $options = [])
    {
        if ($this->isRuntime) {
            throw new \BadMethodCallException("Cannot precompile templates using runtime");
        }

        $this->v8->template = $template;
        $this->v8->options = $options;
        return $this->v8->executeString(
            'jsHb.precompile(phpHb.template, phpHb.options)',
            __CLASS__ . '::' . __METHOD__ . '()'
        );
    }
1001632
public function getTaskTemplateList(array $queryParams = [])
    {
        $propertyList = $this->_getEntityList('TaskTemplates', $queryParams);
        $result = [];

        foreach ($propertyList as $properties) {
            $result[] = TaskTemplate::createFromOptions($properties);
        }

        return $result;
    }
261773
public function createOptions(Array $options) {

		$this->options = [];

		foreach($options as $k => $v) {
			$this->appendOption(new SelectOptionElement($k, $v, $this));
		}

		$this->setValue();

		return $this;

	}
354116
public function fromArray(array $options)
    {
        if (isset($options['Id'])) {
            Validate::isString($options['Id'], 'options[Id]');
            $this->_id = $options['Id'];
        }

        if (isset($options['Name'])) {
            Validate::isString($options['Name'], 'options[Name]');
            $this->_name = $options['Name'];
        }

        if (isset($options['ExpirationDateTime'])) {
            Validate::isDateString(
                $options['ExpirationDateTime'],
                'options[ExpirationDateTime]'
            );
            $this->_expirationDateTime = new \DateTime(
                $options['ExpirationDateTime']
            );
        }

        if (isset($options['Type'])) {
            Validate::isInteger($options['Type'], 'options[Type]');
            $this->_type = $options['Type'];
        }

        if (isset($options['Path'])) {
            Validate::isValidUri($options['Path'], 'options[Path]');
            $this->_path = $options['Path'];
        }

        if (isset($options['BaseUri'])) {
            Validate::isValidUri($options['BaseUri'], 'options[BaseUri]');
            $this->_baseUri = $options['BaseUri'];
        }

        if (isset($options['ContentAccessComponent'])) {
            Validate::isString(
                $options['ContentAccessComponent'],
                'options[ContentAccessComponent]'
            );
            $this->_contentAccessComponent = $options['ContentAccessComponent'];
        }

        if (isset($options['AccessPolicyId'])) {
            Validate::isString(
                $options['AccessPolicyId'],
                'options[AccessPolicyId]'
            );
            $this->_accessPolicyId = $options['AccessPolicyId'];
        }

        if (isset($options['AssetId'])) {
            Validate::isString($options['AssetId'], 'options[AssetId]');
            $this->_assetId = $options['AssetId'];
        }

        if (isset($options['StartTime'])) {
            Validate::isDateString($options['StartTime'], 'options[StartTime]');
            $this->_startTime = new \DateTime($options['StartTime']);
        }
    }