Code Duplication    Length = 11-11 lines in 2 locations

src/Api.php 1 location

@@ 376-386 (lines=11) @@
373
374
        $apiUrl .= '?' . $postQueryStr;
375
376
        if ($jsonEncode) {
377
            if (is_array($data)) {
378
                if (!defined('JSON_UNESCAPED_UNICODE')) {
379
                    // 解决php 5.3版本 json转码时 中文编码问题.
380
                    $data = json_encode($data);
381
                    $data = preg_replace("#\\\u([0-9a-f]{4})#ie", "iconv('UCS-2BE', 'UTF-8', pack('H4', '\\1'))", $data);
382
                } else {
383
                    $data = json_encode($data, JSON_UNESCAPED_UNICODE);
384
                }
385
            }
386
        }
387
388
        $apiUrl = urldecode($apiUrl);
389
        $ch     = curl_init();

src/ComponentApi.php 1 location

@@ 359-369 (lines=11) @@
356
357
        $apiUrl .= '?' . $postQueryStr;
358
359
        if ($jsonEncode) {
360
            if (is_array($data)) {
361
                if (!defined('JSON_UNESCAPED_UNICODE')) {
362
                    // 解决php 5.3版本 json转码时 中文编码问题.
363
                    $data = json_encode($data);
364
                    $data = preg_replace("#\\\u([0-9a-f]{4})#ie", "iconv('UCS-2BE', 'UTF-8', pack('H4', '\\1'))", $data);
365
                } else {
366
                    $data = json_encode($data, JSON_UNESCAPED_UNICODE);
367
                }
368
            }
369
        }
370
371
        $apiUrl = urldecode($apiUrl);
372
        $ch     = curl_init();