<commit_before><?php

namespace Identificacion\Code;

use Identificacion\Exception\LengthException;

class DniCode
{
    private $code;

    public function __construct($code)
    {
        $this->setCode($code);
    }

    protected function setCode($code)
    {
        if (strlen($code) > 8) {
            throw new LengthException();
        }
        $this->code = str_pad($code, 8, "0", STR_PAD_LEFT);

        return $this;
    }

    public function __toString()
    {

        return $this->code;
    }


}<commit_msg>Refactor<commit_after><?php

namespace Identificacion\Code;

use Identificacion\Exception\LengthException;

class DniCode
{
    const LENGTH = 8;

    private $code;

    public function __construct($code)
    {
        $this->setCode($code);
    }

    protected function setCode($code)
    {
        if (self::LENGTH < strlen($code)) {
            throw new LengthException();
        }
        $this->code = str_pad($code, self::LENGTH, "0", STR_PAD_LEFT);

        return $this;
    }

    public function __toString()
    {

        return $this->code;
    }


}
{'fraction_non_alphanumeric': 0.12431444241316271, 'fraction_numerical': 0.004570383912248629, 'mean_word_length': 2.2981927710843375, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 10, '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': '2538185', 'n_tokens_mistral': 352, 'n_tokens_neox': 335, 'n_words': 71}