Exemplo n.º 1
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;
 }
 public function __construct(JiraClientResponse $response, $message = "", $code = 0, \Exception $previous = null)
 {
     $request = $response->getRequest();
     $url = $request->getUrl();
     $statusCode = $response->getStatusCode();
     $customMessage = $message;
     $message = 'Request to path ' . $request->getPath() . ' failed with code ' . $statusCode . ' (URL: ' . $url . ')! ';
     $errorMessages = $response->getErrorMessages();
     if ($errorMessages) {
         $message .= implode("! ", $errorMessages) . '! ';
     }
     if ($customMessage) {
         $message .= $customMessage;
     }
     parent::__construct($message, $code, $previous);
 }