public function testShouldHaveTheFirstErrorMessage()
 {
     $response = Response::create(HttpMethod::GET(), '1.2', true, HttpErrorCode::code412(), [Error::create('first error', 'Error'), Error::create('second error', 'Error')]);
     $this->assertSame('first error', $response->getErrorMessage()->getValue());
     $response = Response::create(HttpMethod::GET(), '1.2', true, HttpErrorCode::code412());
     $this->assertSame('', $response->getErrorMessage()->getValue());
 }
 /**
  * @param \stdClass $stdObj
  * @return ResponseInterface
  * @throws ResponseParserException
  */
 private function buildSuccessResponse(\stdClass $stdObj)
 {
     if (!isset($stdObj->data)) {
         throw new ResponseParserException('Data expected');
     }
     if (!is_array($stdObj->data->items)) {
         throw new ResponseParserException('Expected Data>Item array');
     }
     $data = new Data(new TypedCollection('\\stdClass', $stdObj->data->items));
     return Response::create($this->getHttpMethod($stdObj), $stdObj->apiVersion, false, null, null, $this->getParameters($stdObj), $data);
 }
 /**
  * @inheritdoc
  * @throws ResponseBuilderException
  */
 public function build()
 {
     $response = Response::create($this->getHttpMethod(), $this->getApiVersion(), true, $this->httpErrorCode, $this->errors, $this->getParameters(), new Data());
     return $this->getDataBuilder()->build($response);
 }
 /**
  * @inheritdoc
  */
 public function build()
 {
     $response = Response::create($this->getHttpMethod(), $this->getApiVersion(), false, null, null, $this->getParameters(), $this->data);
     return $this->getDataBuilder()->build($response);
 }
 /**
  * @return \stdClass
  */
 private function buildSuccess()
 {
     return (new SuccessDataBuilder())->build(Response::create($this->getHttpMethod(), $this->getApiVersion(), false, null, null, $this->getParameters(), $this->data));
 }