<commit_before><?php

namespace AclBundle\Resource\Provider;

use AclBundle\Resource\ProviderInterface;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Yaml\Yaml;

class ConfigProvider implements ProviderInterface
{
    private $kernel;

    public function __construct(KernelInterface $kernel)
    {
        $this->kernel = $kernel;
    }

    public function resources()
    {
        // look in kernel directory
        $try = [$this->kernel->getRootDir() . '/Resources/config/acl_resources.yml'];
        // look in all bundles
        foreach ($this->kernel->getBundles() as $bundle) {
            $try[] = $bundle->getPath() . '/Resources/config/acl_resources.yml';
        }
        $resources = [];
        foreach ($try as $file) {
            if (!file_exists($file)) {
                continue;
            }
            $config = Yaml::parse(file_get_contents($file));
            if (!array_key_exists('resources', $config)) {
                throw new \RuntimeException("The acl file: {$file} is not valid acl resource file.");
            }
            $resources = array_merge($config['resources']);
        }
        return $resources;
    }
}<commit_msg>Resource config provider fix<commit_after><?php

namespace AclBundle\Resource\Provider;

use AclBundle\Resource\ProviderInterface;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Yaml\Yaml;

class ConfigProvider implements ProviderInterface
{
    private $kernel;

    public function __construct(KernelInterface $kernel)
    {
        $this->kernel = $kernel;
    }

    public function resources()
    {
        // look in kernel directory
        $try = [$this->kernel->getRootDir() . '/Resources/config/acl_resources.yml'];
        // look in all bundles
        foreach ($this->kernel->getBundles() as $bundle) {
            $try[] = $bundle->getPath() . '/Resources/config/acl_resources.yml';
        }

        $resources = [];
        foreach ($try as $file) {
            if (!file_exists($file)) {
                continue;
            }

            $config = Yaml::parse(file_get_contents($file));
            if(empty($config)) {
                continue;
            }

            if (!array_key_exists('resources', $config)) {
                throw new \RuntimeException("The acl file: {$file} is not valid acl resource file.");
            }
            if(empty($config['resources'])) {
                continue;
            }

            $resources = array_merge($resources, $config['resources']);
        }

        return $resources;
    }
}
{'fraction_non_alphanumeric': 0.12775842044134728, 'fraction_numerical': 0.0, 'mean_word_length': 2.1901234567901233, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '4620953', 'n_tokens_mistral': 702, 'n_tokens_neox': 677, 'n_words': 150}