예제 #1
0
파일: Log.php 프로젝트: afosto/api-client
 /**
  * Return the log body
  * @return array
  */
 public function getBody()
 {
     $body = ApiHelper::toArray($this);
     if (isset($this->options['body'])) {
         return array_merge_recursive(['options' => ['raw_body' => $this->options['body']]], $body);
     }
     return $body;
 }
예제 #2
0
파일: Model.php 프로젝트: afosto/api-client
 /**
  * Return the attributes of this class in an assoc array
  * @return array
  */
 public function getBody()
 {
     $body = [];
     foreach ($this->_attributes as $key => $attribute) {
         if ($attribute instanceof ArrayList) {
             foreach ($attribute as $objectKey => $object) {
                 $body[$key][$objectKey] = $object->getBody();
             }
         } else {
             if ($attribute instanceof Link || $attribute instanceof Model) {
                 $body[$key] = $attribute->getBody();
             } else {
                 $body[$key] = ApiHelper::toArray($attribute);
             }
         }
     }
     return $body;
 }