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 |
||
40 | class MailTemplateRepository extends AbstractRepository |
||
41 | { |
||
42 | |||
|
|||
43 | /** |
||
44 | * @Inject("config") |
||
45 | 2 | * @var array |
|
46 | */ |
||
47 | 2 | protected $appConfig; |
|
48 | 2 | ||
49 | /** |
||
50 | * @deprecated 呼び出し元で制御する |
||
51 | * @param $id |
||
52 | * @return MailTemplate|null|object |
||
53 | */ |
||
54 | 2 | public function findOrCreate($id) |
|
65 | |||
66 | /** |
||
67 | * 書き込みパスの取得 |
||
68 | * |
||
69 | * @param boolean $isUser |
||
70 | * @return string |
||
71 | */ |
||
72 | public function getWriteTemplatePath() |
||
76 | |||
77 | /** |
||
78 | * 読み込みファイルの取得 |
||
79 | * |
||
80 | * 1. template_realdir |
||
81 | * app/template/{template_code} |
||
82 | * 2. template_default_readldir |
||
83 | * src/Eccube/Resource/template/default |
||
84 | * |
||
85 | * @param string $fileName |
||
86 | * |
||
87 | * @return array |
||
88 | */ |
||
89 | View Code Duplication | public function getReadTemplateFile($fileName) |
|
108 | } |
||
109 |