<commit_before><?php

namespace Wnx\SwissCantons;

use Illuminate\Support\Collection;
use Exception;

class CantonManager
{
    /**
     * CantonSearch Instance
     * @var Wnx\SwissCantons\CantonSerach
     */
    protected $search;

    public function __construct()
    {
        $this->search = new CantonSearch;
    }

    public function getByAppreviation($abbreviation)
    {
        $result = $this->search->findByAppreviation($abbreviation);

        if (is_null($result)) {
            throw new Exception("Couldn't find Canton for appreviation");
        }

        return new Canton($result);
    }

    public function getByName($name)
    {
        $result = $this->search->findByName($name);

        if (is_null($result)) {
            throw new Exception("Couldn't find Canton for given Name {$name}");
        }

        return new Canton($result);
    }

}
<commit_msg>Add DocBlocks for CantonManager<commit_after><?php

namespace Wnx\SwissCantons;

use Exception;

class CantonManager
{
    /**
     * CantonSearch Instance
     * @var Wnx\SwissCantons\CantonSerach
     */
    protected $search;

    public function __construct()
    {
        $this->search = new CantonSearch;
    }

    /**
     * Get Canton by abbreviation
     * @param  string $abbreviation
     * @return Canton
     * @throws Exception Throws Exception if no Canton was found
     */
    public function getByAppreviation($abbreviation)
    {
        $result = $this->search->findByAppreviation($abbreviation);

        if (is_null($result)) {
            throw new Exception("Couldn't find Canton for given appreviation.");
        }

        return new Canton($result);
    }

    /**
     * Get Canton by Name
     * @param  string $name
     * @return Canton
     * @throws Exception Throws Exception if not Canton was found
     */
    public function getByName($name)
    {
        $result = $this->search->findByName($name);

        if (is_null($result)) {
            throw new Exception("Couldn't find Canton for given Name {$name}.");
        }

        return new Canton($result);
    }
}

{'fraction_non_alphanumeric': 0.11015736766809728, 'fraction_numerical': 0.0, 'mean_word_length': 2.372990353697749, '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': '4473422', 'n_tokens_mistral': 643, 'n_tokens_neox': 621, 'n_words': 152}