<commit_before><?php

namespace Probuild;

use \Symfony\Component\Yaml\Yaml;

class Config
{

    const TARGET_DIR = 'target-dir';
    const CLEAN = 'clean';
    const CLEAN_EXCEPTIONS = 'clean-exceptions';
    const LINK_DIR_PATHS = 'link-dir-paths';
    const COPY_DIR_PATHS = 'copy-dir-paths';
    const COMPOSER = 'composer';
    const COMPOSER_UPDATE = 'update';
    const COMPOSER_NO_DEV = 'no-dev';
    const POST_COMPOSER_DIR_PATHS = 'post-composer-dir-paths';
    const GRUNT = 'grunt';
    const GRUNT_TASKS = 'grunt-tasks';

    /** @var array */
    protected $data;

    /**
     * @param string $file
     * @author C<NAME> <<EMAIL>>
     */
    public function __construct($file)
    {
        $this->load($file);
    }

    /**
     * @param string $file
     * @return array
     * @throws \Exception
     * @author <NAME> <<EMAIL>>
     */
    public function load($file)
    {
        $this->data = $this->read($file);
        $this->validate();
    }

    /**
     * @return string
     * @author <NAME> <<EMAIL>>
     */
    public function getTargetDirectory()
    {
        return $this->data[self::TARGET_DIR];
    }

    /**
     * @return bool
     * @author <NAME> <<EMAIL>>
     */
    public function shouldCleanTargetDirectory()
    {
        return array_key_exists(self::CLEAN, $this->data) && $this->data[self::CLEAN] == true;
    }

    /**
     * @return array
     * @author <NAME> <<EMAIL>>
     */
    public function getCleanExceptions()
    {
        return $this->getDataArrayFromConfig(self::CLEAN_EXCEPTIONS);
    }

    /**
     * @return array
     * @author <NAME> <<EMAIL>>
     */
    public function getLinkDirectoryPaths()
    {
        return $this->data[self::LINK_DIR_PATHS];
    }

    /**
     * @return array
     * @author <NAME> <<EMAIL>>
     */
    public function getCopyDirectoryPaths()
    {
        return $this->data[self::COPY_DIR_PATHS];
    }

    /**
     * @return bool
     * @author <NAME> <<EMAIL>>
     */
    public function shouldRunComposer()
    {
        return $this->isOptionTrueInConfig(self::COMPOSER);
    }

    /**
     * @return bool
     * @author <NAME> <<EMAIL>>
     */<commit_msg>Get links and copy arrays from config as arrays.<commit_after><?php

namespace Probuild;

use \Symfony\Component\Yaml\Yaml;

class Config
{

    const TARGET_DIR = 'target-dir';
    const CLEAN = 'clean';
    const CLEAN_EXCEPTIONS = 'clean-exceptions';
    const LINK_DIR_PATHS = 'link-dir-paths';
    const COPY_DIR_PATHS = 'copy-dir-paths';
    const COMPOSER = 'composer';
    const COMPOSER_UPDATE = 'update';
    const COMPOSER_NO_DEV = 'no-dev';
    const POST_COMPOSER_DIR_PATHS = 'post-composer-dir-paths';
    const GRUNT = 'grunt';
    const GRUNT_TASKS = 'grunt-tasks';

    /** @var array */
    protected $data;

    /**
     * @param string $file
     * @author <NAME> <<EMAIL>>
     */
    public function __construct($file)
    {
        $this->load($file);
    }

    /**
     * @param string $file
     * @return array
     * @throws \Exception
     * @author <NAME> <<EMAIL>>
     */
    public function load($file)
    {
        $this->data = $this->read($file);
        $this->validate();
    }

    /**
     * @return string
     * @author <NAME> <<EMAIL>>
     */
    public function getTargetDirectory()
    {
        return $this->data[self::TARGET_DIR];
    }

    /**
     * @return bool
     * @author <NAME> <<EMAIL>>
     */
    public function shouldCleanTargetDirectory()
    {
        return array_key_exists(self::CLEAN, $this->data) && $this->data[self::CLEAN] == true;
    }

    /**
     * @return array
     * @author <NAME> <<EMAIL>>
     */
    public function getCleanExceptions()
    {
        return $this->getDataArrayFromConfig(self::CLEAN_EXCEPTIONS);
    }

    /**
     * @return array
     * @author <NAME> <<EMAIL>>
     */
    public function getLinkDirectoryPaths()
    {
        return $this->getDataArrayFromConfig(self::LINK_DIR_PATHS);
    }

    /**
     * @return array
     * @author <NAME> <<EMAIL>>
     */
    public function getCopyDirectoryPaths()
    {
        return $this->getDataArrayFromConfig(self::COPY_DIR_PATHS);
    }

    /**
     * @return bool
     * @author <NAME> <<EMAIL>>
     */
    public function shouldRunComposer()
    {
        return $this->isOptionTrueInConfig(self::COMPOSER);
    }

    /**
     * @return bool
     * @author <NAME> <<EMAIL>>
     */
{'fraction_non_alphanumeric': 0.1520163117353874, 'fraction_numerical': 0.0, 'mean_word_length': 2.27037037037037, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 79, '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': '1272312', 'n_tokens_mistral': 1468, 'n_tokens_neox': 1445, 'n_words': 284}