sergey-shandar/restapi-core-php-poc · TypeInfo.php
php logo
public function jsonDeserialize($json)
    {
        return $json === null ? null : $this->deserialize(Common::decode($json));
    }
Similar code snippets
1.
luoxiaojun1992/lb_framework · JsonHelper.php
Match rating: 60.98% · See similar code snippets
php logo
public static function decode($json)
    {
        $result = [$json];
        if (static::is_json($json)) {
            $result = json_decode($json, true);
        }
        return $result;
    }
2.
addwiki/mediawiki-datamodel · Log.php
Match rating: 60.96% · See similar code snippets
php logo
public static function jsonDeserialize( $json ) {
		return new self(
			$json['id'],
			$json['type'],
			$json['action'],
			$json['timestamp'],
			$json['user'],
			PageIdentifier::jsonDeserialize( $json['pageidentifier'] ),
			$json['comment'],
			$json['details']
		);
	}
3.
gdbots/pbj-php · JsonSerializer.php
Match rating: 60.56% · See similar code snippets
php logo
public function deserialize($data, array $options = [])
    {
        if (!is_array($data)) {
            $data = json_decode($data, true);
            if (JSON_ERROR_NONE !== json_last_error()) {
                throw new DeserializeMessageFailed($this->getLastErrorMessage());
            }
        }

        return parent::deserialize($data, $options);
    }
4.
wutongwan/laravel-lego · JSON.php
Match rating: 60.2% · See similar code snippets
php logo
protected function decode($json)
    {
        if (is_string($json)) {
            $data = json_decode($json, JSON_OBJECT_AS_ARRAY);

            return is_null($data) ? $json : $data;
        }

        return $json;
    }
5.
bit3archive/php-remote-objects · JsonRpc20Encoder.php
Match rating: 60.13% · See similar code snippets
php logo
public function decodeMethod($string)
	{
		$json = $this->decode($string);

		if (
			!isset($json->jsonrpc) ||
			!isset($json->method)
		) {
			throw new \Exception('Invalid Request', -32600);
		}

		$this->lastDecodeId = $json->id;

		/*
		if (substr($json->method, 0, 4) == 'rpc.') {
			return array(null, null);
		}
		*/

		return array(
			$json->method,
			isset($json->params) ? $json->params : null
		);
	}
6.
Baachi/CouchDB · JSONEncoder.php
Match rating: 59.64% · See similar code snippets
php logo
public static function decode($json)
    {
        set_error_handler(function () use ($json) {
            throw new JsonDecodeException($json);
        });

        $value = json_decode($json, true);

        if (false === $value) {
            throw new JsonDecodeException($json);
        }

        restore_error_handler();

        return $value;
    }
7.
stk2k/net-driver · HttpResponse.php
Match rating: 59.57% · See similar code snippets
php logo
public function jsonDecode()
    {
        $json = json_decode($this->body, true);
        if ($json===null){
            throw new JsonFormatException($this->body);
        }
        return $json;
    }
8.
phpactor/config-loader · JsonDeserializer.php
Match rating: 59.45% · See similar code snippets
php logo
public function deserialize(string $contents): array
    {
        $decoded = json_decode($contents, true);

        if (null === $decoded) {
            throw new CouldNotDeserialize(sprintf(
                'Could not decode JSON: "%s"',
                json_last_error_msg()
            ));
        }

        return $decoded;
    }
9.
FelixOnline/Core · User.php
Match rating: 59.35% · See similar code snippets
php logo
public static function jsonDecode($string)
    {
        if ($string) {
            $json = json_decode($string, true);
            // if json_decode failed
            if ($json === null) {
                self::jsonLastError();
            }
            return $json;
        } else {
            return false;
        }
    }
10.
addwiki/mediawiki-datamodel · LogList.php
Match rating: 58.99% · See similar code snippets
php logo
public static function jsonDeserialize( $json ) {
		$self = new LogList();
		foreach ( $json as $logJson ) {
			$self->addLog( Log::jsonDeserialize( $logJson ) );
		}
		return $self;
	}