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 |
||
| 12 | class JobBinaryInternal extends OperatorResource implements Listable, Retrievable, Creatable, Deletable |
||
| 13 | { |
||
| 14 | public $name; |
||
| 15 | public $tenantId; |
||
| 16 | public $createdAt; |
||
| 17 | public $updatedAt; |
||
| 18 | public $isProtected; |
||
| 19 | public $isPublic; |
||
| 20 | public $datasize; |
||
| 21 | public $id; |
||
| 22 | |||
| 23 | protected $resourceKey = 'job_binary_internal'; |
||
| 24 | protected $resourcesKey = 'binaries'; |
||
| 25 | |||
| 26 | protected $aliases = [ |
||
| 27 | 'tenant_id' => 'tenantId', |
||
| 28 | 'created_at' => 'createdAt', |
||
| 29 | 'updated_at' => 'updatedAt', |
||
| 30 | 'is_protected' => 'isProtected', |
||
| 31 | 'is_public' => 'isPublic', |
||
| 32 | ]; |
||
| 33 | |||
| 34 | public function retrieve() |
||
| 39 | |||
| 40 | View Code Duplication | public function create(array $userOptions): Creatable |
|
| 49 | |||
| 50 | public function delete() |
||
| 54 | |||
| 55 | public function update() |
||
| 60 | |||
| 61 | public function downloadData(): StreamInterface |
||
| 66 | } |
||
| 67 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.