original_string: protected function updateCollection(){
          $responseBody = $this->Response->getBody();
          if (is_array($responseBody)){
              if (isset($this->model)){
                  $modelIdKey = $this->buildModel()->modelIdKey();
                  foreach($responseBody as $key => $model){
                      if (isset($model[$modelIdKey])){
                          $this->collection[$model[$modelIdKey]] = $model;
                      } else {
                          $this->collection[] = $model;
                      }
                  }
              } else {
                  $this->collection = $responseBody;
              }
          }
      }
code: protected function updateCollection(){
          $responseBody = $this->Response->getBody();
          if (is_array($responseBody)){
              if (isset($this->model)){
                  $modelIdKey = $this->buildModel()->modelIdKey();
                  foreach($responseBody as $key => $model){
                      if (isset($model[$modelIdKey])){
                          $this->collection[$model[$modelIdKey]] = $model;
                      } else {
                          $this->collection[] = $model;
                      }
                  }
              } else {
                  $this->collection = $responseBody;
              }
          }
      }
code_tokens: protected function updateCollection ( ) { $ responseBody = $ this -> Response -> getBody ( ) ; if ( is_array ( $ responseBody ) ) { if ( isset ( $ this -> model ) ) { $ modelIdKey = $ this -> buildModel ( ) -> modelIdKey ( ) ; foreach ( $ responseBody as $ key => $ model ) { if ( isset ( $ model [ $ modelIdKey ] ) ) { $ this -> collection [ $ model [ $ modelIdKey ] ] = $ model ; } else { $ this -> collection [ ] = $ model ; } } } else { $ this -> collection = $ responseBody ; } } }
docstring: Configures the collection based on the Response Body
docstring_tokens: Configures the collection based on the Response Body