Example #1
0
 /**
  * Parses, formats and prints the next chunk
  *
  * @since 1.0
  * @uses  Parser::parse()
  * @uses  printEvent()
  * @uses  printDelta()
  * @uses  printTrackHeader()
  * @uses  printFileHeader()
  * @uses  printEof()
  * @uses  printData()
  * 
  * @return bool true if there is more to parse, false if EOF has been reached
  */
 public function printNext()
 {
     $totalTime = microtime(true);
     $parseTime = $totalTime;
     $chunk = $this->parser->parse();
     $this->parseTime += microtime(true) - $parseTime;
     $notEof = true;
     if ($chunk !== null) {
         if ($chunk instanceof Delta) {
             $this->printDelta($chunk);
         } else {
             if ($chunk instanceof Event) {
                 $this->printEvent($chunk);
             } else {
                 if ($chunk instanceof TrackHeader) {
                     $this->printTrackHeader($chunk);
                 } else {
                     if ($chunk instanceof FileHeader) {
                         $this->printFileHeader($chunk);
                     }
                 }
             }
         }
     } else {
         $this->printEof();
         $notEof = false;
     }
     $this->totalTime += microtime(true) - $totalTime;
     return $notEof;
 }
Example #2
0
 /**
  * Constructor
  *
  * The parse state is initialized to {@link ParseState::FILE_HEADER}.
  *
  * @since 1.0
  * @uses  setState()
  * 
  * @param  TrackParser $trackParser
  */
 public function __construct(TrackParser $trackParser = null)
 {
     parent::__construct();
     $this->trackParser = $trackParser === null ? new TrackParser() : $trackParser;
     $this->tracksParsed = 0;
     $this->tracksExpected = 0;
     $this->setState(ParseState::FILE_HEADER);
 }
 /**
  * Constructor
  *
  * @since 1.0
  */
 public function __construct()
 {
     parent::__construct();
     $this->continuationEvent = null;
 }