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 |
||
7 | */ |
||
8 | |||
9 | namespace Povils\Figlet\Tests; |
||
10 | |||
11 | use Povils\Figlet\Figlet; |
||
12 | use PHPUnit_Framework_TestCase as TestCase; |
||
13 | |||
14 | /** |
||
15 | * Class FigletTest |
||
16 | */ |
||
17 | class FigletTest extends TestCase |
||
18 | { |
||
19 | public function testRender_Default() |
||
26 | |||
27 | public function testRender_SlantFont() |
||
35 | |||
36 | public function testRender_StretchedAndColorized() |
||
48 | |||
49 | /** |
||
50 | * @expectedException InvalidArgumentException |
||
51 | */ |
||
52 | public function testRender_UndefinedFontColor() |
||
59 | |||
60 | /** |
||
61 | * @expectedException InvalidArgumentException |
||
62 | */ |
||
63 | public function testRender_UndefinedBackgroundColor() |
||
70 | |||
71 | public function testRender_ChangeFontAndCachedLetters() |
||
82 | |||
83 | public function testRender_NewFontDir() |
||
95 | |||
96 | /** |
||
97 | * @expectedException Exception |
||
98 | */ |
||
99 | public function testRender_BandFont() |
||
109 | |||
110 | /** |
||
111 | * @return string |
||
112 | */ |
||
113 | private function getDefaultBigFontText() |
||
125 | |||
126 | /** |
||
127 | * @return string |
||
128 | */ |
||
129 | private function getModifiedDefaultBigFontText($fontColor, $backgroundColor) |
||
143 | |||
144 | private function getSlantFontText() |
||
145 | { |
||
146 | return |
||
156 |