<commit_before><?php

namespace Helldar\Sitemap\Services;

use Helldar\Sitemap\Exceptions\SitemapManualUrlException;
use Helldar\Sitemap\Exceptions\ValidatorException;
use Illuminate\Validation\Rule;

class Manual
{
    /**
     * @var array
     */
    private $items = [];

    /**
     * Manual constructor.
     *
     * @param array $items
     */
    public function __construct($items = [])
    {
        if (!$this->validate(compact('items'))) {
            throw new SitemapManualUrlException();
        }

        $this->items = $items;
    }

    /**
     * @return array
     */
    public function get()
    {
        return $this->items;
    }

    /**
     * @param $data
     *
     * @return bool
     */
    private function validate($data)
    {
        $validator = \Validator::make($data, $this->rules());

        if ($validator->fails()) {
            throw new ValidatorException($validator->errors()->first());
        }

        return true;
    }

    /**
     * @return array
     */
    private function rules()
    {
        return [
            'items' => ['required', 'array', 'min:1', 'max:50000'],
            'items.*.loc' => ['required', 'url', 'max:255'],
            'items.*.changefreq' => ['string', 'max:20', Rule::in('always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never')],
            'items.*.lastmod' => ['date'],
            'items.*.priority' => ['numeric'],
        ];
    }
}
<commit_msg>Apply fixes from StyleCI<commit_after><?php

namespace Helldar\Sitemap\Services;

use Helldar\Sitemap\Exceptions\SitemapManualUrlException;
use Helldar\Sitemap\Exceptions\ValidatorException;
use Illuminate\Validation\Rule;

class Manual
{
    /**
     * @var array
     */
    private $items = [];

    /**
     * Manual constructor.
     *
     * @param array $items
     */
    public function __construct($items = [])
    {
        if (!$this->validate(compact('items'))) {
            throw new SitemapManualUrlException();
        }

        $this->items = $items;
    }

    /**
     * @return array
     */
    public function get()
    {
        return $this->items;
    }

    /**
     * @param $data
     *
     * @return bool
     */
    private function validate($data)
    {
        $validator = \Validator::make($data, $this->rules());

        if ($validator->fails()) {
            throw new ValidatorException($validator->errors()->first());
        }

        return true;
    }

    /**
     * @return array
     */
    private function rules()
    {
        return [
            'items'              => ['required', 'array', 'min:1', 'max:50000'],
            'items.*.loc'        => ['required', 'url', 'max:255'],
            'items.*.changefreq' => ['string', 'max:20', Rule::in('always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never')],
            'items.*.lastmod'    => ['date'],
            'items.*.priority'   => ['numeric'],
        ];
    }
}

{'fraction_non_alphanumeric': 0.17767188563648742, 'fraction_numerical': 0.007488087134104833, 'mean_word_length': 1.959718026183283, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '3914352', 'n_tokens_mistral': 920, 'n_tokens_neox': 898, 'n_words': 169}