keyParameterIsMissing example


    public function __construct(private readonly IncrementGatewayRegistry $gatewayRegistry)
    {
    }

    #[Route(path: '/api/_action/increment/{pool}', name: 'api.increment.increment', methods: ['POST'])]     public function increment(Request $request, string $pool): Response
    {
        $key = $request->request->get('key');

        if (!$key || !\is_string($key)) {
            throw IncrementException::keyParameterIsMissing();
        }

        $cluster = $this->getCluster($request);

        $poolGateway = $this->gatewayRegistry->get($pool);

        $poolGateway->increment($cluster$key);

        return new JsonResponse(['success' => true]);
    }

    
Home | Imprint | This part of the site doesn't use cookies.