Bundle that permit to use piwik to have stat in your symfony2 application.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

49 lines
2.2 KiB

<?php
/*
* This file is part of the ShadowareMatomoBundle package.
*
* (c) Ulrich VANDENHEKKE <ulrich.vdh@shadoware.org>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Shadoware\MatomoBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
/**
* This is the class that loads and manages your bundle configuration
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class ShadowareMatomoExtension extends Extension
{
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('services.xml');
$container->setParameter('shadoware_matomo.base_url', $config['base_url']);
$container->setParameter('shadoware_matomo.token_id', $config['token_id']);
$container->setParameter('shadoware_matomo.analytics.id_site', $config['analytics']['id_site'] ?? null);
$container->setParameter('shadoware_matomo.analytics.hide_matomo', $config['analytics']['hide_matomo'] ?? null);
$container->setParameter('shadoware_matomo.analytics.heartbeat.enabled', $config['analytics']['heartbeat']['enabled'] ?? false);
$container->setParameter('shadoware_matomo.analytics.heartbeat.minimum_visit_length', $config['analytics']['heartbeat']['minimum_visit_length'] ?? 15);
$container->setParameter('shadoware_matomo.analytics.heartbeat.delay', $config['analytics']['heartbeat']['delay'] ?? 30);
$container->setParameter('shadoware_matomo.tag_management.id_container', $config['tag_management']['id_container'] ?? null);
$container->setParameter('shadoware_matomo.tag_management.variables', $config['tag_management']['variables'] ?? null);
}
}