original_string: protected function transformToArray(array $presentation)
      {
          $array = [];
  
          // iterate over all the presentation values and search for arrays and
          // for the nested special entities, Presentation and Hidden objects
          // and handle each entity in the appropriate way.
          foreach ($presentation as $key => $item) {
  
              // in case of an array recursively iterate over all the array
              // value and check for special entities.
              if(is_array($item)) {
                  $array[$key] = $this->transformToArray($item);
              }
  
              // if we find an hidden entity ignore the key so it won't be shown in the
              // final presentation then continue to the next item in the presentation
              else if($item instanceof Hidden) {
                  continue;
              }
  
              // if an item is a presentation object run the show function on it to transform
              // the resource presentation tree and save the presentation on the array.
              else if($item instanceof Presentation) {
                  $array[$key] = $item->show();
              }
  
              // on any other value we just save the value and key and move on
              // to the next item.
              else {
                  $array[$key] = $item;
              }
          }
  
          return $array;
      }
code: protected function transformToArray(array $presentation)
      {
          $array = [];
  
          // iterate over all the presentation values and search for arrays and
          // for the nested special entities, Presentation and Hidden objects
          // and handle each entity in the appropriate way.
          foreach ($presentation as $key => $item) {
  
              // in case of an array recursively iterate over all the array
              // value and check for special entities.
              if(is_array($item)) {
                  $array[$key] = $this->transformToArray($item);
              }
  
              // if we find an hidden entity ignore the key so it won't be shown in the
              // final presentation then continue to the next item in the presentation
              else if($item instanceof Hidden) {
                  continue;
              }
  
              // if an item is a presentation object run the show function on it to transform
              // the resource presentation tree and save the presentation on the array.
              else if($item instanceof Presentation) {
                  $array[$key] = $item->show();
              }
  
              // on any other value we just save the value and key and move on
              // to the next item.
              else {
                  $array[$key] = $item;
              }
          }
  
          return $array;
      }
code_tokens: protected function transformToArray ( array $ presentation ) { $ array = [ ] ; // iterate over all the presentation values and search for arrays and // for the nested special entities, Presentation and Hidden objects // and handle each entity in the appropriate way. foreach ( $ presentation as $ key => $ item ) { // in case of an array recursively iterate over all the array // value and check for special entities. if ( is_array ( $ item ) ) { $ array [ $ key ] = $ this -> transformToArray ( $ item ) ; } // if we find an hidden entity ignore the key so it won't be shown in the // final presentation then continue to the next item in the presentation else if ( $ item instanceof Hidden ) { continue ; } // if an item is a presentation object run the show function on it to transform // the resource presentation tree and save the presentation on the array. else if ( $ item instanceof Presentation ) { $ array [ $ key ] = $ item -> show ( ) ; } // on any other value we just save the value and key and move on // to the next item. else { $ array [ $ key ] = $ item ; } } return $ array ; }
docstring: Transform a presentation to an array.
  
  @param array $presentation
  @return array
docstring_tokens: Transform a presentation to an array .