public function checkVersionConstraintAction(Request $request)
    {
        try {
            $inputData = new JsonArray($request->getContent());
        } catch (\Exception $exception) {
            return new JsonResponse(
                [
                    'status' => 'ERROR',
                    'error'  => 'invalid payload'
                ],
                JsonResponse::HTTP_BAD_REQUEST
            );
        }

        $versionParser = new VersionParser();

        if (!$inputData->has('constraint')) {
            return new JsonResponse(
                [
                    'status' => 'ERROR',
                    'error'  => 'invalid payload'
                ],
                JsonResponse::HTTP_BAD_REQUEST
            );
        }

        try {
            $versionParser->parseConstraints($inputData->get('constraint'));
        } catch (\Exception $exception) {
            return new JsonResponse(
                [
                    'status' => 'ERROR',
                    'error'  => $exception->getMessage()
                ],
                JsonResponse::HTTP_OK
            );
        }

        return new JsonResponse(
            [
                'status' => 'OK',
            ],
            JsonResponse::HTTP_OK
        );
    }
public function checkVersionConstraintAction(Request $request)
    {
        try {
            $inputData = new JsonArray($request->getContent());
        } catch (\Exception $exception) {
            return new JsonResponse(
                [
                    'status' => 'ERROR',
                    'error'  => 'invalid payload'
                ],
                JsonResponse::HTTP_BAD_REQUEST
            );
        }

        $versionParser = new VersionParser();

        if (!$inputData->has('constraint')) {
            return new JsonResponse(
                [
                    'status' => 'ERROR',
                    'error'  => 'invalid payload'
                ],
                JsonResponse::HTTP_BAD_REQUEST
            );
        }

        try {
            $versionParser->parseConstraints($inputData->get('constraint'));
        } catch (\Exception $exception) {
            return new JsonResponse(
                [
                    'status' => 'ERROR',
                    'error'  => $exception->getMessage()
                ],
                JsonResponse::HTTP_OK
            );
        }

        return new JsonResponse(
            [
                'status' => 'OK',
            ],
            JsonResponse::HTTP_OK
        );
    }
public function checkVersionConstraintAction ( Request $ request ) { try { $ inputData = new JsonArray ( $ request -> getContent ( ) ) ; } catch ( \ Exception $ exception ) { return new JsonResponse ( [ 'status' => 'ERROR' , 'error' => 'invalid payload' ] , JsonResponse :: HTTP_BAD_REQUEST ) ; } $ versionParser = new VersionParser ( ) ; if ( ! $ inputData -> has ( 'constraint' ) ) { return new JsonResponse ( [ 'status' => 'ERROR' , 'error' => 'invalid payload' ] , JsonResponse :: HTTP_BAD_REQUEST ) ; } try { $ versionParser -> parseConstraints ( $ inputData -> get ( 'constraint' ) ) ; } catch ( \ Exception $ exception ) { return new JsonResponse ( [ 'status' => 'ERROR' , 'error' => $ exception -> getMessage ( ) ] , JsonResponse :: HTTP_OK ) ; } return new JsonResponse ( [ 'status' => 'OK' , ] , JsonResponse :: HTTP_OK ) ; }
Try to validate the version constraint.

@param Request $request The request.

@return JsonResponse

@throws \RuntimeException For invalid user classes.

@ApiDoc(
section="misc",
statusCodes = {
200 = "When everything worked out ok",
400 = "When the request payload was invalid."
},
authentication = true,
authenticationRoles = {
"ROLE_NONE"
}
)
@ApiDescription(
request={
"constraint" = {
"description" = "The constraint to test.",
"dataType" = "string",
"required" = true
}
},
response={
"status" = {
"dataType" = "choice",
"description" = "OK or ERROR",
"format" = "['OK', 'ERROR']",
},
"error" = {
"dataType" = "string",
"description" = "The error message (if any).",
}
}
)
Try to validate the version constraint .