<commit_before><?php

namespace Hostnet\HnEntitiesPlugin;

use Symfony\Component\DependencyInjection\Dumper\PhpDumper;

use Symfony\Component\Config\ConfigCache as Symfony2ConfigCache;

use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

use Symfony\Component\Config\Loader\LoaderResolver;

use Symfony\Component\Config\FileLocator;

use Doctrine\Bundle\DoctrineBundle\DependencyInjection\DoctrineExtension;

use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
 * Use this class as your superclass for your ApplicationConfiguration
 *
 * Adds a ->getContainer() function
 */
class ApplicationConfiguration extends \sfApplicationConfiguration
{
  private $container;

  /**
   * @var bool
   */
  private $is_fresh = true;

  public function getConfigCache()
  {
    if(null === $this->configCache) {
      // Isn't this cyclic dependency lovely?
      $this->configCache = new ConfigCache($this);
    }
    return $this->configCache;
  }

  /**
   * Whether the existing container cache was fresh.
   * Not fresh config has potentially changed, and should be re-read
   * @return boolean
   */
  public function isFresh()
  {
    $this->getContainer();
    return $this->is_fresh;
  }

  /**
   * Gets and possibly generates a container.
   * @return ContainerInterface
   */
  public function getContainer()
  {
    if(! $this->container) {
      $file = \sfConfig::get('sf_config_cache_dir') . '/container_dump.php';
      $debug = in_array(\sfConfig::get('sf_environment'), array('dev', 'ontw', 'test'));

      $container_config_cache = new Symfony2ConfigCache($file, $debug);
      if (!$container_config_cache->isFresh()) {
        $this->is_fresh = false;
        $container = $this->createNewContainer($debug);
        $dumper = new PhpDumper($container);
        $container_config_cache->write(
            $dumper->dump(array('class' => 'MyCachedContainer')),
            $container->getResources()
        );
      }
      require_once $file;
      $this->container = new \MyCachedContainer();
    }
    return $this->container;
  }

  private function createNewContainer($debug)
  {
    $container = new ContainerBuilder();
    $container->registerExtension(new DoctrineExtension());
    $this->addResourcesToContainer($container);

    $container->setParameter('kernel.debug', $debug);
    $path = \sfConfig::get('sf_config_dir');
    $locator = new FileLocator($path);

    $resolver = new LoaderResolver();
    $resolver->addLoader(new YamlFileLoader($container, $locator));

    $resource = 'config-' . \sfConfig::get('sf_environment') . '.yml';
    if(! file_exists($path . '/' . $resource)) {
      $resource = 'config.yml';
    }
    $resolver->resolve($resource)->load($resource);

    $container->compile();
    return $container;
  }
<commit_msg>Symfony2 uses underscores, so lets follow that. Changed directory of config.<commit_after><?php

namespace Hostnet\HnEntitiesPlugin;

use Symfony\Component\DependencyInjection\Dumper\PhpDumper;

use Symfony\Component\Config\ConfigCache as Symfony2ConfigCache;

use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

use Symfony\Component\Config\Loader\LoaderResolver;

use Symfony\Component\Config\FileLocator;

use Doctrine\Bundle\DoctrineBundle\DependencyInjection\DoctrineExtension;

use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
 * Use this class as your superclass for your ApplicationConfiguration
 *
 * Adds a ->getContainer() function
 */
class ApplicationConfiguration extends \sfApplicationConfiguration
{
  private $container;

  /**
   * @var bool
   */
  private $is_fresh = true;

  public function getConfigCache()
  {
    if(null === $this->configCache) {
      // Isn't this cyclic dependency lovely?
      $this->configCache = new ConfigCache($this);
    }
    return $this->configCache;
  }

  /**
   * Whether the existing container cache was fresh.
   * Not fresh config has potentially changed, and should be re-read
   * @return boolean
   */
  public function isFresh()
  {
    $this->getContainer();
    return $this->is_fresh;
  }

  /**
   * Gets and possibly generates a container.
   * @return ContainerInterface
   */
  public function getContainer()
  {
    if(! $this->container) {
      $file = \sfConfig::get('sf_config_cache_dir') . '/container_dump.php';
      $debug = in_array(\sfConfig::get('sf_environment'), array('dev', 'ontw', 'test'));

      $container_config_cache = new Symfony2ConfigCache($file, $debug);
      if (!$container_config_cache->isFresh()) {
        $this->is_fresh = false;
        $container = $this->createNewContainer($debug);
        $dumper = new PhpDumper($container);
        $container_config_cache->write(
            $dumper->dump(array('class' => 'MyCachedContainer')),
            $container->getResources()
        );
      }
      require_once $file;
      $this->container = new \MyCachedContainer();
    }
    return $this->container;
  }

  private function createNewContainer($debug)
  {
    $container = new ContainerBuilder();
    $container->registerExtension(new DoctrineExtension());
    $this->addResourcesToContainer($container);

    $container->setParameter('kernel.debug', $debug);
    $path = \sfConfig::get('sf_app_config_dir');
    $locator = new FileLocator($path);

    $resolver = new LoaderResolver();
    $resolver->addLoader(new YamlFileLoader($container, $locator));

    $resource = 'config_' . \sfConfig::get('sf_environment') . '.yml';
    if(! file_exists($path . '/' . $resource)) {
      $resource = 'config.yml';
    }
    $resolver->resolve($resource)->load($resource);

    $container->compile();
    return $container;
  }

{'fraction_non_alphanumeric': 0.13576100406575925, 'fraction_numerical': 0.00088386070355312, 'mean_word_length': 3.691542288557214, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 49, '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': '6538182', 'n_tokens_mistral': 1672, 'n_tokens_neox': 1637, 'n_words': 336}