<commit_before><?php


namespace Singo;

use Dflydev\Provider\DoctrineOrm\DoctrineOrmServiceProvider;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Monolog\Logger;
use Silex\Provider\FractalServiceProvider;
use Silex\Provider\TacticianServiceProvider;
use Singo\Bus\Middleware\CommandLoggerMiddleware;
use Singo\Bus\Middleware\CommandValidationMiddleware;
use Singo\Event\Listener\ExceptionHandler;
use Silex\Application as SilexApplication;
use Silex\Provider\SecurityJWTServiceProvider;
use Silex\Provider\SecurityServiceProvider;
use Silex\Provider\DoctrineServiceProvider;
use Silex\Provider\MonologServiceProvider;
use Silex\Provider\ServiceControllerServiceProvider;
use Silex\Provider\SwiftmailerServiceProvider;
use Silex\Provider\ValidatorServiceProvider;
use Silex\Provider\ConfigServiceProvider;
use Silex\Provider\PimpleAwareEventDispatcherServiceProvider;
use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory;
use Symfony\Component\Validator\Mapping\Loader\AnnotationLoader;

/**
 * Class Application
 * @package Singo
 */
class Application extends SilexApplication
{
    /**
     * @var Application
     */
    public static $container;

    /**
     * @param array $values
     */
    public function __construct(array $values = [])
    {
        parent::__construct($values);

        if (! defined("APP_PATH")) {
            define("APP_PATH", $this["app.path"]);
        }

        if (! defined("PUBLIC_PATH")) {
            define("PUBLIC_PATH", $this["app.public.path"]);
        }
    }

    /**
     * initialize our application
     */
    public function init()
    {
        $this->initPimpleAwareEventDispatcher();
        $this->initConfig();
        $this->initLogger();
        $this->initDatabase();
        $this->initValidator();
        $this->initMailer();
        $this->initFirewall();
        $this->initCommandBus();
        $this->initFractal();
        $this->initDefaultSubscribers();
        $this->initControllerService();

        /**
         * Silex config
         */
        $this["debug"] = $this["config"]->get("common/debug");

        /**
         * Save container in static variable
         */
        self::$container = $this;
    }

    /**
     * return void
     */
    public function initPimpleAwareEventDispatcher()
    {
        $this->register(new PimpleAwareEventDispatcherServiceProvider());
    }

    /**
     * initialize application configuration
     * return void
     */
    public function initConfig()
    {
        $this->register(new ConfigServiceProvider($this["config.path"]));
    }

    /**
     * initialize doctrine orm and dbal
     * return void
     */
    public function initDatabase()
    {
        $this->register(
            new DoctrineServiceProvider,
            [
                "dbs.options" => $this["config"]->get("database/connection/orm")
            ]
        );
        $this->register(
            new DoctrineOrmServiceProvider(),
            [
                "orm.proxies_dir" => dirname(__FILE__) . $this["config"]->get("database/orm/proxy_dir"),
                "orm.proxies_namespace" => $this["config"]->get("database/orm/proxy_namespace"),
                "orm.ems.options" => $this["config"]->get("database/ems")
            ]
        );
    }

    /**
     * initialize logger
     * return void
     */
    public function initLogger()
    {
        $date = new \DateTime();
        $log_file = APP_PATH . $this["config"]->get("common/log/dir") . "/{$date->format("Y-m-d")}.log";
        $this->register(
            new MonologServiceProvider(),<commit_msg>[BUGFIX] Proxy dir not found<commit_after><?php


namespace Singo;

use Dflydev\Provider\DoctrineOrm\DoctrineOrmServiceProvider;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\AnnotationRegistry;
use Monolog\Logger;
use Silex\Provider\FractalServiceProvider;
use Silex\Provider\TacticianServiceProvider;
use Singo\Bus\Middleware\CommandLoggerMiddleware;
use Singo\Bus\Middleware\CommandValidationMiddleware;
use Singo\Event\Listener\ExceptionHandler;
use Silex\Application as SilexApplication;
use Silex\Provider\SecurityJWTServiceProvider;
use Silex\Provider\SecurityServiceProvider;
use Silex\Provider\DoctrineServiceProvider;
use Silex\Provider\MonologServiceProvider;
use Silex\Provider\ServiceControllerServiceProvider;
use Silex\Provider\SwiftmailerServiceProvider;
use Silex\Provider\ValidatorServiceProvider;
use Silex\Provider\ConfigServiceProvider;
use Silex\Provider\PimpleAwareEventDispatcherServiceProvider;
use Symfony\Component\Validator\Mapping\Factory\LazyLoadingMetadataFactory;
use Symfony\Component\Validator\Mapping\Loader\AnnotationLoader;

/**
 * Class Application
 * @package Singo
 */
class Application extends SilexApplication
{
    /**
     * @var Application
     */
    public static $container;

    /**
     * @param array $values
     */
    public function __construct(array $values = [])
    {
        parent::__construct($values);

        if (! defined("APP_PATH")) {
            define("APP_PATH", $this["app.path"]);
        }

        if (! defined("PUBLIC_PATH")) {
            define("PUBLIC_PATH", $this["app.public.path"]);
        }
    }

    /**
     * initialize our application
     */
    public function init()
    {
        $this->initPimpleAwareEventDispatcher();
        $this->initConfig();
        $this->initLogger();
        $this->initDatabase();
        $this->initValidator();
        $this->initMailer();
        $this->initFirewall();
        $this->initCommandBus();
        $this->initFractal();
        $this->initDefaultSubscribers();
        $this->initControllerService();

        /**
         * Silex config
         */
        $this["debug"] = $this["config"]->get("common/debug");

        /**
         * Save container in static variable
         */
        self::$container = $this;
    }

    /**
     * return void
     */
    public function initPimpleAwareEventDispatcher()
    {
        $this->register(new PimpleAwareEventDispatcherServiceProvider());
    }

    /**
     * initialize application configuration
     * return void
     */
    public function initConfig()
    {
        $this->register(new ConfigServiceProvider($this["config.path"]));
    }

    /**
     * initialize doctrine orm and dbal
     * return void
     */
    public function initDatabase()
    {
        $this->register(
            new DoctrineServiceProvider,
            [
                "dbs.options" => $this["config"]->get("database/connection/orm")
            ]
        );
        $this->register(
            new DoctrineOrmServiceProvider(),
            [
                "orm.proxies_dir" => APP_PATH. $this["config"]->get("database/orm/proxy_dir"),
                "orm.proxies_namespace" => $this["config"]->get("database/orm/proxy_namespace"),
                "orm.ems.options" => $this["config"]->get("database/ems")
            ]
        );
    }

    /**
     * initialize logger
     * return void
     */
    public function initLogger()
    {
        $date = new \DateTime();
        $log_file = APP_PATH . $this["config"]->get("common/log/dir") . "/{$date->format("Y-m-d")}.log";
        $this->register(
            new MonologServiceProvider(),
{'fraction_non_alphanumeric': 0.13174798414650812, 'fraction_numerical': 0.0, 'mean_word_length': 2.6626626626626626, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 57, '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': '5353527', 'n_tokens_mistral': 2086, 'n_tokens_neox': 2044, 'n_words': 329}