Code Duplication    Length = 24-24 lines in 2 locations

app/Support/Tencent/XgPush/XingeApp.php 2 locations

@@ 620-643 (lines=24) @@
617
        return $params;
618
    }
619
620
    public function BatchSetTag($tagTokenPairs)
621
    {
622
        $ret = array('ret_code' => -1);
623
624
        foreach ($tagTokenPairs as $pair) {
625
            if (!($pair instanceof TagTokenPair)) {
626
                $ret['err_msg'] = 'tag-token pair type error!';
627
                return $ret;
628
            }
629
            if (!$this->ValidateToken($pair->token)) {
630
                $ret['err_msg'] = sprintf("invalid token %s", $pair->token);
631
                return $ret;
632
            }
633
        }
634
        $params = $this->InitParams();
635
636
        $tag_token_list = array();
637
        foreach ($tagTokenPairs as $pair) {
638
            array_push($tag_token_list, array($pair->tag, $pair->token));
639
        }
640
        $params['tag_token_list'] = json_encode($tag_token_list);
641
642
        return $this->callRestful(self::RESTAPI_BATCHSETTAG, $params);
643
    }
644
645
    public function BatchDelTag($tagTokenPairs)
646
    {
@@ 645-668 (lines=24) @@
642
        return $this->callRestful(self::RESTAPI_BATCHSETTAG, $params);
643
    }
644
645
    public function BatchDelTag($tagTokenPairs)
646
    {
647
        $ret = array('ret_code' => -1);
648
649
        foreach ($tagTokenPairs as $pair) {
650
            if (!($pair instanceof TagTokenPair)) {
651
                $ret['err_msg'] = 'tag-token pair type error!';
652
                return $ret;
653
            }
654
            if (!$this->ValidateToken($pair->token)) {
655
                $ret['err_msg'] = sprintf("invalid token %s", $pair->token);
656
                return $ret;
657
            }
658
        }
659
        $params = $this->InitParams();
660
661
        $tag_token_list = array();
662
        foreach ($tagTokenPairs as $pair) {
663
            array_push($tag_token_list, array($pair->tag, $pair->token));
664
        }
665
        $params['tag_token_list'] = json_encode($tag_token_list);
666
667
        return $this->callRestful(self::RESTAPI_BATCHDELTAG, $params);
668
    }
669
670
    public function QueryInfoOfToken($deviceToken)
671
    {