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\DependencyInjection\Argument;

use Symfony\Component\DependencyInjection\ServiceLocator as BaseServiceLocator;

/**
 * @author Nicolas Grekas <[email protected]>
 *
 * @internal
 */
class ServiceLocator extends BaseServiceLocator
{
    public function __construct(
        private \Closure $factory,
        private array $serviceMap,
        private ?array $serviceTypes = null,
    ) {
        parent::__construct($serviceMap);
    }

    public function get(string $id): mixed
    {
        return match (\count($this->serviceMap[$id] ?? [])) {
            0 => parent::get($id),
            1 => $this->serviceMap[$id][0],
            default => ($this->factory)(...$this->serviceMap[$id]),
        };
    }

    public function getProvidedServices(): array
    {
        return $this->serviceTypes ??= array_map(fn () => '?', $this->serviceMap);
    }
}
 ?>

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\DependencyInjection\Argument;

use Symfony\Component\DependencyInjection\ServiceLocator as BaseServiceLocator;

/**
 * @author Nicolas Grekas <[email protected]>
 *
 * @internal
 */
class ServiceLocator extends BaseServiceLocator
{
    public function __construct(
        private \Closure $factory,
        private array $serviceMap,
        private ?array $serviceTypes = null,
    ) {
        parent::__construct($serviceMap);
    }

    public function get(string $id): mixed
    {
        return match (\count($this->serviceMap[$id] ?? [])) {
            0 => parent::get($id),
            1 => $this->serviceMap[$id][0],
            default => ($this->factory)(...$this->serviceMap[$id]),
        };
    }

    public function getProvidedServices(): array
    {
        return $this->serviceTypes ??= array_map(fn () => '?', $this->serviceMap);
    }
}

Function Calls

None

Variables

None

Stats

MD5 dfa7fc9cfe72f793441af7b665189ea2
Eval Count 0
Decode Time 281 ms