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  | 
            ||
| 18 | class Pools extends Api  | 
            ||
| 19 | { | 
            ||
| 20 | /**  | 
            ||
| 21 | * List pools  | 
            ||
| 22 | * List configured pools  | 
            ||
| 23 | *  | 
            ||
| 24 | * @param string $organization_identifier  | 
            ||
| 25 | */  | 
            ||
| 26 | public function pools($organization_identifier)  | 
            ||
| 30 | |||
| 31 | /**  | 
            ||
| 32 | * Create a pool  | 
            ||
| 33 | * Create a new pool  | 
            ||
| 34 | *  | 
            ||
| 35 | * @param string $organization_identifier  | 
            ||
| 36 | * @param string $name Object name  | 
            ||
| 37 | * @param array $origins A list of origins contained in the pool.  | 
            ||
| 38 | * Traffic destined to the pool is balanced across all  | 
            ||
| 39 | * available origins contained in the pool (as long as the pool  | 
            ||
| 40 | * is considered available).  | 
            ||
| 41 | * @param string|null $description Object description  | 
            ||
| 42 | * @param bool|null $enabled Whether this pool is enabled or not.  | 
            ||
| 43 | * @param string|null $monitor ID of the monitor object to use for monitoring the health  | 
            ||
| 44 | * status of origins inside this pool.  | 
            ||
| 45 | * @param string|null $notification_email ID of the notifier object to use for notifications relating  | 
            ||
| 46 | * to the health status of origins inside this pool.  | 
            ||
| 47 | */  | 
            ||
| 48 | View Code Duplication | public function create($organization_identifier, $name, $origins, $description = null, $enabled = null, $monitor = null, $notification_email = null)  | 
            |
| 61 | |||
| 62 | /**  | 
            ||
| 63 | * Pool details  | 
            ||
| 64 | * Fetch a single configured pool  | 
            ||
| 65 | *  | 
            ||
| 66 | * @param string $organization_identifier  | 
            ||
| 67 | * @param string $identifier  | 
            ||
| 68 | */  | 
            ||
| 69 | public function details($organization_identifier, $identifier)  | 
            ||
| 73 | |||
| 74 | /**  | 
            ||
| 75 | * Modify a pool  | 
            ||
| 76 | * Modify a configured pool  | 
            ||
| 77 | *  | 
            ||
| 78 | * @param string $organization_identifier  | 
            ||
| 79 | * @param string $identifier  | 
            ||
| 80 | * @param string $name Object name  | 
            ||
| 81 | * @param array $origins A list of origins contained in the pool.  | 
            ||
| 82 | * Traffic destined to the pool is balanced across all  | 
            ||
| 83 | * available origins contained in the pool (as long as the pool  | 
            ||
| 84 | * is considered available).  | 
            ||
| 85 | * @param string|null $description Object description  | 
            ||
| 86 | * @param bool|null $enabled Whether this pool is enabled or not.  | 
            ||
| 87 | * @param string|null $monitor ID of the monitor object to use for monitoring the health  | 
            ||
| 88 | * status of origins inside this pool.  | 
            ||
| 89 | * @param string|null $notification_email ID of the notifier object to use for notifications relating  | 
            ||
| 90 | * to the health status of origins inside this pool.  | 
            ||
| 91 | */  | 
            ||
| 92 | View Code Duplication | public function update($organization_identifier, $identifier, $name, $origins, $description = null, $enabled = null, $monitor = null, $notification_email = null)  | 
            |
| 105 | |||
| 106 | /**  | 
            ||
| 107 | * Delete a pool  | 
            ||
| 108 | * Delete a configured pool  | 
            ||
| 109 | *  | 
            ||
| 110 | * @param string $identifier  | 
            ||
| 111 | */  | 
            ||
| 112 | public function delete_pool($organization_identifier, $identifier)  | 
            ||
| 116 | }  | 
            ||
| 117 |