<?php
class parser
{  
    private function ParseCustom($handle, $pattern)
    {
        if(preg_match_all("/$pattern/", $handle, $result, PREG_PATTERN_ORDER))  
        {
            return $result;       
        }    
    } 
    
    public function LoadParseFile($filename)
    {
        return @file_get_contents($filename);
    }
    
    public function ParseVar($handle)
    {
        return $this->ParseCustom($handle, "(.+)=(.+)\s");    
    }
    
    public function ParseValueOne($handle, $value)
    {
        $result = $this->ParseCustom($handle, "$value=(.+)\s"); 
        return substr($result[1][0], 0, -1);   
    }
    
    public function ParseValue($handle, $value)
    {
        return $this->ParseCustom($handle, "$value=(.+)\s");    
    }
    
    public function ParseKey($handle)
    {
        return $this->ParseCustom($handle, "(.+):(.+)\s");   
    }
}  
?>
