Completed
Push — master ( 770316...74fc07 )
by Jeroen
09:08 queued 02:44
created

KunstmaanUtilitiesExtension.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\UtilitiesBundle\DependencyInjection;
4
5
use Symfony\Component\Config\FileLocator;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Loader;
8
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
9
10
/**
11
 * This is the class that loads and manages your bundle configuration
12
 *
13
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
14
 */
15
class KunstmaanUtilitiesExtension extends Extension
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20 6
    public function load(array $configs, ContainerBuilder $container)
21
    {
22 6
        $configuration = new Configuration();
23 6
        $config = $this->processConfiguration($configuration, $configs);
24
25 6
        if ($container->hasParameter('kunstmaan_utilities.cipher.secret')) {
26 1
            @trigger_error('Setting the "kunstmaan_utilities.cipher.secret" parameter is deprecated since KunstmaanUtilitiesBundle 5.2, this value will be ignored/overwritten in KunstmaanUtilitiesBundle 6.0. Use the "kunstmaan_utilities.cipher.secret" config instead if you want to set a different value than the default "%kernel.secret%".', E_USER_DEPRECATED);
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
27 5
        } elseif ($container->hasParameter('secret')) {
28 4
            $container->setParameter('kunstmaan_utilities.cipher.secret', $container->getParameter('secret'));
29
        } else {
30 1
            $container->setParameter('kunstmaan_utilities.cipher.secret', $config['cipher']['secret']);
31
        }
32
33 6
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
34 6
        $loader->load('commands.yml');
35 6
        $loader->load('services.yml');
36 6
    }
37
}
38