Code Duplication    Length = 10-13 lines in 3 locations

sdk/ECPay.Logistics.Integration.php 3 locations

@@ 1560-1572 (lines=13) @@
1557
         * @param		bool	$AllowEmpty	是否允許空值
1558
         * @version		1.0.1012
1559
         */
1560
        private function ValidateURL($Name, $Value, $MaxLength = 200, $AllowEmpty = false)
1561
        {
1562
            if (empty($Value)) {
1563
                // 是否允許空值
1564
                $this->IsAllowEmpty($Name, $AllowEmpty);
1565
            } else {
1566
                // 格式檢查
1567
                $this->IsValidFormat($Name, '/^(http|https):\/\/+/', $Value);
1568
1569
                // 長度檢查
1570
                $this->IsOverLength($Name, $this->StringLength($Value, $this->Encode), $MaxLength);
1571
            }
1572
        }
1573
1574
        /**
1575
         *  字串檢查.
@@ 1585-1594 (lines=10) @@
1582
         * @param		bool	$AllowEmpty	是否允許空值
1583
         * @version		1.0.1012
1584
         */
1585
        private function ValidateString($Name, $Value, $MaxLength = 1, $AllowEmpty = false)
1586
        {
1587
            if (empty($Value)) {
1588
                // 是否允許空值
1589
                $this->IsAllowEmpty($Name, $AllowEmpty);
1590
            } else {
1591
                // 長度檢查
1592
                $this->IsOverLength($Name, $this->StringLength($Value, $this->Encode), $MaxLength);
1593
            }
1594
        }
1595
1596
        /**
1597
         *  金額檢查.
@@ 1674-1686 (lines=13) @@
1671
         * @param		bool	$AllowEmpty	是否允許空值
1672
         * @version		1.0.1012
1673
         */
1674
        private function ValidateEmail($Name, $Value, $MaxLength = 100, $AllowEmpty = false)
1675
        {
1676
            if (empty($Value)) {
1677
                // 是否允許空值
1678
                $this->IsAllowEmpty($Name, $AllowEmpty);
1679
            } else {
1680
                // 長度檢查
1681
                $this->IsOverLength($Name, $this->StringLength($Value, $this->Encode), $MaxLength);
1682
1683
                // 格式檢查
1684
                $this->IsValidFormat($Name, '/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9]{2,4}$/', $Value);
1685
            }
1686
        }
1687
1688
        /**
1689
         *  郵遞區號檢查.