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  | 
            ||
| 14 | class Account extends MoipResource  | 
            ||
| 15 | { | 
            ||
| 16 | /**  | 
            ||
| 17 | * Path accounts API.  | 
            ||
| 18 | *  | 
            ||
| 19 | * @const string  | 
            ||
| 20 | */  | 
            ||
| 21 | const PATH = 'accounts';  | 
            ||
| 22 | |||
| 23 | /**  | 
            ||
| 24 | * Standard country .  | 
            ||
| 25 | *  | 
            ||
| 26 | * @const string  | 
            ||
| 27 | */  | 
            ||
| 28 | const ADDRESS_COUNTRY = 'BRA';  | 
            ||
| 29 | |||
| 30 | /**  | 
            ||
| 31 | * Standard document type.  | 
            ||
| 32 | *  | 
            ||
| 33 | * @const string  | 
            ||
| 34 | */  | 
            ||
| 35 | const TAX_DOCUMENT = 'CPF';  | 
            ||
| 36 | |||
| 37 | /**  | 
            ||
| 38 | * Default Account Type  | 
            ||
| 39 | *  | 
            ||
| 40 | * @var string  | 
            ||
| 41 | */  | 
            ||
| 42 | const ACCOUNT_TYPE = 'MERCHANT';  | 
            ||
| 43 | |||
| 44 | /**  | 
            ||
| 45 | * Initialize a new instance.  | 
            ||
| 46 | */  | 
            ||
| 47 | public function initialize()  | 
            ||
| 54 | |||
| 55 | /**  | 
            ||
| 56 | * Add a new address to the account.  | 
            ||
| 57 | *  | 
            ||
| 58 | * @param string $street Street address.  | 
            ||
| 59 | * @param string $number Number address.  | 
            ||
| 60 | * @param string $district Neighborhood address.  | 
            ||
| 61 | * @param string $city City address.  | 
            ||
| 62 | * @param string $state State address.  | 
            ||
| 63 | * @param string $zip The zip code billing address.  | 
            ||
| 64 | * @param string $complement Address complement.  | 
            ||
| 65 | * @param string $country Country ISO-alpha3 format, BRA example.  | 
            ||
| 66 | *  | 
            ||
| 67 | * @return $this  | 
            ||
| 68 | */  | 
            ||
| 69 | public function addAddress($street, $number, $district, $city, $state, $zip, $complement = null, $country = self::ADDRESS_COUNTRY)  | 
            ||
| 85 | |||
| 86 | /**  | 
            ||
| 87 | * Create a new account.  | 
            ||
| 88 | *  | 
            ||
| 89 | * @return \stdClass  | 
            ||
| 90 | */  | 
            ||
| 91 | |||
| 92 | /**  | 
            ||
| 93 | * @return stdClass  | 
            ||
| 94 | */  | 
            ||
| 95 | public function create()  | 
            ||
| 99 | |||
| 100 | /**  | 
            ||
| 101 | * Find a account.  | 
            ||
| 102 | *  | 
            ||
| 103 | * @param string $moip_id  | 
            ||
| 104 | *  | 
            ||
| 105 | * @return \Moip\Resource\Account  | 
            ||
| 106 | */  | 
            ||
| 107 | public function get($moip_id)  | 
            ||
| 111 | |||
| 112 | /**  | 
            ||
| 113 | * Get account id.  | 
            ||
| 114 | *  | 
            ||
| 115 | * @return string The buyer id.  | 
            ||
| 116 | */  | 
            ||
| 117 | public function getId()  | 
            ||
| 121 | |||
| 122 | /**  | 
            ||
| 123 | * Get account address.  | 
            ||
| 124 | *  | 
            ||
| 125 | * @return \stdClass Account's address.  | 
            ||
| 126 | */  | 
            ||
| 127 | public function getAddress()  | 
            ||
| 131 | |||
| 132 | /**  | 
            ||
| 133 | * Get account fullname.  | 
            ||
| 134 | *  | 
            ||
| 135 | * @return string Account's full name.  | 
            ||
| 136 | */  | 
            ||
| 137 | public function getFullname()  | 
            ||
| 141 | |||
| 142 | /**  | 
            ||
| 143 | * Get birth date from account.  | 
            ||
| 144 | *  | 
            ||
| 145 | * @return \DateTime|null Date of birth of the credit card holder.  | 
            ||
| 146 | */  | 
            ||
| 147 | public function getBirthDate()  | 
            ||
| 151 | |||
| 152 | /**  | 
            ||
| 153 | * Get phone area code from account.  | 
            ||
| 154 | *  | 
            ||
| 155 | * @return int DDD telephone.  | 
            ||
| 156 | */  | 
            ||
| 157 | public function getPhoneAreaCode()  | 
            ||
| 161 | |||
| 162 | /**  | 
            ||
| 163 | * Get phone country code from account.  | 
            ||
| 164 | *  | 
            ||
| 165 | * @return int Country code.  | 
            ||
| 166 | */  | 
            ||
| 167 | public function getPhoneCountryCode()  | 
            ||
| 171 | |||
| 172 | /**  | 
            ||
| 173 | * Get phone number from account.  | 
            ||
| 174 | *  | 
            ||
| 175 | * @return int Telephone number.  | 
            ||
| 176 | */  | 
            ||
| 177 | public function getPhoneNumber()  | 
            ||
| 181 | |||
| 182 | /**  | 
            ||
| 183 | * Get tax document type from account.  | 
            ||
| 184 | *  | 
            ||
| 185 | * @return string Type of value: CPF and CNPJ  | 
            ||
| 186 | */  | 
            ||
| 187 | public function getTaxDocumentType()  | 
            ||
| 191 | |||
| 192 | /**  | 
            ||
| 193 | * Get tax document number from account.  | 
            ||
| 194 | *  | 
            ||
| 195 | * @return string Document Number.  | 
            ||
| 196 | */  | 
            ||
| 197 | public function getTaxDocumentNumber()  | 
            ||
| 201 | |||
| 202 | /**  | 
            ||
| 203 | * Get account type.  | 
            ||
| 204 | *  | 
            ||
| 205 | * @return string Document Number.  | 
            ||
| 206 | */  | 
            ||
| 207 | public function getType()  | 
            ||
| 211 | |||
| 212 | /**  | 
            ||
| 213 | * Mount the seller structure from account.  | 
            ||
| 214 | *  | 
            ||
| 215 | * @param \stdClass $response  | 
            ||
| 216 | *  | 
            ||
| 217 | * @return \Moip\Resource\Account Account data  | 
            ||
| 218 | */  | 
            ||
| 219 | protected function populate(stdClass $response)  | 
            ||
| 262 | |||
| 263 | /**  | 
            ||
| 264 | * Set e-mail from account.  | 
            ||
| 265 | *  | 
            ||
| 266 | * @param string $email Email account.  | 
            ||
| 267 | *  | 
            ||
| 268 | * @return \Moip\Resource\Account  | 
            ||
| 269 | */  | 
            ||
| 270 | public function setEmail($email)  | 
            ||
| 276 | |||
| 277 | /**  | 
            ||
| 278 | * Set name from account.  | 
            ||
| 279 | *  | 
            ||
| 280 | * @param string $name Account's person name.  | 
            ||
| 281 | *  | 
            ||
| 282 | * @return \Moip\Resource\Account  | 
            ||
| 283 | */  | 
            ||
| 284 | public function setName($name)  | 
            ||
| 290 | |||
| 291 | /**  | 
            ||
| 292 | * Set name from account.  | 
            ||
| 293 | *  | 
            ||
| 294 | * @param string $name Account's person name.  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 295 | *  | 
            ||
| 296 | * @return \Moip\Resource\Account  | 
            ||
| 297 | */  | 
            ||
| 298 | public function setLastName($lastname)  | 
            ||
| 304 | |||
| 305 | /**  | 
            ||
| 306 | * Set birth date from account.  | 
            ||
| 307 | *  | 
            ||
| 308 | * @param \DateTime|string $birthDate Date of birth of the credit card holder.  | 
            ||
| 309 | *  | 
            ||
| 310 | * @return \Moip\Resource\Account  | 
            ||
| 311 | */  | 
            ||
| 312 | View Code Duplication | public function setBirthDate($birthDate)  | 
            |
| 322 | |||
| 323 | /**  | 
            ||
| 324 | * Set tax document from account.  | 
            ||
| 325 | *  | 
            ||
| 326 | * @param string $number Document number.  | 
            ||
| 327 | * @param string $type Document type.  | 
            ||
| 328 | *  | 
            ||
| 329 | * @return \Moip\Resource\Account  | 
            ||
| 330 | */  | 
            ||
| 331 | View Code Duplication | public function setTaxDocument($number, $type = self::TAX_DOCUMENT)  | 
            |
| 339 | |||
| 340 | /**  | 
            ||
| 341 | * Set phone from account.  | 
            ||
| 342 | *  | 
            ||
| 343 | * @param int $areaCode DDD telephone.  | 
            ||
| 344 | * @param int $number Telephone number.  | 
            ||
| 345 | * @param int $countryCode Country code.  | 
            ||
| 346 | *  | 
            ||
| 347 | * @return \Moip\Resource\Account  | 
            ||
| 348 | */  | 
            ||
| 349 | public function setPhone($areaCode, $number, $countryCode = 55)  | 
            ||
| 358 | |||
| 359 | /**  | 
            ||
| 360 | * Set identity document from account.  | 
            ||
| 361 | *  | 
            ||
| 362 | * @param string $number Número do documento.  | 
            ||
| 363 | * @param string $issuer Emissor do documento.  | 
            ||
| 364 | * @param \DateTime|string $birthDate $issueDate Data de emissão do documento.  | 
            ||
| 365 | * @param string $type Tipo do documento. Valores possíveis: RG.  | 
            ||
| 366 | *  | 
            ||
| 367 | * @return \Moip\Resource\Account  | 
            ||
| 368 | */  | 
            ||
| 369 | public function setIdentityDocument($number, $issuer, $issueDate, $type = 'RG')  | 
            ||
| 379 | |||
| 380 | /**  | 
            ||
| 381 | * Set account type. Possible values: CONSUMER, MERCHANT.  | 
            ||
| 382 | *  | 
            ||
| 383 | * @param string $type  | 
            ||
| 384 | *  | 
            ||
| 385 | * @return \Moip\Resource\Account  | 
            ||
| 386 | */  | 
            ||
| 387 | public function setType($type)  | 
            ||
| 393 | }  | 
            ||
| 394 | 
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italyis not defined by the methodfinale(...).The most likely cause is that the parameter was removed, but the annotation was not.