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\Console\Output\Progress;

use PhpCsFixer\Console\Output\OutputContext;
use PhpCsFixer\FixerFileProcessedEvent;
use Symfony\Component\Console\Helper\ProgressBar;

/**
 * Output writer to show the progress of a FixCommand using progress bar (percentage).
 *
 * @internal
 */
final class PercentageBarOutput implements ProgressOutputInterface
{
    /** @readonly */
    private OutputContext $context;

    private ProgressBar $progressBar;

    public function __construct(OutputContext $context)
    {
        $this->context = $context;

        $this->progressBar = new ProgressBar($context->getOutput(), $this->context->getFilesCount());
        $this->progressBar->setBarCharacter(''); // dark shade character 
        $this->progressBar->setEmptyBarCharacter(''); // light shade character 
        $this->progressBar->setProgressCharacter('');
        $this->progressBar->setFormat('normal');

        $this->progressBar->start();
    }

    /**
     * This class is not intended to be serialized,
     * and cannot be deserialized (see __wakeup method).
     */
    public function __sleep(): array
    {
        throw new \BadMethodCallException('Cannot serialize '.self::class);
    }

    /**
     * Disable the deserialization of the class to prevent attacker executing
     * code by leveraging the __destruct method.
     *
     * @see https://owasp.org/www-community/vulnerabilities/PHP_Object_Injection
     */
    public function __wakeup(): void
    {
        throw new \BadMethodCallException('Cannot unserialize '.self::class);
    }

    public function onFixerFileProcessed(FixerFileProcessedEvent $event): void
    {
        $this->progressBar->advance(1);

        if ($this->progressBar->getProgress() === $this->progressBar->getMaxSteps()) {
            $this->context->getOutput()->write("

");
        }
    }

    public function printLegend(): void {}
}
 ?>

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\Console\Output\Progress;

use PhpCsFixer\Console\Output\OutputContext;
use PhpCsFixer\FixerFileProcessedEvent;
use Symfony\Component\Console\Helper\ProgressBar;

/**
 * Output writer to show the progress of a FixCommand using progress bar (percentage).
 *
 * @internal
 */
final class PercentageBarOutput implements ProgressOutputInterface
{
    /** @readonly */
    private OutputContext $context;

    private ProgressBar $progressBar;

    public function __construct(OutputContext $context)
    {
        $this->context = $context;

        $this->progressBar = new ProgressBar($context->getOutput(), $this->context->getFilesCount());
        $this->progressBar->setBarCharacter(''); // dark shade character \u2593
        $this->progressBar->setEmptyBarCharacter(''); // light shade character \u2591
        $this->progressBar->setProgressCharacter('');
        $this->progressBar->setFormat('normal');

        $this->progressBar->start();
    }

    /**
     * This class is not intended to be serialized,
     * and cannot be deserialized (see __wakeup method).
     */
    public function __sleep(): array
    {
        throw new \BadMethodCallException('Cannot serialize '.self::class);
    }

    /**
     * Disable the deserialization of the class to prevent attacker executing
     * code by leveraging the __destruct method.
     *
     * @see https://owasp.org/www-community/vulnerabilities/PHP_Object_Injection
     */
    public function __wakeup(): void
    {
        throw new \BadMethodCallException('Cannot unserialize '.self::class);
    }

    public function onFixerFileProcessed(FixerFileProcessedEvent $event): void
    {
        $this->progressBar->advance(1);

        if ($this->progressBar->getProgress() === $this->progressBar->getMaxSteps()) {
            $this->context->getOutput()->write("\n\n");
        }
    }

    public function printLegend(): void {}
}

Function Calls

None

Variables

None

Stats

MD5 a0faab389a7ca8fc3b8a4c14c33a6316
Eval Count 0
Decode Time 76 ms