<commit_before><?php

namespace Imanghafoori\Widgets\Utils\Normalizers;

class TemplateNormalizer
{
    /**
     * Figures out which template to render.
     * @param $widget
     * @return null
     */
    public function normalizeTemplateName($widget)
    {
        // class name without namespace.
        $className = str_replace('App\\Widgets\\', '', get_class($widget));

        // replace slashes with dots
        $className = str_replace(['\\', '/'], '.', $className);

        if (! property_exists($widget, 'template')) {
            $widget->template = 'Widgets::'.$className.'View';
        }

        if (! view()->exists($widget->template)) {
            throw new \InvalidArgumentException("View file [{$className}View] not found by: '".get_class($widget)." '");
        }
    }
}<commit_msg>- minor bug fix<commit_after><?php

namespace Imanghafoori\Widgets\Utils\Normalizers;

class TemplateNormalizer
{
    /**
     * Figures out which template to render.
     * @param $widget
     * @return null
     */
    public function normalizeTemplateName($widget)
    {
        // class name without namespace.
        $className = str_replace('App\\Widgets\\', '', get_class($widget));

        // replace slashes with dots
        $className = str_replace(['\\', '/'], '.', $className);

        if (! property_exists($widget, 'template')) {
            $widget->template = 'Widgets::'.$className.'View';
        }

        if (! view()->exists($widget->template)) {
            throw new \InvalidArgumentException("View file \"{$widget->template}\" not found by: '".get_class($widget)." '");
        }
    }
}
{'fraction_non_alphanumeric': 0.16553846153846155, 'fraction_numerical': 0.0, 'mean_word_length': 2.5194805194805197, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2757026', 'n_tokens_mistral': 455, 'n_tokens_neox': 440, 'n_words': 99}