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 PhpRedisJSON library * * @project phpredis-json * @..

Decoded Output download

<?php
/**
 * This file is part of PhpRedisJSON library
 *
 * @project   phpredis-json
 * @author    Rafael Campoy <[email protected]>
 * @copyright 2019 Rafael Campoy <[email protected]>
 * @license   MIT
 * @link      https://github.com/averias/phpredis-json
 *
 * Copyright and license information, is included in
 * the LICENSE file that is distributed with this source code.
 */

namespace Averias\RedisJson\Parser\Response;

use Averias\RedisJson\Exception\ResponseException;
use Averias\RedisJson\Parser\ParserInterface;

class DecodeArrayOfJson extends BaseJsonDecoderParser implements ParserInterface
{
    /**
     * @param array $response
     * @return array
     * @throws ResponseException
     */
    public function parse($response)
    {
        if (!is_array($response)) {
            throw new ResponseException(sprintf("expected array response but got '%s'", gettype($response)));
        }

        $decodedResult = [];
        foreach ($response as $value) {
            $decodedResult[] = $this->decodeIfNotFalse($value);
        }

        return $decodedResult;
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php
/**
 * This file is part of PhpRedisJSON library
 *
 * @project   phpredis-json
 * @author    Rafael Campoy <[email protected]>
 * @copyright 2019 Rafael Campoy <[email protected]>
 * @license   MIT
 * @link      https://github.com/averias/phpredis-json
 *
 * Copyright and license information, is included in
 * the LICENSE file that is distributed with this source code.
 */

namespace Averias\RedisJson\Parser\Response;

use Averias\RedisJson\Exception\ResponseException;
use Averias\RedisJson\Parser\ParserInterface;

class DecodeArrayOfJson extends BaseJsonDecoderParser implements ParserInterface
{
    /**
     * @param array $response
     * @return array
     * @throws ResponseException
     */
    public function parse($response)
    {
        if (!is_array($response)) {
            throw new ResponseException(sprintf("expected array response but got '%s'", gettype($response)));
        }

        $decodedResult = [];
        foreach ($response as $value) {
            $decodedResult[] = $this->decodeIfNotFalse($value);
        }

        return $decodedResult;
    }
}

Function Calls

None

Variables

None

Stats

MD5 7f9a5e9726479bf1f632c33413c43e67
Eval Count 0
Decode Time 108 ms