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); /** * @license Apache 2.0 */ namespace OpenApi\Tests\Pr..

Decoded Output download

<?php declare(strict_types=1);

/**
 * @license Apache 2.0
 */

namespace OpenApi\Tests\Processors;

use OpenApi\Processors\CleanUnusedComponents;
use OpenApi\Tests\OpenApiTestCase;

class CleanUnusedComponentsTest extends OpenApiTestCase
{
    public static function countCases(): iterable
    {
        $defaultProcessors = static::processors([CleanUnusedComponents::class]);

        return [
            'var-default' => [$defaultProcessors, 'UsingVar.php', 2, 5],
            'var-clean' => [array_merge($defaultProcessors, [new CleanUnusedComponents()]), 'UsingVar.php', 0, 2],
            'unreferenced-default' => [$defaultProcessors, 'Unreferenced.php', 2, 11],
            'unreferenced-clean' => [array_merge($defaultProcessors, [new CleanUnusedComponents()]), 'Unreferenced.php', 0, 5],
        ];
    }

    /**
     * @dataProvider countCases
     */
    public function testCounts(array $processors, string $fixture, int $expectedSchemaCount, int $expectedAnnotationCount): void
    {
        $analysis = $this->analysisFromFixtures([$fixture], $processors);

        $this->assertCount($expectedSchemaCount, $analysis->openapi->components->schemas);
        $this->assertCount($expectedAnnotationCount, $analysis->annotations);
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php declare(strict_types=1);

/**
 * @license Apache 2.0
 */

namespace OpenApi\Tests\Processors;

use OpenApi\Processors\CleanUnusedComponents;
use OpenApi\Tests\OpenApiTestCase;

class CleanUnusedComponentsTest extends OpenApiTestCase
{
    public static function countCases(): iterable
    {
        $defaultProcessors = static::processors([CleanUnusedComponents::class]);

        return [
            'var-default' => [$defaultProcessors, 'UsingVar.php', 2, 5],
            'var-clean' => [array_merge($defaultProcessors, [new CleanUnusedComponents()]), 'UsingVar.php', 0, 2],
            'unreferenced-default' => [$defaultProcessors, 'Unreferenced.php', 2, 11],
            'unreferenced-clean' => [array_merge($defaultProcessors, [new CleanUnusedComponents()]), 'Unreferenced.php', 0, 5],
        ];
    }

    /**
     * @dataProvider countCases
     */
    public function testCounts(array $processors, string $fixture, int $expectedSchemaCount, int $expectedAnnotationCount): void
    {
        $analysis = $this->analysisFromFixtures([$fixture], $processors);

        $this->assertCount($expectedSchemaCount, $analysis->openapi->components->schemas);
        $this->assertCount($expectedAnnotationCount, $analysis->annotations);
    }
}

Function Calls

None

Variables

None

Stats

MD5 38c3c910ea0d7423a99143aa6a4662b6
Eval Count 0
Decode Time 75 ms