Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@..

Decoded Output download

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;

use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\DependencyInjection\RegisterLocaleAwareServicesPass;
use Symfony\Component\HttpKernel\EventListener\LocaleAwareListener;
use Symfony\Contracts\Translation\LocaleAwareInterface;

class RegisterLocaleAwareServicesPassTest extends TestCase
{
    public function testCompilerPass()
    {
        $container = new ContainerBuilder();

        $container->register('locale_aware_listener', LocaleAwareListener::class)
                  ->setPublic(true)
                  ->setArguments([null, null]);

        $container->register('some_locale_aware_service', LocaleAwareInterface::class)
                  ->setPublic(true)
                  ->addTag('kernel.locale_aware');

        $container->register('another_locale_aware_service', LocaleAwareInterface::class)
                  ->setPublic(true)
                  ->addTag('kernel.locale_aware');

        $container->addCompilerPass(new RegisterLocaleAwareServicesPass());
        $container->compile();

        $this->assertEquals(
            [
                new IteratorArgument([
                    0 => new Reference('some_locale_aware_service'),
                    1 => new Reference('another_locale_aware_service'),
                ]),
                null,
            ],
            $container->getDefinition('locale_aware_listener')->getArguments()
        );
    }

    public function testListenerUnregisteredWhenNoLocaleAwareServices()
    {
        $container = new ContainerBuilder();

        $container->register('locale_aware_listener', LocaleAwareListener::class)
                  ->setPublic(true)
                  ->setArguments([null, null]);

        $container->addCompilerPass(new RegisterLocaleAwareServicesPass());
        $container->compile();

        $this->assertFalse($container->hasDefinition('locale_aware_listener'));
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;

use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\Argument\IteratorArgument;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\DependencyInjection\RegisterLocaleAwareServicesPass;
use Symfony\Component\HttpKernel\EventListener\LocaleAwareListener;
use Symfony\Contracts\Translation\LocaleAwareInterface;

class RegisterLocaleAwareServicesPassTest extends TestCase
{
    public function testCompilerPass()
    {
        $container = new ContainerBuilder();

        $container->register('locale_aware_listener', LocaleAwareListener::class)
                  ->setPublic(true)
                  ->setArguments([null, null]);

        $container->register('some_locale_aware_service', LocaleAwareInterface::class)
                  ->setPublic(true)
                  ->addTag('kernel.locale_aware');

        $container->register('another_locale_aware_service', LocaleAwareInterface::class)
                  ->setPublic(true)
                  ->addTag('kernel.locale_aware');

        $container->addCompilerPass(new RegisterLocaleAwareServicesPass());
        $container->compile();

        $this->assertEquals(
            [
                new IteratorArgument([
                    0 => new Reference('some_locale_aware_service'),
                    1 => new Reference('another_locale_aware_service'),
                ]),
                null,
            ],
            $container->getDefinition('locale_aware_listener')->getArguments()
        );
    }

    public function testListenerUnregisteredWhenNoLocaleAwareServices()
    {
        $container = new ContainerBuilder();

        $container->register('locale_aware_listener', LocaleAwareListener::class)
                  ->setPublic(true)
                  ->setArguments([null, null]);

        $container->addCompilerPass(new RegisterLocaleAwareServicesPass());
        $container->compile();

        $this->assertFalse($container->hasDefinition('locale_aware_listener'));
    }
}

Function Calls

None

Variables

None

Stats

MD5 9e314c66e33fcfbab4b85ad09f05fdd3
Eval Count 0
Decode Time 116 ms