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 |
||
| 13 | final class Request implements RequestInterface |
||
| 14 | { |
||
| 15 | use MessageTrait; |
||
| 16 | use RequestTrait; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param string $method HTTP method |
||
| 20 | * @param string|UriInterface $uri URI |
||
| 21 | * @param array $headers Request headers |
||
| 22 | * @param string|resource|StreamInterface|null $body Request body |
||
| 23 | * @param string $version Protocol version |
||
| 24 | */ |
||
| 25 | 73 | View Code Duplication | public function __construct(string $method, $uri, array $headers = [], $body = null, string $version = '1.1') |
| 45 | } |
||
| 46 |