services:
    _instanceof:
        Contao\CoreBundle\Framework\FrameworkAwareInterface:
            calls:
                - ["setFramework", ["@contao.framework"]]

        Symfony\Component\DependencyInjection\ContainerAwareInterface:
            calls:
                - ["setContainer", ["@service_container"]]

    contao.cache:
        class: Doctrine\Common\Cache\FilesystemCache
        arguments:
            - "%kernel.cache_dir%/contao/cache"
            - ""
            - 0022
        public: true

    contao.cache.clear_internal:
        class: Contao\CoreBundle\Cache\ContaoCacheClearer
        arguments:
            - "@filesystem"
        tags:
            - { name: kernel.cache_clearer }

    contao.cache.warm_internal:
        class: Contao\CoreBundle\Cache\ContaoCacheWarmer
        arguments:
            - "@filesystem"
            - "@contao.resource_finder"
            - "@contao.resource_locator"
            - "%kernel.project_dir%"
            - "@database_connection"
            - "@contao.framework"
        tags:
            - { name: kernel.cache_warmer }

    contao.controller.backend_csv_import:
        class: Contao\CoreBundle\Controller\BackendCsvImportController
        arguments:
            - "@contao.framework"
            - "@database_connection"
            - "@request_stack"
            - "%kernel.project_dir%"

    contao.controller.insert_tags:
        class: Contao\CoreBundle\Controller\InsertTagsController
        arguments:
            - "@contao.framework"
        public: true

    contao.cors_website_roots_config_provider:
        class: Contao\CoreBundle\Cors\WebsiteRootsConfigProvider
        arguments:
            - "@database_connection"
        tags:
            - { name: nelmio_cors.options_provider }

    contao.data_collector:
        class: Contao\CoreBundle\DataCollector\ContaoDataCollector
        arguments:
            - "%kernel.packages%"
        tags:
            - { name: data_collector, template: "@ContaoCore/Collector/contao.html.twig", id: "contao" }

    contao.doctrine.schema_provider:
        class: Contao\CoreBundle\Doctrine\Schema\DcaSchemaProvider
        arguments:
            - "@contao.framework"
            - "@doctrine"

    contao.framework:
        class: Contao\CoreBundle\Framework\ContaoFramework
        arguments:
            - "@request_stack"
            - "@router"
            - "@session"
            - "@contao.routing.scope_matcher"
            - "%kernel.project_dir%"
            - "%contao.error_level%"
        public: true

    contao.image.imagine:
        class: Imagine\Gd\Imagine
        public: true

    contao.image.imagine_svg:
        class: Contao\ImagineSvg\Imagine
        public: true

    contao.image.resize_calculator:
        class: Contao\Image\ResizeCalculator

    contao.image.resizer:
        class: Contao\CoreBundle\Image\LegacyResizer
        arguments:
            - "%contao.image.target_dir%"
            - "@contao.image.resize_calculator"
            - "@filesystem"
        public: true

    contao.image.image_factory:
        class: Contao\CoreBundle\Image\ImageFactory
        arguments:
            - "@contao.image.resizer"
            - "@contao.image.imagine"
            - "@contao.image.imagine_svg"
            - "@filesystem"
            - "@contao.framework"
            - "%contao.image.bypass_cache%"
            - "%contao.image.imagine_options%"
            - "%contao.image.valid_extensions%"
        public: true

    contao.image.image_sizes:
        class: Contao\CoreBundle\Image\ImageSizes
        arguments:
            - "@database_connection"
            - "@event_dispatcher"
            - "@contao.framework"
        public: true

    contao.image.picture_generator:
        class: Contao\Image\PictureGenerator
        arguments:
            - "@contao.image.resizer"
        public: true

    contao.image.picture_factory:
        class: Contao\CoreBundle\Image\PictureFactory
        arguments:
            - "@contao.image.picture_generator"
            - "@contao.image.image_factory"
            - "@contao.framework"
            - "%contao.image.bypass_cache%"
            - "%contao.image.imagine_options%"
        public: true

    contao.menu.matcher:
        class: Knp\Menu\Matcher\Matcher

    contao.menu.renderer:
        class: Knp\Menu\Renderer\ListRenderer
        arguments:
            - "@contao.menu.matcher"
        public: true

    contao.monolog.handler:
        class: Contao\CoreBundle\Monolog\ContaoTableHandler
        arguments:
            - debug
            - false
        tags:
            - { name: monolog.logger, channel: contao }

    contao.monolog.processor:
        class: Contao\CoreBundle\Monolog\ContaoTableProcessor
        arguments:
            - "@request_stack"
            - "@security.token_storage"
            - "@contao.routing.scope_matcher"
        tags:
            - { name: monolog.processor }

    contao.picker.builder:
        class: Contao\CoreBundle\Picker\PickerBuilder
        arguments:
            - "@knp_menu.factory"
            - "@router"
        public: true

    contao.picker.page_provider:
        class: Contao\CoreBundle\Picker\PagePickerProvider
        arguments:
            - "@knp_menu.factory"
            - "@router"
        calls:
            - [setTokenStorage, ["@security.token_storage"]]
        tags:
            - { name: contao.picker_provider, priority: 192 }

    contao.picker.file_provider:
        class: Contao\CoreBundle\Picker\FilePickerProvider
        arguments:
            - "@knp_menu.factory"
            - "@router"
            - "%contao.upload_path%"
        calls:
            - [setTokenStorage, ["@security.token_storage"]]
        tags:
            - { name: contao.picker_provider, priority: 160 }

    contao.picker.article_provider:
        class: Contao\CoreBundle\Picker\ArticlePickerProvider
        arguments:
            - "@knp_menu.factory"
            - "@router"
        calls:
            - [setTokenStorage, ["@security.token_storage"]]
        tags:
            - { name: contao.picker_provider }

    contao.referer_id.manager:
        class: Symfony\Component\Security\Csrf\CsrfTokenManager
        arguments:
            - "@contao.referer_id.token_generator"
            - "@security.csrf.token_storage"

    contao.referer_id.token_generator:
        class: Contao\CoreBundle\Referer\TokenGenerator

    contao.resource_finder:
        class: Contao\CoreBundle\Config\ResourceFinder
        arguments:
            - "%contao.resources_paths%"
        public: true

    contao.resource_locator:
        class: Symfony\Component\Config\FileLocator
        arguments:
            - "%contao.resources_paths%"
        public: true

    contao.routing.frontend_loader:
        class: Contao\CoreBundle\Routing\FrontendLoader
        arguments:
            - "%contao.prepend_locale%"
        tags:
            - { name: routing.loader }

    contao.routing.url_generator:
        class: Contao\CoreBundle\Routing\UrlGenerator
        arguments:
            - "@router"
            - "@contao.framework"
            - "%contao.prepend_locale%"
        public: true

    contao.routing.scope_matcher:
        class: Contao\CoreBundle\Routing\ScopeMatcher
        arguments:
            - "@contao.routing.backend_matcher"
            - "@contao.routing.frontend_matcher"

    contao.routing.backend_matcher:
        class: Symfony\Component\HttpFoundation\RequestMatcher
        calls:
            - ["matchAttribute", ["_scope", "backend"]]

    contao.routing.frontend_matcher:
        class: Symfony\Component\HttpFoundation\RequestMatcher
        calls:
            - ["matchAttribute", ["_scope", "frontend"]]

    contao.security.authenticator:
        class: Contao\CoreBundle\Security\ContaoAuthenticator
        arguments:
            - "@contao.routing.scope_matcher"

    contao.security.user_provider:
        class: Contao\CoreBundle\Security\User\ContaoUserProvider
        arguments:
            - "@contao.framework"
            - "@contao.routing.scope_matcher"

    contao.session.contao_backend:
        class: Contao\CoreBundle\Session\Attribute\ArrayAttributeBag
        arguments:
            - "_contao_be_attributes"
        calls:
            - ["setName", ["contao_backend"]]

    contao.session.contao_frontend:
        class: Contao\CoreBundle\Session\Attribute\ArrayAttributeBag
        arguments:
            - "_contao_fe_attributes"
        calls:
            - ["setName", ["contao_frontend"]]

    contao.twig.template_extension:
        class: Contao\CoreBundle\Twig\Extension\ContaoTemplateExtension
        arguments:
            - "@request_stack"
            - "@contao.framework"
            - "@contao.routing.scope_matcher"
        tags:
            - { name: twig.extension }
