Пример #1
0
 /**
  * Create an issue
  *
  * @param JiraIssue|array $data
  * @param array $update
  * @return JiraIssue
  * @throws JiraApiResponseException
  */
 public function create($data, array $update = null)
 {
     $data = $this->prepareIssueUpdate($data, $update);
     $response = $this->client->post('/issue', $data);
     if (!$response->hasError()) {
         $issue = JiraIssue::createFromArray(array_merge($data, $response->getData()));
     } else {
         throw new JiraApiResponseException($response);
     }
     return $issue;
 }
Пример #2
0
 /**
  * @param JiraClientResponse $response
  */
 public function __construct(JiraClientResponse $response)
 {
     $data = $response->getData();
     $issues = array();
     if (!empty($data['issues'])) {
         foreach ($data['issues'] as $issueData) {
             $issues[] = JiraIssue::createFromArray($issueData);
         }
     }
     $this->issues = $issues;
     $this->total = isset($data['total']) ? (int) $data['total'] : 0;
     $this->expand = isset($data['expand']) ? explode(',', $data['expand']) : array();
     $this->maxResults = isset($data['maxResults']) ? (int) $data['maxResults'] : 0;
     $this->startAt = isset($data['startAt']) ? (int) $data['startAt'] : 0;
 }