@param string $payloadJson

@return Claim\ClaimInterface[]
@throws \InvalidArgumentException
169670
protected function parsePayload($payloadJson)
    {
        $claims = [];
        $payload = json_decode($payloadJson, true);

        if (!is_array($payload)) {
            throw new \InvalidArgumentException('Not a valid payload of JWT string passed for deserialization');
        }

        foreach ($payload as $name => $value) {
            $claim = $this->claimFactory->get($name);
            $claim->setValue($value);
            $claims[] = $claim;
        }

        return $claims;
    }
548173
public function serialize($object)
    {
        if (!is_object($object)) {
            throw new \InvalidArgumentException('Argument must be an object');
        }

        $reflectedObject = new \ReflectionObject($object);
        $reflectedProperties = $reflectedObject->getProperties();

        $array = array();

        foreach ($reflectedProperties as $property) {
            $value = $this->getValue($object, $property);

            if (null !== $value) {
                if (!is_scalar($value)) {
                    $value = $this->normalize($value);
                }

                $array[$this->formatter->toMongoKey($property->getName())] = $value;
            }
        }

        return $array;
    }
600740
private function parseJsonFile(string $file): array
    {
        if (!is_file($file)) {
            throw new \InvalidArgumentException("$file is not a file");
        }

        $json = json_decode(file_get_contents($file), true);

        if (null === $json) {
            throw new \RuntimeException("File $file cannot be decoded");
        }

        return $json;
    }
867175
public function build(array $buildSubject) {
        $paymentDO  = $this->subjectReader->readPayment($buildSubject);
        $payment    = $paymentDO->getPayment();

        if($payment instanceof Payment) {
            $chargeId = $payment->getParentTransactionId();

            if($chargeId === null) {
                throw new InvalidArgumentException('Parent transaction ID is empty.');
            }

            return compact('chargeId');
        }

        return [];
    }
145824
public function jsonSerialize()
    {
        return [
            'message' => CustomAmqpMessage::getMessageProperties($this->message),
            'persistent' => $this->persistent,
            'mandatory' => $this->mandatory,
            'immediate' => $this->immediate
        ];
    }
355804
public function parse($payload)
    {
        if ($payload) {
            try {
                $xml = simplexml_load_string($payload, 'SimpleXMLElement', (LIBXML_VERSION >= 20700) ? (LIBXML_PARSEHUGE | LIBXML_NOCDATA) : LIBXML_NOCDATA);
                $ns = ['' => null] + $xml->getDocNamespaces(true);
                return $this->recursive_parse($xml, $ns);
            } catch (\Exception $ex) {
                throw new ParserException('Failed To Parse XML');
            }
        }

        return [];
    }
243995
private function getEventDefinition(string $serialized): array
    {
        $definition = $this->getDeserializationDefinition($serialized);

        if (!isset($definition['class'], $definition['payload'], $definition['attributes'])
            || \count(\array_diff(\array_keys($definition), ['class', 'payload', 'attributes'])) !== 0
            || !\is_string($definition['class'])
            || !\is_array($definition['payload'])
            || !\is_array($definition['attributes'])
        ) {
            throw new EventSerializationException('Malformed JSON serialized event');
        }

        return $definition;
    }
1351716
protected function parseHeaders($headersJson)
    {
        $parameters = [];
        $headers = json_decode($headersJson, true);

        if (!is_array($headers) || empty($headers)) {
            throw new \InvalidArgumentException('Not a valid header of JWT string passed for deserialization');
        }

        foreach ($headers as $name => $value) {
            $parameter = $this->headerParameterFactory->get($name);
            $parameter->setValue($value);
            $parameters[] = $parameter;
        }

        return  $parameters;
    }
126855
public function getJson($key)
    {
        $signature = array();
        $signature['protected'] = self::base64Encode(Parser::encode($this->headers));
        $signature['payload']   = self::base64Encode($this->claim);
        $signature['signature'] = $this->getEncodedSignature($key);

        return Parser::encode($signature);
    }
398311
protected function setSubmittedJson($field)
    {
        $json = $this->getSubmitted($field);

        if (isset($json)) {
            $decoded = json_decode($json, true);
            if (json_last_error() === JSON_ERROR_NONE) {
                $this->setSubmitted($field, $decoded);
            } else {
                $decoded = json_decode(base64_decode($json), true);
                if (json_last_error() !== JSON_ERROR_NONE) {
                    throw new InvalidArgumentException('Failed to decode the submitted JSON string');
                }
                $this->setSubmitted($field, $decoded);
            }
        }
    }
1216633
public function serialize(PayloadInterface $payload)
    {
        if ($payload instanceof AdvancedSerializeInterface) {
            $payload->beforeSerialize($this->serializer);
        }

        $serializedPayload = $this->serializer->serialize($payload, 'json');

        if (!$serializedPayload || !is_string($serializedPayload)) {
            throw new \RuntimeException(sprintf(
                'Failed to serialize payload; expected it to be a string, got: %s',
                var_export($serializedPayload, true)
            ));
        }

        return json_decode($serializedPayload, true);
    }
897585
protected function serialize($payload)
    {
        // convert identifier to Doctrine object
        if (is_array($payload) || is_scalar($payload)) {
            // just use the id when no keys are given (Doctrine expects an array like [id: 1234]
            if (is_array($payload) && is_numeric(key($payload))) {
                $payload = current($payload);
            }

            $payload = $this->doctrine->getRepository($this->className)->find($payload);
        }

        // anything else is just wrong at this point
        if (!is_object($payload) || !($payload instanceof $this->className)) {
            throw new \RuntimeException(
                sprintf('Expecting object of type %s, but got %s', $this->className, var_export($payload, true))
            );
        }

        return parent::serialize($payload);
    }
1204227
protected function parseEventAndPayload($event, $payload)
    {
        if (is_object($event)) {
            list($payload, $event) = [[$event], get_class($event)];
        }

        return [$event, array_wrap($payload)];
    }
704551
public function send($message): array
    {
        if (\is_array($message)) {
            $message = CloudMessage::fromArray($message);
        }

        if (!($message instanceof Message)) {
            throw new InvalidArgumentException(
                'Unsupported message type. Use an array or a class implementing %s'.Message::class
            );
        }
        $response = $this->messagingApi->sendMessage($message);

        return JSON::decode((string) $response->getBody(), true);
    }
260183
public function serialize($object)
    {
        if (!$this->canHandle(get_class($object))) {
            throw new \InvalidArgumentException();
        }

        return [ $object->getTimestamp(), $object->getTimezone() ];
    }
40725
public function fromString($token)
    {
        $segments = explode('.', $token);

        if (count($segments) == 3)
        {
            list($header, $payload, $signature) = $segments;

            $this->_header    = $this->_fromJson($this->_fromBase64url($header));
            $this->_claims    = $this->_fromJson($this->_fromBase64url($payload));
            $this->_signature = $this->_fromBase64url($signature);

            if(isset($this->_header['alg'])) {
                $this->setAlgorithm($this->_header['alg']);
            } else {
                $this->setAlgorithm('none');
            }
        }
        else throw new InvalidArgumentException(sprintf('The token "%s" is an invalid JWT', $token));

        return $this;
    }
752247
public function findAndValidateJsonRpcMethodDefinition(ContainerBuilder $container) : array
    {
        $definitionList = [];

        $taggedServiceList = $container->findTaggedServiceIds(JsonRpcHttpServerExtension::JSONRPC_METHOD_TAG);

        foreach ($taggedServiceList as $serviceId => $tagAttributeList) {
            $this->validateJsonRpcMethodDefinition($serviceId, $container->getDefinition($serviceId));

            foreach ($tagAttributeList as $tagAttributeKey => $tagAttributeData) {
                $this->validateJsonRpcMethodTagAttributes($serviceId, $tagAttributeData);
                $methodName = $tagAttributeData[JsonRpcHttpServerExtension::JSONRPC_METHOD_TAG_METHOD_NAME_KEY];
                $definitionList[$serviceId][] = $methodName;
            }
        }

        return $definitionList;
    }