Gush\ThirdParty\Bitbucket\BitbucketIssueTracker::updateIssue PHP Метод

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

public updateIssue ( $id, array $parameters )
$parameters array
    public function updateIssue($id, array $parameters)
    {
        $response = $this->client->apiIssues()->get($this->getUsername(), $this->getRepository(), $id);
        $resultArray = json_decode($response->getContent(), true);
        $newParameters = ['responsible' => $resultArray['responsible']['username'], 'priority' => $resultArray['priority'], 'kind' => $resultArray['metadata']['kind'], 'version' => $resultArray['metadata']['version'], 'component' => $resultArray['metadata']['component']];
        if (isset($parameters['assignee'])) {
            $newParameters['responsible'] = $parameters['assignee'];
        }
        if (isset($parameters['status'])) {
            $newParameters['status'] = $parameters['status'];
        }
        if (isset($parameters['labels'])) {
            $validVersions = $this->getSupportedVersions();
            $validComponents = $this->getSupportedComponents();
            foreach ($parameters['labels'] as $label) {
                if (in_array($label, static::$validPriorities)) {
                    $newParameters['priority'] = $label;
                } elseif (in_array($label, static::$validKinds)) {
                    $newParameters['kind'] = $label;
                } elseif (in_array($label, $validVersions)) {
                    $newParameters['version'] = $label;
                } elseif (in_array($label, $validComponents)) {
                    $newParameters['component'] = $label;
                } else {
                    throw new \InvalidArgumentException(sprintf('Label "%s" for issues is not supported.', $label));
                }
            }
        }
        $this->client->apiIssues()->update($this->getUsername(), $this->getRepository(), $id, $this->prepareParameters($newParameters));
    }