original_string: public function parseBody( $origLine )
      {
          if ( $this->parserState == self::PARSE_STATE_POST_LAST )
          {
              return;
          }
  
          $line = rtrim( $origLine, "\r\n" );
  
          // check if we hit any of the boundaries
          $newPart = false;
          $endOfMultipart = false;
          if ( strlen( $line ) > 0 && $line[0] == "-" )
          {
              if ( strcmp( trim( $line ), '--' . $this->boundary ) === 0 )
              {
                  $newPart = true;
              }
              else if ( strcmp( trim( $line ), '--' . $this->boundary . '--' ) === 0 )
              {
                  $endOfMultipart = true;
              }
          }
  
          // actions to do when starting or finishing a part
          if ( $newPart || $endOfMultipart )
          {
              if ( $this->parserState != self::PARSE_STATE_BODY )
              {
                  // something is b0rked, we got a new separator before getting a body
                  // we'll skip this part and continue to the next
                  $this->currentPartParser = null;
                  $this->currentPartHeaders = new ezcMailHeadersHolder();
                  $this->parserState = $newPart ? self::PARSE_STATE_HEADERS : self::PARSE_STATE_POST_LAST;
              }
              else
              {
                  // complete the work on the current part if there was any
                  if ( $this->currentPartParser !== null )
                  {
                      $part = $this->currentPartParser->finish();
                      if ( $part !== null ) // parsing failed
                      {
                          $this->partDone( $part );
                      }
                  }
  
                  // prepare for a new part if any
                  $this->currentPartParser = null;
                  $this->parserState =self::PARSE_STATE_POST_LAST;
                  if ( $newPart )
                  {
                      $this->parserState = self::PARSE_STATE_HEADERS;
                      $this->currentPartHeaders = new ezcMailHeadersHolder();
                  }
              }
          }
          // normal data, pass to headers or current body
          else
          {
              if ( $this->parserState == self::PARSE_STATE_HEADERS && $line == '' )
              {
                  $this->currentPartParser = self::createPartParserForHeaders( $this->currentPartHeaders );
                  $this->parserState = self::PARSE_STATE_BODY;
              }
              else if ( $this->parserState == self::PARSE_STATE_HEADERS )
              {
                  $this->parseHeader( $line, $this->currentPartHeaders );
              }
              else if ( $this->parserState == self::PARSE_STATE_BODY )
              {
                  if ( $this->currentPartParser ) // we may have none if the part type was unknown
                  {
                      // send body data to the part
                      $this->currentPartParser->parseBody( $origLine );
                  }
              }
              // we are done parsing the multipart, ignore anything else pushed to us.
          }
      }
code: public function parseBody( $origLine )
      {
          if ( $this->parserState == self::PARSE_STATE_POST_LAST )
          {
              return;
          }
  
          $line = rtrim( $origLine, "\r\n" );
  
          // check if we hit any of the boundaries
          $newPart = false;
          $endOfMultipart = false;
          if ( strlen( $line ) > 0 && $line[0] == "-" )
          {
              if ( strcmp( trim( $line ), '--' . $this->boundary ) === 0 )
              {
                  $newPart = true;
              }
              else if ( strcmp( trim( $line ), '--' . $this->boundary . '--' ) === 0 )
              {
                  $endOfMultipart = true;
              }
          }
  
          // actions to do when starting or finishing a part
          if ( $newPart || $endOfMultipart )
          {
              if ( $this->parserState != self::PARSE_STATE_BODY )
              {
                  // something is b0rked, we got a new separator before getting a body
                  // we'll skip this part and continue to the next
                  $this->currentPartParser = null;
                  $this->currentPartHeaders = new ezcMailHeadersHolder();
                  $this->parserState = $newPart ? self::PARSE_STATE_HEADERS : self::PARSE_STATE_POST_LAST;
              }
              else
              {
                  // complete the work on the current part if there was any
                  if ( $this->currentPartParser !== null )
                  {
                      $part = $this->currentPartParser->finish();
                      if ( $part !== null ) // parsing failed
                      {
                          $this->partDone( $part );
                      }
                  }
  
                  // prepare for a new part if any
                  $this->currentPartParser = null;
                  $this->parserState =self::PARSE_STATE_POST_LAST;
                  if ( $newPart )
                  {
                      $this->parserState = self::PARSE_STATE_HEADERS;
                      $this->currentPartHeaders = new ezcMailHeadersHolder();
                  }
              }
          }
          // normal data, pass to headers or current body
          else
          {
              if ( $this->parserState == self::PARSE_STATE_HEADERS && $line == '' )
              {
                  $this->currentPartParser = self::createPartParserForHeaders( $this->currentPartHeaders );
                  $this->parserState = self::PARSE_STATE_BODY;
              }
              else if ( $this->parserState == self::PARSE_STATE_HEADERS )
              {
                  $this->parseHeader( $line, $this->currentPartHeaders );
              }
              else if ( $this->parserState == self::PARSE_STATE_BODY )
              {
                  if ( $this->currentPartParser ) // we may have none if the part type was unknown
                  {
                      // send body data to the part
                      $this->currentPartParser->parseBody( $origLine );
                  }
              }
              // we are done parsing the multipart, ignore anything else pushed to us.
          }
      }
code_tokens: public function parseBody ( $ origLine ) { if ( $ this -> parserState == self :: PARSE_STATE_POST_LAST ) { return ; } $ line = rtrim ( $ origLine , "\r\n" ) ; // check if we hit any of the boundaries $ newPart = false ; $ endOfMultipart = false ; if ( strlen ( $ line ) > 0 && $ line [ 0 ] == "-" ) { if ( strcmp ( trim ( $ line ) , '--' . $ this -> boundary ) === 0 ) { $ newPart = true ; } else if ( strcmp ( trim ( $ line ) , '--' . $ this -> boundary . '--' ) === 0 ) { $ endOfMultipart = true ; } } // actions to do when starting or finishing a part if ( $ newPart || $ endOfMultipart ) { if ( $ this -> parserState != self :: PARSE_STATE_BODY ) { // something is b0rked, we got a new separator before getting a body // we'll skip this part and continue to the next $ this -> currentPartParser = null ; $ this -> currentPartHeaders = new ezcMailHeadersHolder ( ) ; $ this -> parserState = $ newPart ? self :: PARSE_STATE_HEADERS : self :: PARSE_STATE_POST_LAST ; } else { // complete the work on the current part if there was any if ( $ this -> currentPartParser !== null ) { $ part = $ this -> currentPartParser -> finish ( ) ; if ( $ part !== null ) // parsing failed { $ this -> partDone ( $ part ) ; } } // prepare for a new part if any $ this -> currentPartParser = null ; $ this -> parserState = self :: PARSE_STATE_POST_LAST ; if ( $ newPart ) { $ this -> parserState = self :: PARSE_STATE_HEADERS ; $ this -> currentPartHeaders = new ezcMailHeadersHolder ( ) ; } } } // normal data, pass to headers or current body else { if ( $ this -> parserState == self :: PARSE_STATE_HEADERS && $ line == '' ) { $ this -> currentPartParser = self :: createPartParserForHeaders ( $ this -> currentPartHeaders ) ; $ this -> parserState = self :: PARSE_STATE_BODY ; } else if ( $ this -> parserState == self :: PARSE_STATE_HEADERS ) { $ this -> parseHeader ( $ line , $ this -> currentPartHeaders ) ; } else if ( $ this -> parserState == self :: PARSE_STATE_BODY ) { if ( $ this -> currentPartParser ) // we may have none if the part type was unknown { // send body data to the part $ this -> currentPartParser -> parseBody ( $ origLine ) ; } } // we are done parsing the multipart, ignore anything else pushed to us. } }
docstring: Parses a multipart body.
  
  @throws ezcBaseFileNotFoundException
  if a neccessary temporary file could not be opened.
  @param string $origLine
docstring_tokens: Parses a multipart body .