public function validateMetadata(EventInterface $event) {
        $request = $event->getRequest();
        $metadata = $request->getContent();

        if (empty($metadata)) {
            throw new InvalidArgumentException('Missing JSON data', 400);
        } else {
            $metadata = json_decode($metadata, true);

            if ($metadata === null) {
                throw new InvalidArgumentException('Invalid JSON data', 400);
            }

            foreach (array_keys($metadata) as $key) {
                if (strpos($key, '.') === false) {
                    continue;
                }

                throw new InvalidArgumentException('Invalid metadata. Dot characters (\'.\') are not allowed in metadata keys', 400);
            }
        }
    }
public function validateMetadata(EventInterface $event) {
        $request = $event->getRequest();
        $metadata = $request->getContent();

        if (empty($metadata)) {
            throw new InvalidArgumentException('Missing JSON data', 400);
        } else {
            $metadata = json_decode($metadata, true);

            if ($metadata === null) {
                throw new InvalidArgumentException('Invalid JSON data', 400);
            }

            foreach (array_keys($metadata) as $key) {
                if (strpos($key, '.') === false) {
                    continue;
                }

                throw new InvalidArgumentException('Invalid metadata. Dot characters (\'.\') are not allowed in metadata keys', 400);
            }
        }
    }
public function validateMetadata ( EventInterface $ event ) { $ request = $ event -> getRequest ( ) ; $ metadata = $ request -> getContent ( ) ; if ( empty ( $ metadata ) ) { throw new InvalidArgumentException ( 'Missing JSON data' , 400 ) ; } else { $ metadata = json_decode ( $ metadata , true ) ; if ( $ metadata === null ) { throw new InvalidArgumentException ( 'Invalid JSON data' , 400 ) ; } foreach ( array_keys ( $ metadata ) as $ key ) { if ( strpos ( $ key , '.' ) === false ) { continue ; } throw new InvalidArgumentException ( 'Invalid metadata. Dot characters (\'.\') are not allowed in metadata keys' , 400 ) ; } } }
Validate metadata found in the request body

@param EventInterface $event The event instance
@throws InvalidArgumentException
Validate metadata found in the request body