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 |
||
| 68 | class Config |
||
| 69 | { |
||
| 70 | const ENV_ALL = 'all'; |
||
| 71 | |||
| 72 | const ENV_PROD = 'prod'; |
||
| 73 | |||
| 74 | const ENV_PREP = 'prep'; |
||
| 75 | |||
| 76 | const ENV_DEV = 'dev'; |
||
| 77 | |||
| 78 | const ENV_LOCAL = 'local'; |
||
| 79 | |||
| 80 | const RUNTIME_ALL = 0; |
||
| 81 | |||
| 82 | const RUNTIME_CONSOLE = 1; |
||
| 83 | |||
| 84 | const RUNTIME_WEB = 2; |
||
| 85 | |||
| 86 | public function __construct($id, $basePath, array $applicationConfig = []) |
||
| 93 | |||
| 94 | /** |
||
| 95 | * Undocumented function |
||
| 96 | * |
||
| 97 | * @param [type] $config |
||
|
|
|||
| 98 | * @return ConfigDefinition |
||
| 99 | */ |
||
| 100 | public function application($config) |
||
| 104 | |||
| 105 | /** |
||
| 106 | * Undocumented function |
||
| 107 | * |
||
| 108 | * @param [type] $id |
||
| 109 | * @param [type] $config |
||
| 110 | * @return ConfigDefinition |
||
| 111 | */ |
||
| 112 | public function module($id, $config) |
||
| 116 | |||
| 117 | /** |
||
| 118 | * Undocumented function |
||
| 119 | * |
||
| 120 | * @param [type] $id |
||
| 121 | * @param [type] $config |
||
| 122 | * @param [type] $runtime |
||
| 123 | * @return ConfigDefinition |
||
| 124 | */ |
||
| 125 | public function component($id, $config, $runtime = self::RUNTIME_ALL) |
||
| 129 | |||
| 130 | /** |
||
| 131 | * Undocumented function |
||
| 132 | * |
||
| 133 | * @param [type] $id |
||
| 134 | * @param [type] $config |
||
| 135 | * @return ConfigDefinition |
||
| 136 | */ |
||
| 137 | public function webComponent($id, $config) |
||
| 141 | |||
| 142 | /** |
||
| 143 | * Undocumented function |
||
| 144 | * |
||
| 145 | * @param [type] $id |
||
| 146 | * @param [type] $config |
||
| 147 | * @return ConfigDefinition |
||
| 148 | */ |
||
| 149 | public function consoleComponent($id, $config) |
||
| 153 | |||
| 154 | private $_definitions = []; |
||
| 155 | |||
| 156 | /** |
||
| 157 | * Undocumented function |
||
| 158 | * |
||
| 159 | * @param ConfigDefinition $definition |
||
| 160 | * @return ConfigDefinition |
||
| 161 | */ |
||
| 162 | private function addDefinition(ConfigDefinition $definition) |
||
| 168 | |||
| 169 | private $_isCliRuntime; |
||
| 170 | |||
| 171 | /** |
||
| 172 | * Whether runtime is cli or not |
||
| 173 | * |
||
| 174 | * @return boolean |
||
| 175 | */ |
||
| 176 | public function isCliRuntime() |
||
| 184 | |||
| 185 | public function setCliRuntime($value) |
||
| 189 | |||
| 190 | public function toArray(array $envs = [self::ENV_ALL]) |
||
| 212 | |||
| 213 | private function appendConfig(&$config, ConfigDefinition $definition) |
||
| 235 | } |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.