Pantheon\Terminus\Collections\Workflows::create PHP Метод

create() публичный Метод

Creates a new workflow and adds its data to the collection
public create ( string $type, array $options = [] ) : Workflow
$type string Type of workflow to create
$options array Additional information for the request, with the following possible keys: - environment: string - params: associative array of parameters for the request
Результат Workflow $model
    public function create($type, array $options = [])
    {
        $options = array_merge(['params' => []], $options);
        $params = array_merge($this->args, $options['params']);
        $results = $this->request()->request($this->getUrl(), ['method' => 'post', 'form_params' => ['type' => $type, 'params' => (object) $params]]);
        $model = $this->getContainer()->get($this->collected_class, [$results['data'], ['id' => $results['data']->id, 'collection' => $this]]);
        $this->add($model);
        return $model;
    }