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 | class DepthTest extends BaseTest  | 
            ||
| 18 | { | 
            ||
| 19 | /**  | 
            ||
| 20 | * @var \eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Depth  | 
            ||
| 21 | */  | 
            ||
| 22 | private $matcher;  | 
            ||
| 23 | |||
| 24 | protected function setUp()  | 
            ||
| 29 | |||
| 30 | /**  | 
            ||
| 31 | * @dataProvider matchLocationProvider  | 
            ||
| 32 | * @covers \eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Depth::matchLocation  | 
            ||
| 33 | * @covers \eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued::setMatchingConfig  | 
            ||
| 34 | *  | 
            ||
| 35 | * @param int|int[] $matchingConfig  | 
            ||
| 36 | * @param \eZ\Publish\API\Repository\Values\Content\Location $location  | 
            ||
| 37 | * @param bool $expectedResult  | 
            ||
| 38 | */  | 
            ||
| 39 | public function testMatchLocation($matchingConfig, Location $location, $expectedResult)  | 
            ||
| 44 | |||
| 45 | public function matchLocationProvider()  | 
            ||
| 80 | |||
| 81 | /**  | 
            ||
| 82 | * @dataProvider matchContentInfoProvider  | 
            ||
| 83 | * @covers eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\Depth::matchContentInfo  | 
            ||
| 84 | * @covers eZ\Publish\Core\MVC\Symfony\Matcher\ContentBased\MultipleValued::setMatchingConfig  | 
            ||
| 85 | * @covers \eZ\Publish\Core\MVC\RepositoryAware::setRepository  | 
            ||
| 86 | *  | 
            ||
| 87 | * @param int|int[] $matchingConfig  | 
            ||
| 88 | * @param \eZ\Publish\API\Repository\Repository $repository  | 
            ||
| 89 | * @param bool $expectedResult  | 
            ||
| 90 | */  | 
            ||
| 91 | View Code Duplication | public function testMatchContentInfo($matchingConfig, Repository $repository, $expectedResult)  | 
            |
| 100 | |||
| 101 | public function matchContentInfoProvider()  | 
            ||
| 126 | |||
| 127 | /**  | 
            ||
| 128 | * Returns a Repository mock configured to return the appropriate Location object with given parent location Id.  | 
            ||
| 129 | *  | 
            ||
| 130 | * @param int $depth  | 
            ||
| 131 | *  | 
            ||
| 132 | * @return \PHPUnit_Framework_MockObject_MockObject  | 
            ||
| 133 | */  | 
            ||
| 134 | View Code Duplication | private function generateRepositoryMockForDepth($depth)  | 
            |
| 161 | }  | 
            ||
| 162 |