<commit_before><?php
/**
 * DirectAdmin
 * (c) Omines Internetbureau B.V.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Omines\DirectAdmin\Objects;
use Omines\DirectAdmin\Context\UserContext;

/**
 * Domain
 *
 * @author <NAME> <<EMAIL>
 */
class Domain extends Object
{
    /** @var float */
    private $bandwidthUsed;

    /** @var float */
    private $bandwidthLimit;

    /** @var float */
    private $storageUsed;

    public function __construct($name, UserContext $context, $config = null)
    {
        parent::__construct($name, $context);
        $config = explode(':', $config);
        $this->bandwidthUsed = floatval($config[0]);
        $this->bandwidthLimit = ($config[1] === 'unlimited' ? null : floatval($config[1]));
        $this->storageUsed = floatval($config[2]);
    }

    public function getDomainName()
    {
        return $this->getName();
    }

    /**
     * @return float
     */
    public function getBandwidthUsed()
    {
        return $this->bandwidthUsed;
    }

    /**
     * @return float|null
     */
    public function getBandwidthLimit()
    {
        return $this->bandwidthLimit;
    }

    /**
     * @return float
     */
    public function getStorageUsed()
    {
        return $this->storageUsed;
    }
}<commit_msg>Domain config data changed to on-demand loading.<commit_after><?php
/**
 * DirectAdmin
 * (c) Omines Internetbureau B.V.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Omines\DirectAdmin\Objects;

use Omines\DirectAdmin\Context\UserContext;

/**
 * Domain
 *
 * @author <NAME> <<EMAIL>
 */
class Domain extends Object
{
    /** @var float */
    private $config;

    public function __construct($name, UserContext $context, $config = null)
    {
        parent::__construct($name, $context);
        if(is_string($config))
            $this->config = explode(':', $config);
        else
            $this->config = $config;
    }

    public function getDomainName()
    {
        return $this->getName();
    }

    /**
     * @return float
     */
    public function getBandwidthUsed()
    {
        return floatval($this->config[0]);
    }

    /**
     * @return float|null
     */
    public function getBandwidthLimit()
    {
        return ($this->config[1] === 'unlimited' ? null : floatval($this->config[1]));
    }

    /**
     * @return float
     */
    public function getStorageUsed()
    {
        return floatval($this->config[2]);
    }
}
{'fraction_non_alphanumeric': 0.14127951256664129, 'fraction_numerical': 0.0030464584920030465, 'mean_word_length': 2.456578947368421, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 21, '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': '2251463', 'n_tokens_mistral': 785, 'n_tokens_neox': 762, 'n_words': 188}