<commit_before>parameters:
    # Parameters overridden by application configuration
    routes: []
    routes.cached: 'configuration/routes.cached.php'
    routes.cache_disabled: true

    debug: false
    symfony.debug: true

    date.timezone: 'America/Detroit'
    panthor.internal.timezone: 'UTC'

    # twig defaults
    twig.debug: true
    twig.template.dir: '%env(PANTHOR_APPROOT)%/templates'
    twig.cache.dir: '%env(PANTHOR_APPROOT)%/.twig'

    # cookie
    cookie.encryption.secret: ''
    cookie.unencrypted: []
    cookie.delete_invalid: true

    cookie.settings:
        expires: 0
        maxAge: 0
        path: '/'
        domain: ''
        secure: false
        httpOnly: false

    error_handling.levels: 32767            # E_ALL
    error_handling.thrown_errors: 8191      # E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED
    error_handling.logged_errors: 32767     # E_ALL
    error_handling.log_stacktrace: false
    error_handling.html_template: 'error.html.twig'

services:
    _defaults:
        public: true

    # Injected at runtime by the Bootstrap
    # Note: This path has NO TRAILING SLASH
    root:               { synthetic: true }

    ############################################################################
    # Public exported services
    #
    # All of these can be overridden. Just set the same service in your
    # application configuration
    ############################################################################

    router:                         { alias: panthor.router }
    router.loader:                  { alias: panthor.router.loader }

    uri:                            { alias: panthor.uri }
    json:                           { alias: panthor.json }
    clock:                          { alias: panthor.clock }
    logger:                         { alias: panthor.logger }

    error.handler:                  { alias: panthor.error_handling.handler }
    exception.handler:              { alias: panthor.error_handling.exception.handler }
    problem.renderer:               { alias: panthor.problem.renderer }
    content_handler:                { alias: panthor.content_handler }

    cookie.encryption:              { alias: panthor.cookie.encryption }
    cookie.handler:                 { alias: panthor.cookie.handler }

    twig.template:                  { parent: panthor.twig.template, public: true }
    twig.context:                   { alias: panthor.twig.context }

    twig.loader:                    { alias: panthor.twig.loader }
    twig.environment:               { alias: panthor.twig.environment }

    ############################################################################
    # Slim
    #
    # Configuration parameters:
    #
    # %routes%
    # %routes.cached%
    # %routes.cache_disabled%
    #
    ############################################################################

    panthor.router.loader:
        class: 'QL\Panthor\Bootstrap\RouteLoader'
        arguments: ['%routes%']

    panthor.router:
        class: 'QL\Panthor\Bootstrap\CacheableRouter'
        calls:
            - ['setCaching', ['%env(PANTHOR_APPROOT)%/%routes.cached%', '%routes.cache_disabled%']]

    ############################################################################
    # Panthor Cookies
    #
    # Configuration parameters:
    #
    # %cookie.encryption.secret%
    # %cookie.settings%
    #
    ############################################################################

    panthor.cookie.encryption:
        class: 'QL\Panthor\HTTP\CookieEncryption\LibsodiumCookieEncryption'
        arguments: ['@panthor.libsodium.encryption']

    panthor.libsodium.encryption:
        class: 'QL\Panthor\Encryption\LibsodiumSymmetricCrypto'
        arguments: ['%cookie.encryption.secret%']

    panthor.cookie.handler:
        class: 'QL\Panthor\HTTP\CookieHandler'
        arguments: ['%cookie.settings%']

    ############################################################################
    # Error Handling
    #
    # Configuration parameters:
    #
    # %slim.settings.display_errors%
    # %error_handling.log_stacktrace%
    # %error_handling.levels%
    # %error_handling.thrown_errors%
    # %error_handling.logged_errors%
    #
    # %error_handling.html_template%
    #
    ############################################################################

    panthor.content_handler:
        class: 'QL\Panthor\ErrorHandling\ContentHandler\NegotiatingContentHandler'
        arguments:
            -
                '*/*': '@panthor.content_handler.html'
                'text/html': '@panthor.content_handler.html'
                'application/problem': '@panthor.content_handler.problem'
                'application/json': '@panthor.content_handler.json'
                'text/plain': '@panthor.content_handler.text'

    # Content Handlers
    panthor.content_handler.json:
        class: 'QL\Panthor\ErrorHandling\ContentHandler\JSONContentHandler'
        arguments: ['@json', '%slim.settings.display_errors%']
        calls:
            - ['setStacktraceLogging', ['%error_handling.log_stacktrace%']]
    panthor.content_handler.problem:
        class: 'QL\Panthor\ErrorHandling\ContentHandler\HTTPProblemContentHandler'
        arguments: ['@panthor.problem.json_renderer', '%slim.settings.display_errors%']
        calls:
            - ['setStacktraceLogging', ['%error_handling.log_stacktrace%']]
    panthor.content_handler.text:
        class: 'QL\Panthor\ErrorHandling\ContentHandler\PlainTextContentHandler'
        arguments: ['%slim.settings.display_errors%']
        calls:
            - ['setStacktraceLogging', ['%error_handling.log_stacktrace%']]
    panthor.content_handler.html:
        class: 'QL\Panthor\ErrorHandling\ContentHandler\HTMLTemplateContentHandler'
        arguments: ['@panthor.handler.twig', '%slim.settings.display_errors%']
        calls:
            - ['setStacktraceLogging', ['%error_handling.log_stacktrace%']]

    # Mapped closures for slim to our content handler
    panthor.handler.notFoundHandler:
        class: 'Closure'
        factory: ['QL\Panthor\Utility\ClosureFactory', 'buildClosure']
        arguments: ['@content_handler', 'handleNotFound']

    panthor.handler.notAllowedHandler:
        class: 'Closure'
        factory: ['QL\Panthor\Utility\ClosureFactory', 'buildClosure']
        arguments: ['@content_handler', 'handleNotAllowed']

    panthor.handler.phpErrorHandler:
        class: 'Closure'
        factory: ['QL\Panthor\Utility\ClosureFactory', 'buildClosure']
        arguments: ['@content_handler', 'handleThrowable']

    panthor.handler.errorHandler:
        class: 'Closure'
        factory: ['QL\Panthor\Utility\ClosureFactory', 'buildClosure']
        arguments: ['@content_handler', 'handleException']

    panthor.error_handling.exception.handler:
        class: 'QL\Panthor\ErrorHandling\ExceptionHandler'
        arguments: ['@content_handler', '@request', '@response']

    panthor.error_handling.handler:
        class: 'QL\Panthor\ErrorHandling\ErrorHandler'
        arguments: ['@exception.handler', '@logger']
        calls:
            - ['setStacktraceLogging', ['%error_handling.log_stacktrace%']]
            - ['setThrownErrors', ['%error_handling.thrown_errors%']]
            - ['setLoggedErrors', ['%error_handling.logged_errors%']]

    # exception rendering
    panthor.problem.json_renderer:
        class: 'QL\Panthor\HTTPProblem\Renderer\JSONRenderer'
        arguments: ['@json']

    panthor.handler.twig:
        class: 'QL\Panthor\Templating\TwigTemplate'
        arguments: ['@panthor.handler.twig_base', '@twig.context']

    panthor.handler.twig_base:
        class: 'Twig\Template'
        factory: ['@twig.environment', 'loadTemplate']
        arguments: ['%error_handling.html_template%']

    panthor.problem.renderer:
        class: 'QL\Panthor\HTTPProblem\Renderer\JSONRenderer'
        arguments: ['@panthor.problem.renderer.json']
    panthor.problem.renderer.json:
        class: 'QL\Panthor\Utility\JSON'
        calls:
            - ['setEncodingOptions', [0]]
            - ['addEncodingOptions', [64]] # JSON_UNESCAPED_SLASHES

    ############################################################################
    # Panthor Middleware
    #
    # Configuration parameters:
    #
    # %cookie.unencrypted%
    # %cookie.delete_invalid%
    #
    ############################################################################

    panthor.middleware.encrypted_cookies:
        class: 'QL\Panthor\Middleware\EncryptedCookiesMiddleware'
        arguments:
            - '@panthor.cookie.encryption'
            - '%cookie.unencrypted%'
            - '%cookie.delete_invalid%'

    ############################################################################
    # Logging
    ############################################################################

    panthor.logger:
        class: 'Psr\Log\NullLogger'

    ############################################################################
    # Panthor Utilities
    #
    # Configuration parameters:
    #
    # %panthor.internal.timezone%
    #
    ############################################################################

    panthor.uri:
        class: 'QL\Panthor\Utility\URI'
        arguments: ['@router']

    panthor.clock:
        class: 'QL\MCP\Common\Clock'
        arguments: ['now', '%panthor.internal.timezone%']

    panthor.json:
        class: 'QL\Panthor\Utility\JSON'

    ############################################################################
    # Twig
    #
    # Configuration parameters:
    #
    # %debug%
    # %date.timezone%
    #
    # %twig.debug%
    # %twig.cache.dir%
    # %twig.template.dir%
    #
    ############################################################################

    panthor.twig.extension:
        class: 'QL\Panthor\Twig\TwigExtension'
        arguments:
            - '@panthor.uri'
            - '@panthor.clock'
            - '%date.timezone%'
            - '%debug%'

    panthor.twig.configurator:
        class: 'QL\Panthor\Twig\EnvironmentConfigurator'
        arguments: ['%twig.debug%', '@panthor.twig.cache']

    panthor.twig.template:
        class: 'QL\Panthor\Twig\LazyTwig'
        arguments: ['@twig.environment', '@twig.context']
    panthor.twig.context:
        class: 'QL\Panthor\Twig\Context'

    panthor.twig.loader:
        class: 'Twig\Loader\Filesystem'
        arguments: ['%twig.template.dir%', '%env(PANTHOR_APPROOT)%']

    panthor.twig.cache:
        class: 'Twig\Cache\Filesystem'
        arguments: ['%twig.cache.dir%']

    panthor.twig.environment:
        class: 'Twig\Environment'
        arguments: ['@twig.loader']
        configurator: ['@panthor.twig.configurator', 'configure']
        calls:
            - ['addExtension', ['@panthor.twig.extension']]<commit_msg>Fix twig class names<commit_after>parameters:
    # Parameters overridden by application configuration
    routes: []
    routes.cached: 'configuration/routes.cached.php'
    routes.cache_disabled: true

    debug: false
    symfony.debug: true

    date.timezone: 'America/Detroit'
    panthor.internal.timezone: 'UTC'

    # twig defaults
    twig.debug: true
    twig.template.dir: '%env(PANTHOR_APPROOT)%/templates'
    twig.cache.dir: '%env(PANTHOR_APPROOT)%/.twig'

    # cookie
    cookie.encryption.secret: ''
    cookie.unencrypted: []
    cookie.delete_invalid: true

    cookie.settings:
        expires: 0
        maxAge: 0
        path: '/'
        domain: ''
        secure: false
        httpOnly: false

    error_handling.levels: 32767            # E_ALL
    error_handling.thrown_errors: 8191      # E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED
    error_handling.logged_errors: 32767     # E_ALL
    error_handling.log_stacktrace: false
    error_handling.html_template: 'error.html.twig'

services:
    _defaults:
        public: true

    # Injected at runtime by the Bootstrap
    # Note: This path has NO TRAILING SLASH
    root:               { synthetic: true }

    ############################################################################
    # Public exported services
    #
    # All of these can be overridden. Just set the same service in your
    # application configuration
    ############################################################################

    router:                         { alias: panthor.router }
    router.loader:                  { alias: panthor.router.loader }

    uri:                            { alias: panthor.uri }
    json:                           { alias: panthor.json }
    clock:                          { alias: panthor.clock }
    logger:                         { alias: panthor.logger }

    error.handler:                  { alias: panthor.error_handling.handler }
    exception.handler:              { alias: panthor.error_handling.exception.handler }
    problem.renderer:               { alias: panthor.problem.renderer }
    content_handler:                { alias: panthor.content_handler }

    cookie.encryption:              { alias: panthor.cookie.encryption }
    cookie.handler:                 { alias: panthor.cookie.handler }

    twig.template:                  { parent: panthor.twig.template, public: true }
    twig.context:                   { alias: panthor.twig.context }

    twig.loader:                    { alias: panthor.twig.loader }
    twig.environment:               { alias: panthor.twig.environment }

    ############################################################################
    # Slim
    #
    # Configuration parameters:
    #
    # %routes%
    # %routes.cached%
    # %routes.cache_disabled%
    #
    ############################################################################

    panthor.router.loader:
        class: 'QL\Panthor\Bootstrap\RouteLoader'
        arguments: ['%routes%']

    panthor.router:
        class: 'QL\Panthor\Bootstrap\CacheableRouter'
        calls:
            - ['setCaching', ['%env(PANTHOR_APPROOT)%/%routes.cached%', '%routes.cache_disabled%']]

    ############################################################################
    # Panthor Cookies
    #
    # Configuration parameters:
    #
    # %cookie.encryption.secret%
    # %cookie.settings%
    #
    ############################################################################

    panthor.cookie.encryption:
        class: 'QL\Panthor\HTTP\CookieEncryption\LibsodiumCookieEncryption'
        arguments: ['@panthor.libsodium.encryption']

    panthor.libsodium.encryption:
        class: 'QL\Panthor\Encryption\LibsodiumSymmetricCrypto'
        arguments: ['%cookie.encryption.secret%']

    panthor.cookie.handler:
        class: 'QL\Panthor\HTTP\CookieHandler'
        arguments: ['%cookie.settings%']

    ############################################################################
    # Error Handling
    #
    # Configuration parameters:
    #
    # %slim.settings.display_errors%
    # %error_handling.log_stacktrace%
    # %error_handling.levels%
    # %error_handling.thrown_errors%
    # %error_handling.logged_errors%
    #
    # %error_handling.html_template%
    #
    ############################################################################

    panthor.content_handler:
        class: 'QL\Panthor\ErrorHandling\ContentHandler\NegotiatingContentHandler'
        arguments:
            -
                '*/*': '@panthor.content_handler.html'
                'text/html': '@panthor.content_handler.html'
                'application/problem': '@panthor.content_handler.problem'
                'application/json': '@panthor.content_handler.json'
                'text/plain': '@panthor.content_handler.text'

    # Content Handlers
    panthor.content_handler.json:
        class: 'QL\Panthor\ErrorHandling\ContentHandler\JSONContentHandler'
        arguments: ['@json', '%slim.settings.display_errors%']
        calls:
            - ['setStacktraceLogging', ['%error_handling.log_stacktrace%']]
    panthor.content_handler.problem:
        class: 'QL\Panthor\ErrorHandling\ContentHandler\HTTPProblemContentHandler'
        arguments: ['@panthor.problem.json_renderer', '%slim.settings.display_errors%']
        calls:
            - ['setStacktraceLogging', ['%error_handling.log_stacktrace%']]
    panthor.content_handler.text:
        class: 'QL\Panthor\ErrorHandling\ContentHandler\PlainTextContentHandler'
        arguments: ['%slim.settings.display_errors%']
        calls:
            - ['setStacktraceLogging', ['%error_handling.log_stacktrace%']]
    panthor.content_handler.html:
        class: 'QL\Panthor\ErrorHandling\ContentHandler\HTMLTemplateContentHandler'
        arguments: ['@panthor.handler.twig', '%slim.settings.display_errors%']
        calls:
            - ['setStacktraceLogging', ['%error_handling.log_stacktrace%']]

    # Mapped closures for slim to our content handler
    panthor.handler.notFoundHandler:
        class: 'Closure'
        factory: ['QL\Panthor\Utility\ClosureFactory', 'buildClosure']
        arguments: ['@content_handler', 'handleNotFound']

    panthor.handler.notAllowedHandler:
        class: 'Closure'
        factory: ['QL\Panthor\Utility\ClosureFactory', 'buildClosure']
        arguments: ['@content_handler', 'handleNotAllowed']

    panthor.handler.phpErrorHandler:
        class: 'Closure'
        factory: ['QL\Panthor\Utility\ClosureFactory', 'buildClosure']
        arguments: ['@content_handler', 'handleThrowable']

    panthor.handler.errorHandler:
        class: 'Closure'
        factory: ['QL\Panthor\Utility\ClosureFactory', 'buildClosure']
        arguments: ['@content_handler', 'handleException']

    panthor.error_handling.exception.handler:
        class: 'QL\Panthor\ErrorHandling\ExceptionHandler'
        arguments: ['@content_handler', '@request', '@response']

    panthor.error_handling.handler:
        class: 'QL\Panthor\ErrorHandling\ErrorHandler'
        arguments: ['@exception.handler', '@logger']
        calls:
            - ['setStacktraceLogging', ['%error_handling.log_stacktrace%']]
            - ['setThrownErrors', ['%error_handling.thrown_errors%']]
            - ['setLoggedErrors', ['%error_handling.logged_errors%']]

    # exception rendering
    panthor.problem.json_renderer:
        class: 'QL\Panthor\HTTPProblem\Renderer\JSONRenderer'
        arguments: ['@json']

    panthor.handler.twig:
        class: 'QL\Panthor\Templating\TwigTemplate'
        arguments: ['@panthor.handler.twig_base', '@twig.context']

    panthor.handler.twig_base:
        class: 'Twig\Template'
        factory: ['@twig.environment', 'loadTemplate']
        arguments: ['%error_handling.html_template%']

    panthor.problem.renderer:
        class: 'QL\Panthor\HTTPProblem\Renderer\JSONRenderer'
        arguments: ['@panthor.problem.renderer.json']
    panthor.problem.renderer.json:
        class: 'QL\Panthor\Utility\JSON'
        calls:
            - ['setEncodingOptions', [0]]
            - ['addEncodingOptions', [64]] # JSON_UNESCAPED_SLASHES

    ############################################################################
    # Panthor Middleware
    #
    # Configuration parameters:
    #
    # %cookie.unencrypted%
    # %cookie.delete_invalid%
    #
    ############################################################################

    panthor.middleware.encrypted_cookies:
        class: 'QL\Panthor\Middleware\EncryptedCookiesMiddleware'
        arguments:
            - '@panthor.cookie.encryption'
            - '%cookie.unencrypted%'
            - '%cookie.delete_invalid%'

    ############################################################################
    # Logging
    ############################################################################

    panthor.logger:
        class: 'Psr\Log\NullLogger'

    ############################################################################
    # Panthor Utilities
    #
    # Configuration parameters:
    #
    # %panthor.internal.timezone%
    #
    ############################################################################

    panthor.uri:
        class: 'QL\Panthor\Utility\URI'
        arguments: ['@router']

    panthor.clock:
        class: 'QL\MCP\Common\Clock'
        arguments: ['now', '%panthor.internal.timezone%']

    panthor.json:
        class: 'QL\Panthor\Utility\JSON'

    ############################################################################
    # Twig
    #
    # Configuration parameters:
    #
    # %debug%
    # %date.timezone%
    #
    # %twig.debug%
    # %twig.cache.dir%
    # %twig.template.dir%
    #
    ############################################################################

    panthor.twig.extension:
        class: 'QL\Panthor\Twig\TwigExtension'
        arguments:
            - '@panthor.uri'
            - '@panthor.clock'
            - '%date.timezone%'
            - '%debug%'

    panthor.twig.configurator:
        class: 'QL\Panthor\Twig\EnvironmentConfigurator'
        arguments: ['%twig.debug%', '@panthor.twig.cache']

    panthor.twig.template:
        class: 'QL\Panthor\Twig\LazyTwig'
        arguments: ['@twig.environment', '@twig.context']
    panthor.twig.context:
        class: 'QL\Panthor\Twig\Context'

    panthor.twig.loader:
        class: 'Twig\Loader\FilesystemLoader'
        arguments: ['%twig.template.dir%', '%env(PANTHOR_APPROOT)%']

    panthor.twig.cache:
        class: 'Twig\Cache\FilesystemCache'
        arguments: ['%twig.cache.dir%']

    panthor.twig.environment:
        class: 'Twig\Environment'
        arguments: ['@twig.loader']
        configurator: ['@panthor.twig.configurator', 'configure']
        calls:
            - ['addExtension', ['@panthor.twig.extension']]
{'fraction_non_alphanumeric': 0.22136208644364574, 'fraction_numerical': 0.0017509906921021104, 'mean_word_length': 2.778377437325905, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5253784', 'n_tokens_mistral': 6484, 'n_tokens_neox': 6135, 'n_words': 868}