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 declare(strict_types=1); /* * This file is part of PHP CS Fixer. * * (c) Fabien..

Decoded Output download

<?php

declare(strict_types=1);

/*
 * This file is part of PHP CS Fixer.
 *
 * (c) Fabien Potencier <[email protected]>
 *     Dariusz Rumiski <[email protected]>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace PhpCsFixer\Linter;

/**
 * @author Dariusz Rumiski <[email protected]>
 *
 * @internal
 */
final class CachingLinter implements LinterInterface
{
    private LinterInterface $sublinter;

    /**
     * @var array<string, LintingResultInterface>
     */
    private array $cache = [];

    public function __construct(LinterInterface $linter)
    {
        $this->sublinter = $linter;
    }

    public function isAsync(): bool
    {
        return $this->sublinter->isAsync();
    }

    public function lintFile(string $path): LintingResultInterface
    {
        $checksum = md5(file_get_contents($path));

        if (!isset($this->cache[$checksum])) {
            $this->cache[$checksum] = $this->sublinter->lintFile($path);
        }

        return $this->cache[$checksum];
    }

    public function lintSource(string $source): LintingResultInterface
    {
        $checksum = md5($source);

        if (!isset($this->cache[$checksum])) {
            $this->cache[$checksum] = $this->sublinter->lintSource($source);
        }

        return $this->cache[$checksum];
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

declare(strict_types=1);

/*
 * This file is part of PHP CS Fixer.
 *
 * (c) Fabien Potencier <[email protected]>
 *     Dariusz Rumiski <[email protected]>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace PhpCsFixer\Linter;

/**
 * @author Dariusz Rumiski <[email protected]>
 *
 * @internal
 */
final class CachingLinter implements LinterInterface
{
    private LinterInterface $sublinter;

    /**
     * @var array<string, LintingResultInterface>
     */
    private array $cache = [];

    public function __construct(LinterInterface $linter)
    {
        $this->sublinter = $linter;
    }

    public function isAsync(): bool
    {
        return $this->sublinter->isAsync();
    }

    public function lintFile(string $path): LintingResultInterface
    {
        $checksum = md5(file_get_contents($path));

        if (!isset($this->cache[$checksum])) {
            $this->cache[$checksum] = $this->sublinter->lintFile($path);
        }

        return $this->cache[$checksum];
    }

    public function lintSource(string $source): LintingResultInterface
    {
        $checksum = md5($source);

        if (!isset($this->cache[$checksum])) {
            $this->cache[$checksum] = $this->sublinter->lintSource($source);
        }

        return $this->cache[$checksum];
    }
}

Function Calls

None

Variables

None

Stats

MD5 0f621de2596e2c27bd42dc4c56161601
Eval Count 0
Decode Time 87 ms