private function validate($json)
    {
        $retriever = new JsonSchema\Uri\UriRetriever();

        // Detect phar archives - they don't need the file:// prefix
        $prefix = strpos(__DIR__, 'phar://') === 0 ? '' : 'file://';

        $schema = $retriever->retrieve(
            $prefix . __DIR__ . '/../res/plugin-info-schema.json'
        );


        $validator = new JsonSchema\Validator();
        $validator->check(json_decode(json_encode($json)), $schema);

        if (!$validator->isValid()) {
            $errors = array_map(function($error) {
                return $error['property'] . ': ' . $error['message'];
            }, $validator->getErrors());
            throw new ValidatorException("Json not valid: " . implode(', ', $errors));
        }
    }