Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php  | 
            ||
| 17 | View Code Duplication | class PreCheckoutQuery extends BaseType  | 
            |
| 18 | { | 
            ||
| 19 | /**  | 
            ||
| 20 | * @var array  | 
            ||
| 21 | */  | 
            ||
| 22 | static protected $requiredParams = ['id', 'from', 'currency', 'total_amount', 'invoice_payload'];  | 
            ||
| 23 | |||
| 24 | /**  | 
            ||
| 25 | * @var array  | 
            ||
| 26 | */  | 
            ||
| 27 | static protected $map = [  | 
            ||
| 28 | 'id' => true,  | 
            ||
| 29 | 'from' => User::class,  | 
            ||
| 30 | 'currency' => true,  | 
            ||
| 31 | 'total_amount' => true,  | 
            ||
| 32 | 'invoice_payload' => true,  | 
            ||
| 33 | 'shipping_option_id' => true,  | 
            ||
| 34 | 'order_info' => OrderInfo::class  | 
            ||
| 35 | ];  | 
            ||
| 36 | |||
| 37 | /**  | 
            ||
| 38 | * Unique query identifier  | 
            ||
| 39 | *  | 
            ||
| 40 | * @var string  | 
            ||
| 41 | */  | 
            ||
| 42 | protected $id;  | 
            ||
| 43 | |||
| 44 | /**  | 
            ||
| 45 | * User who sent the query  | 
            ||
| 46 | *  | 
            ||
| 47 | * @var User  | 
            ||
| 48 | */  | 
            ||
| 49 | protected $from;  | 
            ||
| 50 | |||
| 51 | /**  | 
            ||
| 52 | * Three-letter ISO 4217 currency code  | 
            ||
| 53 | *  | 
            ||
| 54 | * @var string  | 
            ||
| 55 | */  | 
            ||
| 56 | protected $currency;  | 
            ||
| 57 | |||
| 58 | /**  | 
            ||
| 59 | * Total price in the smallest units of the currency  | 
            ||
| 60 | *  | 
            ||
| 61 | * @var integer  | 
            ||
| 62 | */  | 
            ||
| 63 | protected $totalAmount;  | 
            ||
| 64 | |||
| 65 | /**  | 
            ||
| 66 | * Bot specified invoice payload  | 
            ||
| 67 | *  | 
            ||
| 68 | * @var string  | 
            ||
| 69 | */  | 
            ||
| 70 | protected $invoicePayload;  | 
            ||
| 71 | |||
| 72 | /**  | 
            ||
| 73 | * Optional. Identifier of the shipping option chosen by the user  | 
            ||
| 74 | *  | 
            ||
| 75 | * @var string  | 
            ||
| 76 | */  | 
            ||
| 77 | protected $shippingOptionId;  | 
            ||
| 78 | |||
| 79 | /**  | 
            ||
| 80 | * Optional. Order info provided by the user  | 
            ||
| 81 | *  | 
            ||
| 82 | * @var OrderInfo  | 
            ||
| 83 | */  | 
            ||
| 84 | protected $orderInfo;  | 
            ||
| 85 | |||
| 86 | /**  | 
            ||
| 87 | * @author MY  | 
            ||
| 88 | * @return string  | 
            ||
| 89 | */  | 
            ||
| 90 | public function getId()  | 
            ||
| 94 | |||
| 95 | /**  | 
            ||
| 96 | * @author MY  | 
            ||
| 97 | * @param string $id  | 
            ||
| 98 | */  | 
            ||
| 99 | public function setId($id)  | 
            ||
| 103 | |||
| 104 | /**  | 
            ||
| 105 | * @author MY  | 
            ||
| 106 | * @return User  | 
            ||
| 107 | */  | 
            ||
| 108 | public function getFrom()  | 
            ||
| 112 | |||
| 113 | /**  | 
            ||
| 114 | * @author MY  | 
            ||
| 115 | * @param User $from  | 
            ||
| 116 | */  | 
            ||
| 117 | public function setFrom($from)  | 
            ||
| 121 | |||
| 122 | /**  | 
            ||
| 123 | * @author MY  | 
            ||
| 124 | * @return string  | 
            ||
| 125 | */  | 
            ||
| 126 | public function getCurrency()  | 
            ||
| 130 | |||
| 131 | /**  | 
            ||
| 132 | * @author MY  | 
            ||
| 133 | * @param string $currency  | 
            ||
| 134 | */  | 
            ||
| 135 | public function setCurrency($currency)  | 
            ||
| 139 | |||
| 140 | /**  | 
            ||
| 141 | * @author MY  | 
            ||
| 142 | * @return int  | 
            ||
| 143 | */  | 
            ||
| 144 | public function getTotalAmount()  | 
            ||
| 148 | |||
| 149 | /**  | 
            ||
| 150 | * @author MY  | 
            ||
| 151 | * @param int $totalAmount  | 
            ||
| 152 | */  | 
            ||
| 153 | public function setTotalAmount($totalAmount)  | 
            ||
| 157 | |||
| 158 | /**  | 
            ||
| 159 | * @author MY  | 
            ||
| 160 | * @return mixed  | 
            ||
| 161 | */  | 
            ||
| 162 | public function getInvoicePayload()  | 
            ||
| 166 | |||
| 167 | /**  | 
            ||
| 168 | * @author MY  | 
            ||
| 169 | * @param mixed $invoicePayload  | 
            ||
| 170 | */  | 
            ||
| 171 | public function setInvoicePayload($invoicePayload)  | 
            ||
| 175 | |||
| 176 | /**  | 
            ||
| 177 | * @author MY  | 
            ||
| 178 | * @return string  | 
            ||
| 179 | */  | 
            ||
| 180 | public function getShippingOptionId()  | 
            ||
| 184 | |||
| 185 | /**  | 
            ||
| 186 | * @author MY  | 
            ||
| 187 | * @param string $shippingOptionId  | 
            ||
| 188 | */  | 
            ||
| 189 | public function setShippingOptionId($shippingOptionId)  | 
            ||
| 193 | |||
| 194 | /**  | 
            ||
| 195 | * @author MY  | 
            ||
| 196 | * @return OrderInfo  | 
            ||
| 197 | */  | 
            ||
| 198 | public function getOrderInfo()  | 
            ||
| 202 | |||
| 203 | /**  | 
            ||
| 204 | * @author MY  | 
            ||
| 205 | * @param OrderInfo $orderInfo  | 
            ||
| 206 | */  | 
            ||
| 207 | public function setOrderInfo($orderInfo)  | 
            ||
| 211 | }  | 
            ||
| 212 |