<commit_before><?php
/*
 * WellCommerce Open-Source E-Commerce Platform
 *
 * This file is part of the WellCommerce package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information,
 * please view the LICENSE file that was distributed with this source code.
 */

namespace WellCommerce\Bundle\IntlBundle\Provider;

use WellCommerce\Bundle\IntlBundle\Repository\LocaleRepositoryInterface;

/**
 * Class LocaleProvider
 *
 * @package WellCommerce\Bundle\IntlBundle\LocaleProvider
 * @author  <NAME> <<EMAIL>>
 */
class LocaleProvider implements LocaleProviderInterface
{
    /**
     * @var LocaleRepositoryInterface
     */
    protected $repository;

    /**
     * @var array
     */
    protected $locales;

    public function __construct(LocaleRepositoryInterface $repository)
    {
        $this->repository = $repository;
    }

    /**
     * {@inheritdoc}
     */
    public function isAvailableLocale($locale)
    {
        return in_array($locale, $this->getAvailableLocales());
    }

    /**
     * {@inheritdoc}
     */
    public function getAvailableLocales()
    {
        if (null === $this->locales) {
            $this->locales = $this->repository->getAvailableLocales();
        }

        return $this->locales;
    }
}<commit_msg>Fixed locale provider<commit_after><?php
/*
 * WellCommerce Open-Source E-Commerce Platform
 *
 * This file is part of the WellCommerce package.
 *
 * (c) <NAME> <<EMAIL>>
 *
 * For the full copyright and license information,
 * please view the LICENSE file that was distributed with this source code.
 */

namespace WellCommerce\Bundle\IntlBundle\Provider;

use WellCommerce\Bundle\IntlBundle\Repository\LocaleRepositoryInterface;

/**
 * Class LocaleProvider
 *
 * @author  <NAME> <<EMAIL>>
 */
class LocaleProvider implements LocaleProviderInterface
{
    /**
     * @var LocaleRepositoryInterface
     */
    protected $repository;

    /**
     * @var array
     */
    protected $locales = [];

    /**
     * @var bool
     */
    protected $loaded = false;

    /**
     * Constructor
     *
     * @param LocaleRepositoryInterface $repository
     */
    public function __construct(LocaleRepositoryInterface $repository)
    {
        $this->repository = $repository;
    }

    /**
     * {@inheritdoc}
     */
    public function isAvailableLocale($locale)
    {
        return in_array($locale, $this->getAvailableLocales());
    }

    /**
     * {@inheritdoc}
     */
    public function getAvailableLocales()
    {
        if (!$this->loaded) {
            $this->locales = $this->repository->getAvailableLocales();
            $this->loaded  = true;
        }

        return $this->locales;
    }
}
{'fraction_non_alphanumeric': 0.12147102526002972, 'fraction_numerical': 0.0, 'mean_word_length': 2.649051490514905, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 30, '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': '4152775', 'n_tokens_mistral': 764, 'n_tokens_neox': 754, 'n_words': 174}