<?php

class ErrorReport
{
    private $error;
    
    
    public function __construct()
    {
        $this->error = array();
    }
    
    public function addError($qName, $msg, array $additionalData = NULL)
    {
       
        
        if(!is_null($additionalData))
        {
            $this->error[$qName][] = array_merge_recursive(array('msg' => $msg), $additionalData);
        }
        else
        {
            $this->error[$qName][] = array('msg' => $msg);
            
        }
    }
    
    public function toString()
    {
       
        //return var_export($this->error, TRUE); 
    }
    
    public function errorDump()
    {
        print "<pre>";
        var_dump($this->error);
        print "</pre>";
    }
}

?>