original_string: public function toArray($fetchType = Model::FETCH_ALL)
      {
          if ($fetchType === Model::FETCH_RAW) {
              return $this->attributes;
          }
  
          $attributes = array();
  
          if (empty($this->attributes)) {
              $this->attributes = array();
          }
  
          if ($fetchType === Model::FETCH_ALL or $fetchType === Model::FETCH_HIDDEN) {
              $attributes['$type'] = $this->getClass();
              $attributes['$id'] = $this->getId();
  
              foreach ($this->attributes as $key => $value) {
                  if ($key[0] === '$') {
                      $attributes[$key] = $value;
                  }
              }
          }
  
          if ($fetchType === Model::FETCH_ALL or $fetchType === Model::FETCH_PUBLISHED) {
              foreach ($this->attributes as $key => $value) {
                  if ($key[0] !== '$') {
                      $attributes[$key] = $value;
                  }
              }
          }
  
          return $attributes;
      }
code: public function toArray($fetchType = Model::FETCH_ALL)
      {
          if ($fetchType === Model::FETCH_RAW) {
              return $this->attributes;
          }
  
          $attributes = array();
  
          if (empty($this->attributes)) {
              $this->attributes = array();
          }
  
          if ($fetchType === Model::FETCH_ALL or $fetchType === Model::FETCH_HIDDEN) {
              $attributes['$type'] = $this->getClass();
              $attributes['$id'] = $this->getId();
  
              foreach ($this->attributes as $key => $value) {
                  if ($key[0] === '$') {
                      $attributes[$key] = $value;
                  }
              }
          }
  
          if ($fetchType === Model::FETCH_ALL or $fetchType === Model::FETCH_PUBLISHED) {
              foreach ($this->attributes as $key => $value) {
                  if ($key[0] !== '$') {
                      $attributes[$key] = $value;
                  }
              }
          }
  
          return $attributes;
      }
code_tokens: public function toArray ( $ fetchType = Model :: FETCH_ALL ) { if ( $ fetchType === Model :: FETCH_RAW ) { return $ this -> attributes ; } $ attributes = array ( ) ; if ( empty ( $ this -> attributes ) ) { $ this -> attributes = array ( ) ; } if ( $ fetchType === Model :: FETCH_ALL or $ fetchType === Model :: FETCH_HIDDEN ) { $ attributes [ '$type' ] = $ this -> getClass ( ) ; $ attributes [ '$id' ] = $ this -> getId ( ) ; foreach ( $ this -> attributes as $ key => $ value ) { if ( $ key [ 0 ] === '$' ) { $ attributes [ $ key ] = $ value ; } } } if ( $ fetchType === Model :: FETCH_ALL or $ fetchType === Model :: FETCH_PUBLISHED ) { foreach ( $ this -> attributes as $ key => $ value ) { if ( $ key [ 0 ] !== '$' ) { $ attributes [ $ key ] = $ value ; } } } return $ attributes ; }
docstring: Get array structure of model
  
  @param mixed $fetchType
  
  @return array
docstring_tokens: Get array structure of model