private function getCommandDefinition(string $serialized): array
    {
        if (\trim($serialized) === '') {
            throw new CommandSerializationException('Malformed JSON serialized command: empty string');
        }

        $definition = \json_decode($serialized, true, 512, static::JSON_DECODE_OPTIONS);

        // @codeCoverageIgnoreStart
        if ($definition === null || \json_last_error() !== \JSON_ERROR_NONE) {
            throw new CommandSerializationException(\sprintf(
                'Command deserialization failed due to error %s: %s',
                \json_last_error(),
                \lcfirst(\json_last_error_msg())
            ));
        }
        // @codeCoverageIgnoreEnd

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

        return $definition;
    }
private function getCommandDefinition(string $serialized): array
    {
        if (\trim($serialized) === '') {
            throw new CommandSerializationException('Malformed JSON serialized command: empty string');
        }

        $definition = \json_decode($serialized, true, 512, static::JSON_DECODE_OPTIONS);

        // @codeCoverageIgnoreStart
        if ($definition === null || \json_last_error() !== \JSON_ERROR_NONE) {
            throw new CommandSerializationException(\sprintf(
                'Command deserialization failed due to error %s: %s',
                \json_last_error(),
                \lcfirst(\json_last_error_msg())
            ));
        }
        // @codeCoverageIgnoreEnd

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

        return $definition;
    }
private function getCommandDefinition ( string $ serialized ) : array { if ( \ trim ( $ serialized ) === '' ) { throw new CommandSerializationException ( 'Malformed JSON serialized command: empty string' ) ; } $ definition = \ json_decode ( $ serialized , true , 512 , static :: JSON_DECODE_OPTIONS ) ; // @codeCoverageIgnoreStart if ( $ definition === null || \ json_last_error ( ) !== \ JSON_ERROR_NONE ) { throw new CommandSerializationException ( \ sprintf ( 'Command deserialization failed due to error %s: %s' , \ json_last_error ( ) , \ lcfirst ( \ json_last_error_msg ( ) ) ) ) ; } // @codeCoverageIgnoreEnd if ( ! \ is_array ( $ definition ) || ! isset ( $ definition [ 'class' ] , $ definition [ 'payload' ] ) || \ count ( \ array_diff ( \ array_keys ( $ definition ) , [ 'class' , 'payload' ] ) ) !== 0 || ! \ is_string ( $ definition [ 'class' ] ) || ! \ is_array ( $ definition [ 'payload' ] ) ) { throw new CommandSerializationException ( 'Malformed JSON serialized command' ) ; } return $ definition ; }
Get command definition from serialization.

@param string $serialized

@throws CommandSerializationException

@return array<string, mixed>
Get command definition from serialization .