<commit_before><?php

namespace YMLParser;

class YMLParser
{

    /**
     * Driver for parsing xml
     * 
     * @var Driver\DriverInterface 
     */
    private $driver;

    /**
     * Curent curency
     * 
     * @var type 
     */
    private $currency;

    /**
     * Last error code
     * 
     * @var int 
     */
    private $errorCode = 0;


    const ERROR_FILE_DOESNT_EXIST   = 1;
    const ERROR_INVALID_XML         = 2;

    public function __construct(Driver\DriverInterface $driver) {
        $this->driver = $driver;
    }

    /**
     * Sets default currency
     * 
     * @param string $currency
     * @return void
     */
    public function setDefaultCurrency($currency)
    {
        $this->currency = $currency;
    }

    /**
     * Sets error
     * 
     * @param int $errorCode
     * $return void
     */
    private function setError($errorCode)
    {
        $this->errorCode = $errorCode;
    }

    /**
     * Gets error code
     * 
     * @return int
     */
    public function getErrorCode()
    {
        return $this->errorCode;
    }

    /**
     * Checks for last occured error
     * 
     * @return boolean
     */
    public function hasError()
    {
        return ($this->errorCode === 0) ? false : true;
    }
    
    /**
     * Unsest error
     * 
     * @return void
     */
    private function unsetError()
    {
        $this->errorCode = 0;
    }

    /**
     * Opeтs and creates XML DOM tree
     * 
     * Sets error for YMLParser if cannot open file or xml is invalid
     * 
     * @param string $file Path to file
     * @return boolean
     */
    public function open($file) {

        $returnValue = true;

        if(!file_exists($file)):
            $returnValue = false;
            $this->setError(self::ERROR_FILE_DOESNT_EXIST);            
        endif;

        // TODO Check for valid xml

        return $returnValue;

    }
}<commit_msg>Remove error handling. Change open() method argument<commit_after><?php

namespace YMLParser;

class YMLParser
{

    /**
     * Driver for parsing xml
     * 
     * @var Driver\DriverInterface 
     */
    private $driver;

    /**
     * Curent curency
     * 
     * @var string 
     */
    private $defaultCurrency;


    const ERROR_FILE_DOESNT_EXIST   = 1;
    const ERROR_INVALID_XML         = 2;

    public function __construct(Driver\DriverInterface $driver) {
        $this->driver = $driver;
    }

    /**
     * Sets default currency
     * 
     * @param string $currency
     * @return void
     */
    public function setDefaultCurrency($currency)
    {
        $this->defaultCurrency = $currency;
    }

    /**
     * Opeтs and creates XML DOM tree
     * 
     * Sets error for YMLParser if cannot open file or xml is invalid
     * 
     * @param string $filename Path to file
     * @throws \Exception Throws exception if file doesn't exist or its size = 0
     * @return boolean
     */
    public function open($filename) {

        if(!file_exists($filename) or filesize($filename) === 0):
            throw new \Exception("File: {$filename} does not exist or empty.");       
        endif;

        return $this->driver->open($file);;

    }
    
    
    public function __call($name, $arguments)
    {
        return $this->driver->$name($arguments);
    }
}
{'fraction_non_alphanumeric': 0.10818978543366577, 'fraction_numerical': 0.0027198549410698096, 'mean_word_length': 1.731023102310231, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 5}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2438067', 'n_tokens_mistral': 1015, 'n_tokens_neox': 959, 'n_words': 256}