<commit_before><?php
/**
 * Spiral Framework.
 *
 * @license   MIT
 * @author    <NAME> (Wolfy-J)
 */
namespace Spiral\Commands\Views;

use Spiral\Commands\Views\Helpers\ViewLocator;
use Spiral\Console\Command;
use Spiral\Console\ConsoleDispatcher;
use Spiral\Views\ViewManager;
use Symfony\Component\Console\Helper\FormatterHelper;

/**
 * Compile every available view file and store result in view cache.
 */
class CompileCommand extends Command
{
    /**
     * {@inheritdoc}
     */
    const NAME = 'views:compile';

    /**
     * {@inheritdoc}
     */
    const DESCRIPTION = 'Compile every available view file';

    /**
     * @param ViewLocator       $locator
     * @param ViewManager       $manager
     * @param ConsoleDispatcher $dispatcher
     */
    public function perform(
        ViewLocator $locator,
        ViewManager $manager,
        ConsoleDispatcher $dispatcher
    ) {
        //To clean up cache
        $dispatcher->command('views:reset', [], $this->output);

        if ($this->isVerbosity()) {
            $this->write("\n");
        }

        /**
         * @var FormatterHelper $formatter
         */
        $formatter = $this->getHelper('formatter');
        foreach ($locator->getNamespaces() as $namespace) {
            $this->isVerbosity() && $this->writeln(
                "Compiling views in namespace '<comment>{$namespace}</comment>'."
            );

            foreach ($locator->getViews($namespace) as $view => $engine) {
                if ($this->isVerbosity()) {
                    $this->write($formatter->formatSection(
                        "{$namespace}:{$engine}", $view . ", ", 'fg=cyan'
                    ));
                }

                $start = microtime(true);
                try {
                    //Compilation
                    $manager->engine($engine)->compile("{$namespace}:{$view}", true);

                    $this->isVerbosity() && $this->write("<info>ok</info>");
                } catch (\Exception $exception) {
                    if ($this->isVerbosity()) {
                        $this->write("<fg=red>error: {$exception->getMessage()}</fg=red>");
                    }
                } finally {
                    $elapsed = number_format((microtime(true) - $start) * 1000);
                    if ($this->isVerbosity()) {
                        $this->writeln(" <comment>[{$elapsed} ms]</comment> ");
                    }
                }
            }
        }

        $this->writeln("<info>View cache was successfully generated.</info>");
    }
}<commit_msg>stupd bug<commit_after><?php
/**
 * Spiral Framework.
 *
 * @license   MIT
 * @author    <NAME> (Wolfy-J)
 */
namespace Spiral\Commands\Views;

use Spiral\Commands\Views\Helpers\ViewLocator;
use Spiral\Console\Command;
use Spiral\Console\ConsoleDispatcher;
use Spiral\Views\ViewManager;
use Symfony\Component\Console\Helper\FormatterHelper;

/**
 * Compile every available view file and store result in view cache.
 */
class CompileCommand extends Command
{
    /**
     * {@inheritdoc}
     */
    const NAME = 'views:compile';

    /**
     * {@inheritdoc}
     */
    const DESCRIPTION = 'Compile every available view file';

    /**
     * @param ViewLocator       $locator
     * @param ViewManager       $manager
     * @param ConsoleDispatcher $dispatcher
     */
    public function perform(
        ViewLocator $locator,
        ViewManager $manager,
        ConsoleDispatcher $dispatcher
    ) {
        //To clean up cache
        $dispatcher->command('views:reset', [], $this->output);

        if ($this->isVerbosity()) {
            $this->write("\n");
        }

        /**
         * @var FormatterHelper $formatter
         */
        $formatter = $this->getHelper('formatter');
        foreach ($locator->getNamespaces() as $namespace) {
            $this->isVerbosity() && $this->writeln(
                "Compiling views in namespace '<comment>{$namespace}</comment>'."
            );

            foreach ($locator->getViews($namespace) as $view => $engine) {
                if ($this->isVerbosity()) {
                    $this->write($formatter->formatSection("{$engine}", $view . ", ", 'fg=cyan'));
                }

                $start = microtime(true);
                try {
                    //Compilation
                    $manager->engine($engine)->compile("{$namespace}:{$view}", true);

                    $this->isVerbosity() && $this->write("<info>ok</info>");
                } catch (\Exception $exception) {
                    if ($this->isVerbosity()) {
                        $this->write("<fg=red>error: {$exception->getMessage()}</fg=red>");
                    }
                } finally {
                    $elapsed = number_format((microtime(true) - $start) * 1000);
                    if ($this->isVerbosity()) {
                        $this->writeln(" <comment>[{$elapsed} ms]</comment> ");
                    }
                }
            }
        }

        $this->writeln("<info>View cache was successfully generated.</info>");
    }
}
{'fraction_non_alphanumeric': 0.15251231527093595, 'fraction_numerical': 0.0015763546798029558, 'mean_word_length': 1.7616974972796517, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 71, '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': '6337780', 'n_tokens_mistral': 1419, 'n_tokens_neox': 1333, 'n_words': 262}