<commit_before><?php

namespace Blazon\Model;

use InvalidArgumentException;

class Document
{
    private $path = null;

    public function __construct(string $path, $handler)
    {
        if ($path[0]!='/') {
            throw new InvalidArgumentException("Invalid document path. Should start with a slash: " . $path);
        }
        if ((substr($path, -1, 1)=='/') && ($path != '/')) {
            throw new InvalidArgumentException("Invalid document path. No trailing slash allowed: " . $path);
        }
        $this->path = $path;
        $this->handler = $handler;
    }

    public function getPath(): string
    {
        return $this->path;
    }

    public function getHandler()
    {
        return $this->handler;
    }
}<commit_msg>feat: support data on documents<commit_after><?php

namespace Blazon\Model;

use InvalidArgumentException;

class Document
{
    private $path = null;

    public function __construct(string $path, $handler, array $data = [])
    {
        if ($path[0]!='/') {
            throw new InvalidArgumentException("Invalid document path. Should start with a slash: " . $path);
        }
        if ((substr($path, -1, 1)=='/') && ($path != '/')) {
            throw new InvalidArgumentException("Invalid document path. No trailing slash allowed: " . $path);
        }
        $this->path = $path;
        $this->handler = $handler;
        $this->data = $data;
    }

    public function getPath(): string
    {
        return $this->path;
    }

    public function getHandler()
    {
        return $this->handler;
    }

    public function getData(): array
    {
        return $this->data;
    }
}
{'fraction_non_alphanumeric': 0.14129775621588841, 'fraction_numerical': 0.0036385688295936932, 'mean_word_length': 2.280318091451292, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '5249750', 'n_tokens_mistral': 481, 'n_tokens_neox': 460, 'n_words': 130}