Code Duplication    Length = 9-13 lines in 2 locations

class/sms.php 1 location

@@ 150-158 (lines=9) @@
147
			, 150, 151, 152, 157, 158, 159, 187, 188);
148
		$ar_cu = array(130, 131, 132, 155, 156, 185, 186);
149
		$ar_ct = array(133, 153, 180, 189);
150
		foreach ($ar_dest as $dest) {
151
			$i = intval(substr($dest, 0, 3));
152
			if (in_array($i, $ar_cm))
153
				$ar_data['cnt_cm'] ++;
154
			elseif (in_array($i, $ar_cu))
155
				$ar_data['cnt_cu'] ++;
156
			elseif (in_array($i, $ar_ct))
157
				$ar_data['cnt_ct'] ++;
158
		}
159
160
		// Save to db
161
		$this->oDb->Write('sms_stat', $ar_data, 'I');

src/Fwlib/Net/Sms/SmsLogger.php 1 location

@@ 51-63 (lines=13) @@
48
        $arCu = [130, 131, 132, 145, 155, 156, 185, 186];
49
        $arCt = [133, 153, 180, 181, 189];
50
51
        foreach ($arDest as $dest) {
52
            $i = intval(substr($dest, 0, 3));
53
54
            if (in_array($i, $arCm)) {
55
                $ar['cm'] ++;
56
57
            } elseif (in_array($i, $arCu)) {
58
                $ar['cu'] ++;
59
60
            } elseif (in_array($i, $arCt)) {
61
                $ar['ct'] ++;
62
            }
63
        }
64
65
        return $ar;
66
    }