Code Duplication    Length = 13-14 lines in 2 locations

src/Core/Inline.php 2 locations

@@ 83-95 (lines=13) @@
80
     * @param string $error The error message if something went wrong.
81
     * @return bool True on success.
82
     */
83
    public function answerPreCheckoutQuery(bool $ok = true, string $error = null) {
84
        if (!isset($this->_pre_checkout_query_id)) {
85
            throw new BotException('Callback query ID not set, wrong update');
86
        }
87
88
        $parameters = [
89
            'pre_checkout_query_id' => $this->_pre_checkout_query_id,
90
            'ok' => $ok,
91
            'error_message' => $error
92
        ];
93
94
        return $this->execRequest('answerPreCheckoutQuery?' . http_build_query($parameters));
95
    }
96
97
    /**
98
     * \brief Send an update once the user has confirmed their shipping details.
@@ 105-118 (lines=14) @@
102
     * For example: array('FedEx' => ['Dispatch' => 15.90, 'Italy Taxes' => 2.50])
103
     * @return bool True on success.
104
     */
105
    public function answerShippingQuery(bool $ok = true, string $error = null, array $shipping_options) {
106
        if (!isset($this->_shipping_query_id)) {
107
            throw new BotException('Callback query ID not set, wrong update');
108
        }
109
110
        $parameters = [
111
            'shipping_query_id' => $this->_shipping_query_id,
112
            'ok' => $ok,
113
            'error_message' => $error,
114
            'shipping_options' => $this->generateShippingOptions($shipping_options)
115
        ];
116
117
        return $this->execRequest('answerShippingQuery?' . http_build_query($parameters));
118
    }
119
120
    /**
121
     * \brief Generate shipping options to pass to 'answerShippingQuery'.