예제 #1
0
 /**
  * Set response body
  *
  * @param mixed $body Response body
  * @return void
  * @throws InvalidResponseException
  */
 public function setBody($body)
 {
     if (!$this->checkFixedArray($body, 2) || !is_numeric($body[0]) || !is_array($body[1])) {
         throw new InvalidResponseException($this->command, $body);
     }
     parent::setBody($body);
 }
예제 #2
0
 /**
  * Set response body
  *
  * @param mixed $body Response body
  * @return void
  * @throws InvalidResponseException
  */
 public function setBody($body)
 {
     if (!$this->checkFixedArray($body, 3, true)) {
         throw new InvalidResponseException($this->command, $body);
     }
     foreach (array_slice($body, 2) as $node) {
         if (!$this->checkFixedArray($node, 4)) {
             throw new InvalidResponseException($this->command, $body);
         }
     }
     parent::setBody($body);
 }
예제 #3
0
 /**
  * Set response body
  *
  * @param mixed $body Response body
  * @return void
  * @throws InvalidResponseException
  */
 public function setBody($body)
 {
     if (is_null($body)) {
         $body = [];
     }
     if (!is_array($body)) {
         throw new InvalidResponseException($this->command, $body);
     }
     $totalJobDetails = count($this->jobDetails);
     foreach ($body as $job) {
         if (!$this->checkFixedArray($job, $totalJobDetails)) {
             throw new InvalidResponseException($this->command, $body);
         }
         $id = $totalJobDetails > 2 ? $job[1] : $job[0];
         if (strpos($id, 'DI') !== 0 || strlen($id) < 10) {
             throw new InvalidResponseException($this->command, $body);
         }
     }
     parent::setBody($body);
 }
예제 #4
0
 /**
  * @inheritdoc
  */
 public function setBody($body)
 {
     if (is_null($body)) {
         $body = [];
     }
     if (!is_array($body)) {
         throw new InvalidResponseException($this->command, $body);
     }
     $jobDetailCount = count($this->jobDetails);
     foreach ($body as $job) {
         if (!$this->checkFixedArray($job, $jobDetailCount)) {
             throw new InvalidResponseException($this->command, $body);
         }
         $idPosition = array_search(self::KEY_ID, $this->jobDetails);
         $id = $job[$idPosition];
         if (strpos($id, 'DI') !== 0 || strlen($id) < 10) {
             throw new InvalidResponseException($this->command, $body);
         }
     }
     parent::setBody($body);
 }