code: public function parse()
  	{
  		$handle = fopen($this->source_file, 'r');
  		$currentBlock = null;
  
  		// first, discover if we are header-less
  		while (!feof($handle)) {
  			$line = fgets($handle);
  			if (preg_match("/^msgid (.*?)$/us", $line, $match)) {
  				// initialize the parser, rewind and break
  				$currentBlock = $match[1] == '""' ? new HeaderBlock() : new Block();
  				rewind($handle);
  				break;
  			}
  		}
  
  		// run the actual parser
  		while (!feof($handle)) {
  			$line = fgets($handle);
  			if (trim($line) == '') {
  				if ($currentBlock) {
  					$this->addBlock($currentBlock);
  					$currentBlock = new Block();
  				}
  			} else {
  				$currentBlock->process($line);
  			}
  		}
  		fclose($handle);
  
  		if ($currentBlock && $currentBlock->isInitialized()) {
  			$this->addBlock($currentBlock);
  		}
  	}
docs: Parse a file into its individual subparts