original_string: public function pay($points, ContextInterface $context)
      {
          // decrease user points
          $this->userTable->payPoints($context->getUser()->getId(), $points);
  
          // add usage entry
          $this->usageTable->create([
              'route_id' => $context->getRouteId(),
              'user_id' => $context->getUser()->getId(),
              'app_id' => $context->getApp()->getId(),
              'points' => $points,
              'insert_date' => new \DateTime(),
          ]);
  
          // dispatch payed event
          $userContext = UserContext::newContext(
              $context->getUser()->getId(),
              $context->getApp()->getId()
          );
  
          $this->eventDispatcher->dispatch(PlanEvents::PAY, new PayedEvent($points, $userContext));
      }
code: public function pay($points, ContextInterface $context)
      {
          // decrease user points
          $this->userTable->payPoints($context->getUser()->getId(), $points);
  
          // add usage entry
          $this->usageTable->create([
              'route_id' => $context->getRouteId(),
              'user_id' => $context->getUser()->getId(),
              'app_id' => $context->getApp()->getId(),
              'points' => $points,
              'insert_date' => new \DateTime(),
          ]);
  
          // dispatch payed event
          $userContext = UserContext::newContext(
              $context->getUser()->getId(),
              $context->getApp()->getId()
          );
  
          $this->eventDispatcher->dispatch(PlanEvents::PAY, new PayedEvent($points, $userContext));
      }
code_tokens: public function pay ( $ points , ContextInterface $ context ) { // decrease user points $ this -> userTable -> payPoints ( $ context -> getUser ( ) -> getId ( ) , $ points ) ; // add usage entry $ this -> usageTable -> create ( [ 'route_id' => $ context -> getRouteId ( ) , 'user_id' => $ context -> getUser ( ) -> getId ( ) , 'app_id' => $ context -> getApp ( ) -> getId ( ) , 'points' => $ points , 'insert_date' => new \ DateTime ( ) , ] ) ; // dispatch payed event $ userContext = UserContext :: newContext ( $ context -> getUser ( ) -> getId ( ) , $ context -> getApp ( ) -> getId ( ) ) ; $ this -> eventDispatcher -> dispatch ( PlanEvents :: PAY , new PayedEvent ( $ points , $ userContext ) ) ; }
docstring: Method which is called in case a user visits a route which cost a
  specific amount of points. This method decreases the points from the
  user account
  
  @param integer $points
  @param \Fusio\Engine\ContextInterface $context
docstring_tokens: Method which is called in case a user visits a route which cost a specific amount of points . This method decreases the points from the user account