Code Duplication    Length = 25-25 lines in 2 locations

includes/libraries/wpinv-euvat/class-wpinv-euvat.php 2 locations

@@ 586-610 (lines=25) @@
583
        return false;
584
    }
585
586
    public static function geoip2_country_record( $ip_address ) {
587
        try {
588
            $reader = self::geoip2_country_reader();
589
590
            if ( $reader ) {
591
                $record = $reader->country( $ip_address );
592
                
593
                if ( !empty( $record->country->isoCode ) ) {
594
                    return $record;
595
                }
596
            }
597
        } catch(\InvalidArgumentException $e) {
598
            wpinv_error_log( $e->getMessage(), 'GeoIp2 Lookup( ' . $ip_address . ' )' );
599
            
600
            return false;
601
        } catch(\GeoIp2\Exception\AddressNotFoundException $e) {
602
            wpinv_error_log( $e->getMessage(), 'GeoIp2 Lookup( ' . $ip_address . ' )' );
603
            
604
            return false;
605
        } catch( Exception $e ) {
606
            return false;
607
        }
608
        
609
        return false;
610
    }
611
612
    public static function geoip2_city_record( $ip_address ) {
613
        try {
@@ 612-636 (lines=25) @@
609
        return false;
610
    }
611
612
    public static function geoip2_city_record( $ip_address ) {
613
        try {
614
            $reader = self::geoip2_city_reader();
615
616
            if ( $reader ) {
617
                $record = $reader->city( $ip_address );
618
                
619
                if ( !empty( $record->country->isoCode ) ) {
620
                    return $record;
621
                }
622
            }
623
        } catch(\InvalidArgumentException $e) {
624
            wpinv_error_log( $e->getMessage(), 'GeoIp2 Lookup( ' . $ip_address . ' )' );
625
            
626
            return false;
627
        } catch(\GeoIp2\Exception\AddressNotFoundException $e) {
628
            wpinv_error_log( $e->getMessage(), 'GeoIp2 Lookup( ' . $ip_address . ' )' );
629
            
630
            return false;
631
        } catch( Exception $e ) {
632
            return false;
633
        }
634
        
635
        return false;
636
    }
637
638
    public static function geoip2_country_code( $ip_address ) {
639
        $record = self::geoip2_country_record( $ip_address );