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);
    }
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);
    }
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 ) ; }
\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.
\ brief Convert a matrix of prices in a JSON string object accepted by sendInvoice .