<commit_before><?php declare(strict_types=1);

namespace Symplify\EasyCodingStandard\ChangedFilesDetector;

use Nette\Utils\Strings;
use Symfony\Component\Yaml\Yaml;

final class FileHashComputer
{
    public function compute(string $filePath): string
    {
        if (Strings::endsWith($filePath, '.yml')) {
            $loadedFileStructure = Yaml::parse(file_get_contents($filePath));

            return md5(serialize($loadedFileStructure));
        }

        return md5_file($filePath);
    }
}<commit_msg>FileHashComputer: compute changes with ContainerBuidler<commit_after><?php declare(strict_types=1);

namespace Symplify\EasyCodingStandard\ChangedFilesDetector;

use Nette\Utils\Strings;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symplify\EasyCodingStandard\DependencyInjection\Extension\CheckersExtension;

final class FileHashComputer
{
    public function compute(string $filePath): string
    {
        if (Strings::endsWith($filePath, '.yml')) {
            $containerBuilder = new ContainerBuilder();
            $containerBuilder->registerExtension(new CheckersExtension());

            $yamlFileLoader = new YamlFileLoader($containerBuilder, new FileLocator(dirname($filePath)));
            $yamlFileLoader->load($filePath);

            return md5(serialize($containerBuilder));
        }

        return md5_file($filePath);
    }
}
{'fraction_non_alphanumeric': 0.10579514824797843, 'fraction_numerical': 0.004043126684636119, 'mean_word_length': 4.32258064516129, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2408479', 'n_tokens_mistral': 415, 'n_tokens_neox': 399, 'n_words': 69}