Code Duplication    Length = 15-15 lines in 2 locations

lib/Sii.php 1 location

@@ 162-176 (lines=15) @@
159
            $retry = self::$retry;
160
        if ($args and !is_array($args))
161
            $args = [$args];
162
        if (!self::$verificar_ssl) {
163
            if (self::getAmbiente()==self::PRODUCCION) {
164
                $msg = Estado::get(Estado::ENVIO_SSL_SIN_VERIFICAR);
165
                \sasco\LibreDTE\Log::write(Estado::ENVIO_SSL_SIN_VERIFICAR, $msg, LOG_WARNING);
166
            }
167
            $options = ['stream_context' => stream_context_create([
168
                'ssl' => [
169
                    'verify_peer' => false,
170
                    'verify_peer_name' => false,
171
                    'allow_self_signed' => true
172
                ]
173
            ])];
174
        } else {
175
            $options = [];
176
        }
177
        try {
178
            $soap = new \SoapClient(self::wsdl($wsdl), $options);
179
        } catch (\Exception $e) {

lib/Sii/RegistroCompraVenta.php 1 location

@@ 196-210 (lines=15) @@
193
     */
194
    private function request($request, $args, $retry = 10)
195
    {
196
        if (!\sasco\LibreDTE\Sii::getVerificarSSL()) {
197
            if (\sasco\LibreDTE\Sii::getAmbiente()==\sasco\LibreDTE\Sii::PRODUCCION) {
198
                $msg = \sasco\LibreDTE\Estado::get(\sasco\LibreDTE\Estado::ENVIO_SSL_SIN_VERIFICAR);
199
                \sasco\LibreDTE\Log::write(\sasco\LibreDTE\Estado::ENVIO_SSL_SIN_VERIFICAR, $msg, LOG_WARNING);
200
            }
201
            $options = ['stream_context' => stream_context_create([
202
                'ssl' => [
203
                    'verify_peer' => false,
204
                    'verify_peer_name' => false,
205
                    'allow_self_signed' => true
206
                ]
207
            ])];
208
        } else {
209
            $options = [];
210
        }
211
        try {
212
            $wsdl = self::$wsdl[\sasco\LibreDTE\Sii::getAmbiente()];
213
            $soap = new \SoapClient($wsdl, $options);