original_string: public function walkParts( ezcMailPartWalkContext $context, ezcMailPart $mail )
      {
          $className = get_class( $mail );
          $context->level++;
          switch ( $className )
          {
              case 'ezcMail':
              case 'ezcMailComposer':
                  if ( $mail->body !== null )
                  {
                      $this->walkParts( $context, $mail->body );
                  }
                  break;
  
              case 'ezcMailMultipartMixed':
              case 'ezcMailMultipartAlternative':
              case 'ezcMailMultipartDigest':
              case 'ezcMailMultipartReport':
                  foreach ( $mail->getParts() as $part )
                  {
                      $this->walkParts( $context, $part );
                  }
                  break;
  
              case 'ezcMailMultipartRelated':
                  $this->walkParts( $context, $mail->getMainPart() );
                  foreach ( $mail->getRelatedParts() as $part )
                  {
                      $this->walkParts( $context, $part );
                  }
                  break;
  
              case 'ezcMailRfc822Digest':
                  if ( $context->includeDigests )
                  {
                      $this->walkParts( $context, $mail->mail );
                  }
                  elseif ( empty( $context->filter ) || in_array( $className, $context->filter ) )
                  {
                      call_user_func( $context->callbackFunction, $context, $mail );
                  }
                  break;
  
              case 'ezcMailText':
              case 'ezcMailFile':
              case 'ezcMailDeliveryStatus':
                  if ( empty( $context->filter ) || in_array( $className, $context->filter ) )
                  {
                      call_user_func( $context->callbackFunction, $context, $mail );
                  }
                  break;
  
              default:
                  // for cases where a custom mail class has been specified with $parser->options->mailClass
                  if ( in_array( 'ezcMail', class_parents( $className ) ) )
                  {
                      if ( $mail->body !== null )
                      {
                          $this->walkParts( $context, $mail->body );
                      }
                  }
  
                  // for cases where a custom file class has been specified with $parser->options->fileClass
                  if ( in_array( 'ezcMailFile', class_parents( $className ) ) )
                  {
                      if ( empty( $context->filter ) || in_array( $className, $context->filter ) )
                      {
                          call_user_func( $context->callbackFunction, $context, $mail );
                      }
                  }
          }
          $context->level--;
      }
code: public function walkParts( ezcMailPartWalkContext $context, ezcMailPart $mail )
      {
          $className = get_class( $mail );
          $context->level++;
          switch ( $className )
          {
              case 'ezcMail':
              case 'ezcMailComposer':
                  if ( $mail->body !== null )
                  {
                      $this->walkParts( $context, $mail->body );
                  }
                  break;
  
              case 'ezcMailMultipartMixed':
              case 'ezcMailMultipartAlternative':
              case 'ezcMailMultipartDigest':
              case 'ezcMailMultipartReport':
                  foreach ( $mail->getParts() as $part )
                  {
                      $this->walkParts( $context, $part );
                  }
                  break;
  
              case 'ezcMailMultipartRelated':
                  $this->walkParts( $context, $mail->getMainPart() );
                  foreach ( $mail->getRelatedParts() as $part )
                  {
                      $this->walkParts( $context, $part );
                  }
                  break;
  
              case 'ezcMailRfc822Digest':
                  if ( $context->includeDigests )
                  {
                      $this->walkParts( $context, $mail->mail );
                  }
                  elseif ( empty( $context->filter ) || in_array( $className, $context->filter ) )
                  {
                      call_user_func( $context->callbackFunction, $context, $mail );
                  }
                  break;
  
              case 'ezcMailText':
              case 'ezcMailFile':
              case 'ezcMailDeliveryStatus':
                  if ( empty( $context->filter ) || in_array( $className, $context->filter ) )
                  {
                      call_user_func( $context->callbackFunction, $context, $mail );
                  }
                  break;
  
              default:
                  // for cases where a custom mail class has been specified with $parser->options->mailClass
                  if ( in_array( 'ezcMail', class_parents( $className ) ) )
                  {
                      if ( $mail->body !== null )
                      {
                          $this->walkParts( $context, $mail->body );
                      }
                  }
  
                  // for cases where a custom file class has been specified with $parser->options->fileClass
                  if ( in_array( 'ezcMailFile', class_parents( $className ) ) )
                  {
                      if ( empty( $context->filter ) || in_array( $className, $context->filter ) )
                      {
                          call_user_func( $context->callbackFunction, $context, $mail );
                      }
                  }
          }
          $context->level--;
      }
code_tokens: public function walkParts ( ezcMailPartWalkContext $ context , ezcMailPart $ mail ) { $ className = get_class ( $ mail ) ; $ context -> level ++ ; switch ( $ className ) { case 'ezcMail' : case 'ezcMailComposer' : if ( $ mail -> body !== null ) { $ this -> walkParts ( $ context , $ mail -> body ) ; } break ; case 'ezcMailMultipartMixed' : case 'ezcMailMultipartAlternative' : case 'ezcMailMultipartDigest' : case 'ezcMailMultipartReport' : foreach ( $ mail -> getParts ( ) as $ part ) { $ this -> walkParts ( $ context , $ part ) ; } break ; case 'ezcMailMultipartRelated' : $ this -> walkParts ( $ context , $ mail -> getMainPart ( ) ) ; foreach ( $ mail -> getRelatedParts ( ) as $ part ) { $ this -> walkParts ( $ context , $ part ) ; } break ; case 'ezcMailRfc822Digest' : if ( $ context -> includeDigests ) { $ this -> walkParts ( $ context , $ mail -> mail ) ; } elseif ( empty ( $ context -> filter ) || in_array ( $ className , $ context -> filter ) ) { call_user_func ( $ context -> callbackFunction , $ context , $ mail ) ; } break ; case 'ezcMailText' : case 'ezcMailFile' : case 'ezcMailDeliveryStatus' : if ( empty ( $ context -> filter ) || in_array ( $ className , $ context -> filter ) ) { call_user_func ( $ context -> callbackFunction , $ context , $ mail ) ; } break ; default : // for cases where a custom mail class has been specified with $parser->options->mailClass if ( in_array ( 'ezcMail' , class_parents ( $ className ) ) ) { if ( $ mail -> body !== null ) { $ this -> walkParts ( $ context , $ mail -> body ) ; } } // for cases where a custom file class has been specified with $parser->options->fileClass if ( in_array ( 'ezcMailFile' , class_parents ( $ className ) ) ) { if ( empty ( $ context -> filter ) || in_array ( $ className , $ context -> filter ) ) { call_user_func ( $ context -> callbackFunction , $ context , $ mail ) ; } } } $ context -> level -- ; }
docstring: Walks recursively through the mail parts in the specified mail object.
  
  $context is an object of class ezcMailPartWalkContext, which must contain
  a valid callback function name to be applied to all mail parts. You can use
  the collectPart() method, or create your own callback function which can
  for example save the mail parts to disk or to a database.
  
  For the properties you can set to the walk context see: {@link ezcMailPartWalkContext}
  
  Example:
  <code>
  class App
  {
  public static function saveMailPart( $context, $mailPart )
  {
  // code to save the $mailPart object to disk
  }
  }
  
  // use the saveMailPart() function as a callback in walkParts()
  // where $mail is an ezcMail object.
  $context = new ezcMailPartWalkContext( array( 'App', 'saveMailPart' ) );
  $context->includeDigests = true; // if you want to go through the digests in the mail
  $mail->walkParts( $context, $mail );
  </code>
  
  @param ezcMailPartWalkContext $context
  @param ezcMailPart $mail
docstring_tokens: Walks recursively through the mail parts in the specified mail object .