<commit_before><?php

namespace Irain\ExportExcel;

use PhpOffice\PhpSpreadsheet\Settings;
use RuntimeException;

class Import
{
    private $config;

    private $resource;

    private $cacheDriver;
    
    private $writer;
    
    /**
     * Export constructor.
     *
     * @param array $config
     *
     */
        public function __construct($config)
        {
            if (!empty($config)) {
                $this->setConfig($config);
            }
            $this->writer       = new Writer;
 
            if (!empty($this->config['cache_driver'])) {
                $this->cacheDriver  = (new CacheDriver())->setCacheDriver($this->config['cache_driver']);
            }
 
            if (!empty($this->cacheDriver)) {
                Settings::setCache(/** @scrutinizer ignore-type */$this->cacheDriver);
            }
        }

    /**
     * set config
     *
     * @param array $config
     */

    public function setConfig($config)
    {
        if (empty($config)) {
            throw new RuntimeException('Config Can Not Empty.');
        }
        $this->config = $config;
    }

    /**
     * Set table header
     *
     * @param array $header
     *
     * @return $this
     * @throws \Exception
     */
    public function header($header)
    {
        if (empty($header)) {
            throw new RuntimeException('Table header can not empty.');
        }

        $this->config['table_header'] = $header;

        return $this;
    }

    /**
     * Set file name
     *
     * @param string $resource resource name
     *
     * @return $this
     * @throws \Exception
     */
    public function setResource($resource)
    {
        if (empty($resource)) {
            throw new RuntimeException('Resouce file name can not empty.');
        }
        $this->resource = $resource;
        return $this;
    }
    

    /**
     * Set file name
     *
     * @return mixed resouce to array
     */
    public function resourceToArray()
    {
            return  $this->writer
                ->setConfig($this->config)
                ->setResource($this->resource)
                ->resourceToArray();
    }
}<commit_msg>Scrutinizer Auto-Fixes<commit_after><?php

namespace Irain\ExportExcel;

use PhpOffice\PhpSpreadsheet\Settings;
use RuntimeException;

class Import
{
    private $config;

    private $resource;

    private $cacheDriver;
    
    private $writer;
    
    /**
     * Export constructor.
     *
     * @param array $config
     *
     */
        public function __construct($config)
        {
            if (!empty($config)) {
                $this->setConfig($config);
            }
            $this->writer = new Writer;
 
            if (!empty($this->config['cache_driver'])) {
                $this->cacheDriver = (new CacheDriver())->setCacheDriver($this->config['cache_driver']);
            }
 
            if (!empty($this->cacheDriver)) {
                Settings::setCache(/** @scrutinizer ignore-type */$this->cacheDriver);
            }
        }

    /**
     * set config
     *
     * @param array $config
     */

    public function setConfig($config)
    {
        if (empty($config)) {
            throw new RuntimeException('Config Can Not Empty.');
        }
        $this->config = $config;
    }

    /**
     * Set table header
     *
     * @param array $header
     *
     * @return $this
     * @throws \Exception
     */
    public function header($header)
    {
        if (empty($header)) {
            throw new RuntimeException('Table header can not empty.');
        }

        $this->config['table_header'] = $header;

        return $this;
    }

    /**
     * Set file name
     *
     * @param string $resource resource name
     *
     * @return $this
     * @throws \Exception
     */
    public function setResource($resource)
    {
        if (empty($resource)) {
            throw new RuntimeException('Resouce file name can not empty.');
        }
        $this->resource = $resource;
        return $this;
    }
    

    /**
     * Set file name
     *
     * @return mixed resouce to array
     */
    public function resourceToArray()
    {
            return  $this->writer
                ->setConfig($this->config)
                ->setResource($this->resource)
                ->resourceToArray();
    }
}
{'fraction_non_alphanumeric': 0.12806855025474756, 'fraction_numerical': 0.0, 'mean_word_length': 1.6144067796610169, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '6561578', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1174, 'n_words': 263}