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); namespace GraphQL\Tests\Executor\TestClasses; use GraphQL..

Decoded Output download

<?php declare(strict_types=1);

namespace GraphQL\Tests\Executor\TestClasses;

use GraphQL\Error\Error;
use GraphQL\Error\SerializationError;
use GraphQL\Language\AST\Node;
use GraphQL\Language\Printer;
use GraphQL\Type\Definition\ScalarType;
use GraphQL\Utils\Utils;

final class ComplexScalar extends ScalarType
{
    public string $name = 'ComplexScalar';

    /** @throws SerializationError */
    public function serialize($value): string
    {
        if ($value === 'DeserializedValue') {
            return 'SerializedValue';
        }

        $notComplexScalar = Utils::printSafe($value);
        throw new SerializationError("Cannot serialize value as ComplexScalar: {$notComplexScalar}");
    }

    /** @throws Error */
    public function parseValue($value): string
    {
        if ($value === 'SerializedValue') {
            return 'DeserializedValue';
        }

        $notComplexScalar = Utils::printSafeJson($value);
        throw new Error("Cannot represent value as ComplexScalar: {$notComplexScalar}");
    }

    public function parseLiteral(Node $valueNode, ?array $variables = null): string
    {
        $value = property_exists($valueNode, 'value')
            ? $valueNode->value
            : null;

        if ($value === 'SerializedValue') {
            return 'DeserializedValue';
        }

        $notComplexScalar = Printer::doPrint($value);
        throw new Error("Cannot represent literal as ComplexScalar: {$notComplexScalar}");
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php declare(strict_types=1);

namespace GraphQL\Tests\Executor\TestClasses;

use GraphQL\Error\Error;
use GraphQL\Error\SerializationError;
use GraphQL\Language\AST\Node;
use GraphQL\Language\Printer;
use GraphQL\Type\Definition\ScalarType;
use GraphQL\Utils\Utils;

final class ComplexScalar extends ScalarType
{
    public string $name = 'ComplexScalar';

    /** @throws SerializationError */
    public function serialize($value): string
    {
        if ($value === 'DeserializedValue') {
            return 'SerializedValue';
        }

        $notComplexScalar = Utils::printSafe($value);
        throw new SerializationError("Cannot serialize value as ComplexScalar: {$notComplexScalar}");
    }

    /** @throws Error */
    public function parseValue($value): string
    {
        if ($value === 'SerializedValue') {
            return 'DeserializedValue';
        }

        $notComplexScalar = Utils::printSafeJson($value);
        throw new Error("Cannot represent value as ComplexScalar: {$notComplexScalar}");
    }

    public function parseLiteral(Node $valueNode, ?array $variables = null): string
    {
        $value = property_exists($valueNode, 'value')
            ? $valueNode->value
            : null;

        if ($value === 'SerializedValue') {
            return 'DeserializedValue';
        }

        $notComplexScalar = Printer::doPrint($value);
        throw new Error("Cannot represent literal as ComplexScalar: {$notComplexScalar}");
    }
}

Function Calls

None

Variables

None

Stats

MD5 be4c504a049e89de8d08ab334c0e6bd1
Eval Count 0
Decode Time 92 ms