original_string: private function generateLabeledPrices(array $prices)
      {
          $response = [];
  
          foreach ($prices as $item => $price)
          {
              if ($price < 1)
              {
                  $this->logger->warning('Invalid or negative price passed to "sendInvoice"');
                  throw new \Exception('Invalid or negative price passed to "sendInvoice"');
              }
  
              // Format the price value following the official guideline:
              // https://core.telegram.org/bots/api#labeledprice
              $formatted_price = intval($price * 100);
              array_push($response, ['label' => $item, 'amount' => $formatted_price]);
          }
  
          return json_encode($response);
      }
code: private function generateLabeledPrices(array $prices)
      {
          $response = [];
  
          foreach ($prices as $item => $price)
          {
              if ($price < 1)
              {
                  $this->logger->warning('Invalid or negative price passed to "sendInvoice"');
                  throw new \Exception('Invalid or negative price passed to "sendInvoice"');
              }
  
              // Format the price value following the official guideline:
              // https://core.telegram.org/bots/api#labeledprice
              $formatted_price = intval($price * 100);
              array_push($response, ['label' => $item, 'amount' => $formatted_price]);
          }
  
          return json_encode($response);
      }
code_tokens: private function generateLabeledPrices ( array $ prices ) { $ response = [ ] ; foreach ( $ prices as $ item => $ price ) { if ( $ price < 1 ) { $ this -> logger -> warning ( 'Invalid or negative price passed to "sendInvoice"' ) ; throw new \ Exception ( 'Invalid or negative price passed to "sendInvoice"' ) ; } // Format the price value following the official guideline: // https://core.telegram.org/bots/api#labeledprice $ formatted_price = intval ( $ price * 100 ) ; array_push ( $ response , [ 'label' => $ item , 'amount' => $ formatted_price ] ) ; } return json_encode ( $ response ) ; }
docstring: \brief Convert a matrix of prices in a JSON string object accepted by 'sendInvoice'.
  @param $prices The matrix of prices.
  @return string The JSON string response.
docstring_tokens: \ brief Convert a matrix of prices in a JSON string object accepted by sendInvoice .