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\Bridge\Monolog\Processor;

use Monolog\LogRecord;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;

/**
 * The base class for security token processors.
 *
 * @author Dany Maillard <[email protected]>
 * @author Igor Timoshenko <[email protected]>
 *
 * @internal
 */
abstract class AbstractTokenProcessor
{
    public function __construct(
        protected TokenStorageInterface $tokenStorage,
    ) {
    }

    abstract protected function getKey(): string;

    abstract protected function getToken(): ?TokenInterface;

    public function __invoke(LogRecord $record): LogRecord
    {
        $record->extra[$this->getKey()] = null;

        if (null !== $token = $this->getToken()) {
            $record->extra[$this->getKey()] = [
                'authenticated' => (bool) $token->getUser(),
                'roles' => $token->getRoleNames(),
            ];

            $record->extra[$this->getKey()]['user_identifier'] = $token->getUserIdentifier();
        }

        return $record;
    }
}
 ?>

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\Bridge\Monolog\Processor;

use Monolog\LogRecord;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;

/**
 * The base class for security token processors.
 *
 * @author Dany Maillard <[email protected]>
 * @author Igor Timoshenko <[email protected]>
 *
 * @internal
 */
abstract class AbstractTokenProcessor
{
    public function __construct(
        protected TokenStorageInterface $tokenStorage,
    ) {
    }

    abstract protected function getKey(): string;

    abstract protected function getToken(): ?TokenInterface;

    public function __invoke(LogRecord $record): LogRecord
    {
        $record->extra[$this->getKey()] = null;

        if (null !== $token = $this->getToken()) {
            $record->extra[$this->getKey()] = [
                'authenticated' => (bool) $token->getUser(),
                'roles' => $token->getRoleNames(),
            ];

            $record->extra[$this->getKey()]['user_identifier'] = $token->getUserIdentifier();
        }

        return $record;
    }
}

Function Calls

None

Variables

None

Stats

MD5 fb0bfad3569258c36febbf68bdf76ff2
Eval Count 0
Decode Time 96 ms