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:
Complex classes like SQLServerPlatform often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use SQLServerPlatform, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
42 | class SQLServerPlatform extends AbstractPlatform |
||
43 | { |
||
44 | /** |
||
45 | * {@inheritdoc} |
||
46 | */ |
||
47 | 6 | public function getCurrentDateSQL() |
|
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | 3 | public function getCurrentTimeSQL() |
|
59 | |||
60 | /** |
||
61 | * Returns an expression that converts an expression of one data type to another. |
||
62 | * |
||
63 | * @param string $dataType The target native data type. Alias data types cannot be used. |
||
64 | * @param string $expression The SQL expression to convert. |
||
65 | * |
||
66 | * @return string |
||
67 | */ |
||
68 | 6 | private function getConvertExpression($dataType, $expression) |
|
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | */ |
||
76 | View Code Duplication | protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit) |
|
86 | |||
87 | /** |
||
88 | * {@inheritDoc} |
||
89 | */ |
||
90 | public function getDateDiffExpression($date1, $date2) |
||
94 | |||
95 | /** |
||
96 | * {@inheritDoc} |
||
97 | * |
||
98 | * Microsoft SQL Server prefers "autoincrement" identity columns |
||
99 | * since sequences can only be emulated with a table. |
||
100 | */ |
||
101 | 3 | public function prefersIdentityColumns() |
|
105 | |||
106 | /** |
||
107 | * {@inheritDoc} |
||
108 | * |
||
109 | * Microsoft SQL Server supports this through AUTO_INCREMENT columns. |
||
110 | */ |
||
111 | 3 | public function supportsIdentityColumns() |
|
115 | |||
116 | /** |
||
117 | * {@inheritDoc} |
||
118 | */ |
||
119 | public function supportsReleaseSavepoints() |
||
123 | |||
124 | /** |
||
125 | * {@inheritdoc} |
||
126 | */ |
||
127 | 3 | public function supportsSchemas() |
|
131 | |||
132 | /** |
||
133 | * {@inheritdoc} |
||
134 | */ |
||
135 | public function getDefaultSchemaName() |
||
139 | |||
140 | /** |
||
141 | * {@inheritDoc} |
||
142 | */ |
||
143 | public function supportsColumnCollation() |
||
147 | |||
148 | /** |
||
149 | * {@inheritDoc} |
||
150 | */ |
||
151 | 160 | public function hasNativeGuidType() |
|
155 | |||
156 | /** |
||
157 | * {@inheritDoc} |
||
158 | */ |
||
159 | 3 | public function getCreateDatabaseSQL($name) |
|
163 | |||
164 | /** |
||
165 | * {@inheritDoc} |
||
166 | */ |
||
167 | 3 | public function getDropDatabaseSQL($name) |
|
171 | |||
172 | /** |
||
173 | * {@inheritDoc} |
||
174 | */ |
||
175 | 3 | public function supportsCreateDropDatabase() |
|
179 | |||
180 | /** |
||
181 | * {@inheritDoc} |
||
182 | */ |
||
183 | 3 | public function getCreateSchemaSQL($schemaName) |
|
187 | |||
188 | /** |
||
189 | * {@inheritDoc} |
||
190 | */ |
||
191 | 6 | View Code Duplication | public function getDropForeignKeySQL($foreignKey, $table) |
206 | |||
207 | /** |
||
208 | * {@inheritDoc} |
||
209 | */ |
||
210 | public function getDropIndexSQL($index, $table = null) |
||
231 | |||
232 | /** |
||
233 | * {@inheritDoc} |
||
234 | */ |
||
235 | 46 | protected function _getCreateTableSQL($tableName, array $columns, array $options = []) |
|
298 | |||
299 | /** |
||
300 | * {@inheritDoc} |
||
301 | */ |
||
302 | 6 | public function getCreatePrimaryKeySQL(Index $index, $table) |
|
311 | |||
312 | /** |
||
313 | * Returns the SQL statement for creating a column comment. |
||
314 | * |
||
315 | * SQL Server does not support native column comments, |
||
316 | * therefore the extended properties functionality is used |
||
317 | * as a workaround to store them. |
||
318 | * The property name used to store column comments is "MS_Description" |
||
319 | * which provides compatibility with SQL Server Management Studio, |
||
320 | * as column comments are stored in the same property there when |
||
321 | * specifying a column's "Description" attribute. |
||
322 | * |
||
323 | * @param string $tableName The quoted table name to which the column belongs. |
||
324 | * @param string $columnName The quoted column name to create the comment for. |
||
325 | * @param string $comment The column's comment. |
||
326 | * |
||
327 | * @return string |
||
328 | */ |
||
329 | 15 | protected function getCreateColumnCommentSQL($tableName, $columnName, $comment) |
|
342 | |||
343 | /** |
||
344 | * Returns the SQL snippet for declaring a default constraint. |
||
345 | * |
||
346 | * @param string $table Name of the table to return the default constraint declaration for. |
||
347 | * @param array $column Column definition. |
||
348 | * |
||
349 | * @return string |
||
350 | * |
||
351 | * @throws \InvalidArgumentException |
||
352 | */ |
||
353 | 45 | public function getDefaultConstraintDeclarationSQL($table, array $column) |
|
367 | |||
368 | /** |
||
369 | * {@inheritDoc} |
||
370 | */ |
||
371 | 6 | public function getUniqueConstraintDeclarationSQL($name, Index $index) |
|
379 | |||
380 | /** |
||
381 | * {@inheritDoc} |
||
382 | */ |
||
383 | 24 | public function getCreateIndexSQL(Index $index, $table) |
|
393 | |||
394 | /** |
||
395 | * {@inheritDoc} |
||
396 | */ |
||
397 | 24 | View Code Duplication | protected function getCreateIndexSQLFlags(Index $index) |
412 | |||
413 | /** |
||
414 | * Extend unique key constraint with required filters |
||
415 | * |
||
416 | * @param string $sql |
||
417 | * @param \Doctrine\DBAL\Schema\Index $index |
||
418 | * |
||
419 | * @return string |
||
420 | */ |
||
421 | 12 | private function _appendUniqueConstraintDefinition($sql, Index $index) |
|
431 | |||
432 | /** |
||
433 | * {@inheritDoc} |
||
434 | */ |
||
435 | 57 | public function getAlterTableSQL(TableDiff $diff) |
|
593 | |||
594 | /** |
||
595 | * Returns the SQL clause for adding a default constraint in an ALTER TABLE statement. |
||
596 | * |
||
597 | * @param string $tableName The name of the table to generate the clause for. |
||
598 | * @param Column $column The column to generate the clause for. |
||
599 | * |
||
600 | * @return string |
||
601 | */ |
||
602 | 21 | private function getAlterTableAddDefaultConstraintClause($tableName, Column $column) |
|
609 | |||
610 | /** |
||
611 | * Returns the SQL clause for dropping an existing default constraint in an ALTER TABLE statement. |
||
612 | * |
||
613 | * @param string $tableName The name of the table to generate the clause for. |
||
614 | * @param string $columnName The name of the column to generate the clause for. |
||
615 | * |
||
616 | * @return string |
||
617 | */ |
||
618 | 18 | private function getAlterTableDropDefaultConstraintClause($tableName, $columnName) |
|
622 | |||
623 | /** |
||
624 | * Checks whether a column alteration requires dropping its default constraint first. |
||
625 | * |
||
626 | * Different to other database vendors SQL Server implements column default values |
||
627 | * as constraints and therefore changes in a column's default value as well as changes |
||
628 | * in a column's type require dropping the default constraint first before being to |
||
629 | * alter the particular column to the new definition. |
||
630 | * |
||
631 | * @param ColumnDiff $columnDiff The column diff to evaluate. |
||
632 | * |
||
633 | * @return boolean True if the column alteration requires dropping its default constraint first, false otherwise. |
||
634 | */ |
||
635 | 33 | private function alterColumnRequiresDropDefaultConstraint(ColumnDiff $columnDiff) |
|
663 | |||
664 | /** |
||
665 | * Returns the SQL statement for altering a column comment. |
||
666 | * |
||
667 | * SQL Server does not support native column comments, |
||
668 | * therefore the extended properties functionality is used |
||
669 | * as a workaround to store them. |
||
670 | * The property name used to store column comments is "MS_Description" |
||
671 | * which provides compatibility with SQL Server Management Studio, |
||
672 | * as column comments are stored in the same property there when |
||
673 | * specifying a column's "Description" attribute. |
||
674 | * |
||
675 | * @param string $tableName The quoted table name to which the column belongs. |
||
676 | * @param string $columnName The quoted column name to alter the comment for. |
||
677 | * @param string $comment The column's comment. |
||
678 | * |
||
679 | * @return string |
||
680 | */ |
||
681 | 3 | protected function getAlterColumnCommentSQL($tableName, $columnName, $comment) |
|
694 | |||
695 | /** |
||
696 | * Returns the SQL statement for dropping a column comment. |
||
697 | * |
||
698 | * SQL Server does not support native column comments, |
||
699 | * therefore the extended properties functionality is used |
||
700 | * as a workaround to store them. |
||
701 | * The property name used to store column comments is "MS_Description" |
||
702 | * which provides compatibility with SQL Server Management Studio, |
||
703 | * as column comments are stored in the same property there when |
||
704 | * specifying a column's "Description" attribute. |
||
705 | * |
||
706 | * @param string $tableName The quoted table name to which the column belongs. |
||
707 | * @param string $columnName The quoted column name to drop the comment for. |
||
708 | * |
||
709 | * @return string |
||
710 | */ |
||
711 | 3 | protected function getDropColumnCommentSQL($tableName, $columnName) |
|
723 | |||
724 | /** |
||
725 | * {@inheritdoc} |
||
726 | */ |
||
727 | 15 | protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName) |
|
738 | |||
739 | /** |
||
740 | * Returns the SQL statement for adding an extended property to a database object. |
||
741 | * |
||
742 | * @param string $name The name of the property to add. |
||
743 | * @param string|null $value The value of the property to add. |
||
744 | * @param string|null $level0Type The type of the object at level 0 the property belongs to. |
||
745 | * @param string|null $level0Name The name of the object at level 0 the property belongs to. |
||
746 | * @param string|null $level1Type The type of the object at level 1 the property belongs to. |
||
747 | * @param string|null $level1Name The name of the object at level 1 the property belongs to. |
||
748 | * @param string|null $level2Type The type of the object at level 2 the property belongs to. |
||
749 | * @param string|null $level2Name The name of the object at level 2 the property belongs to. |
||
750 | * |
||
751 | * @return string |
||
752 | * |
||
753 | * @link http://msdn.microsoft.com/en-us/library/ms180047%28v=sql.90%29.aspx |
||
754 | */ |
||
755 | 15 | View Code Duplication | public function getAddExtendedPropertySQL( |
771 | |||
772 | /** |
||
773 | * Returns the SQL statement for dropping an extended property from a database object. |
||
774 | * |
||
775 | * @param string $name The name of the property to drop. |
||
776 | * @param string|null $level0Type The type of the object at level 0 the property belongs to. |
||
777 | * @param string|null $level0Name The name of the object at level 0 the property belongs to. |
||
778 | * @param string|null $level1Type The type of the object at level 1 the property belongs to. |
||
779 | * @param string|null $level1Name The name of the object at level 1 the property belongs to. |
||
780 | * @param string|null $level2Type The type of the object at level 2 the property belongs to. |
||
781 | * @param string|null $level2Name The name of the object at level 2 the property belongs to. |
||
782 | * |
||
783 | * @return string |
||
784 | * |
||
785 | * @link http://technet.microsoft.com/en-gb/library/ms178595%28v=sql.90%29.aspx |
||
786 | */ |
||
787 | 3 | public function getDropExtendedPropertySQL( |
|
802 | |||
803 | /** |
||
804 | * Returns the SQL statement for updating an extended property of a database object. |
||
805 | * |
||
806 | * @param string $name The name of the property to update. |
||
807 | * @param string|null $value The value of the property to update. |
||
808 | * @param string|null $level0Type The type of the object at level 0 the property belongs to. |
||
809 | * @param string|null $level0Name The name of the object at level 0 the property belongs to. |
||
810 | * @param string|null $level1Type The type of the object at level 1 the property belongs to. |
||
811 | * @param string|null $level1Name The name of the object at level 1 the property belongs to. |
||
812 | * @param string|null $level2Type The type of the object at level 2 the property belongs to. |
||
813 | * @param string|null $level2Name The name of the object at level 2 the property belongs to. |
||
814 | * |
||
815 | * @return string |
||
816 | * |
||
817 | * @link http://msdn.microsoft.com/en-us/library/ms186885%28v=sql.90%29.aspx |
||
818 | */ |
||
819 | 3 | View Code Duplication | public function getUpdateExtendedPropertySQL( |
835 | |||
836 | /** |
||
837 | * {@inheritDoc} |
||
838 | */ |
||
839 | public function getEmptyIdentityInsertSQL($quotedTableName, $quotedIdentifierColumnName) |
||
843 | |||
844 | /** |
||
845 | * {@inheritDoc} |
||
846 | */ |
||
847 | public function getListTablesSQL() |
||
853 | |||
854 | /** |
||
855 | * {@inheritDoc} |
||
856 | */ |
||
857 | 6 | public function getListTableColumnsSQL($table, $database = null) |
|
886 | |||
887 | /** |
||
888 | * {@inheritDoc} |
||
889 | */ |
||
890 | 6 | public function getListTableForeignKeysSQL($table, $database = null) |
|
908 | |||
909 | /** |
||
910 | * {@inheritDoc} |
||
911 | */ |
||
912 | 6 | public function getListTableIndexesSQL($table, $currentDatabase = null) |
|
931 | |||
932 | /** |
||
933 | * {@inheritDoc} |
||
934 | */ |
||
935 | public function getCreateViewSQL($name, $sql) |
||
939 | |||
940 | /** |
||
941 | * {@inheritDoc} |
||
942 | */ |
||
943 | public function getListViewsSQL($database) |
||
947 | |||
948 | /** |
||
949 | * Returns the where clause to filter schema and table name in a query. |
||
950 | * |
||
951 | * @param string $table The full qualified name of the table. |
||
952 | * @param string $schemaColumn The name of the column to compare the schema to in the where clause. |
||
953 | * @param string $tableColumn The name of the column to compare the table to in the where clause. |
||
954 | * |
||
955 | * @return string |
||
956 | */ |
||
957 | 18 | View Code Duplication | private function getTableWhereClause($table, $schemaColumn, $tableColumn) |
970 | |||
971 | /** |
||
972 | * {@inheritDoc} |
||
973 | */ |
||
974 | public function getDropViewSQL($name) |
||
978 | |||
979 | /** |
||
980 | * {@inheritDoc} |
||
981 | */ |
||
982 | public function getGuidExpression() |
||
986 | |||
987 | /** |
||
988 | * {@inheritDoc} |
||
989 | */ |
||
990 | View Code Duplication | public function getLocateExpression($str, $substr, $startPos = false) |
|
998 | |||
999 | /** |
||
1000 | * {@inheritDoc} |
||
1001 | */ |
||
1002 | public function getModExpression($expression1, $expression2) |
||
1006 | |||
1007 | /** |
||
1008 | * {@inheritDoc} |
||
1009 | */ |
||
1010 | public function getTrimExpression($str, $pos = self::TRIM_UNSPECIFIED, $char = false) |
||
1050 | |||
1051 | /** |
||
1052 | * {@inheritDoc} |
||
1053 | */ |
||
1054 | 3 | public function getConcatExpression() |
|
1060 | |||
1061 | /** |
||
1062 | * {@inheritDoc} |
||
1063 | */ |
||
1064 | 3 | public function getListDatabasesSQL() |
|
1068 | |||
1069 | /** |
||
1070 | * {@inheritDoc} |
||
1071 | */ |
||
1072 | public function getListNamespacesSQL() |
||
1076 | |||
1077 | /** |
||
1078 | * {@inheritDoc} |
||
1079 | */ |
||
1080 | public function getSubstringExpression($value, $from, $length = null) |
||
1088 | |||
1089 | /** |
||
1090 | * {@inheritDoc} |
||
1091 | */ |
||
1092 | public function getLengthExpression($column) |
||
1096 | |||
1097 | /** |
||
1098 | * {@inheritDoc} |
||
1099 | */ |
||
1100 | 3 | public function getSetTransactionIsolationSQL($level) |
|
1104 | |||
1105 | /** |
||
1106 | * {@inheritDoc} |
||
1107 | */ |
||
1108 | 37 | public function getIntegerTypeDeclarationSQL(array $field) |
|
1112 | |||
1113 | /** |
||
1114 | * {@inheritDoc} |
||
1115 | */ |
||
1116 | public function getBigIntTypeDeclarationSQL(array $field) |
||
1120 | |||
1121 | /** |
||
1122 | * {@inheritDoc} |
||
1123 | */ |
||
1124 | public function getSmallIntTypeDeclarationSQL(array $field) |
||
1128 | |||
1129 | /** |
||
1130 | * {@inheritDoc} |
||
1131 | */ |
||
1132 | 3 | public function getGuidTypeDeclarationSQL(array $field) |
|
1136 | |||
1137 | /** |
||
1138 | * {@inheritDoc} |
||
1139 | */ |
||
1140 | 69 | protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed) |
|
1144 | |||
1145 | /** |
||
1146 | * {@inheritdoc} |
||
1147 | */ |
||
1148 | 3 | protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed) |
|
1152 | |||
1153 | /** |
||
1154 | * {@inheritdoc} |
||
1155 | */ |
||
1156 | 6 | public function getBinaryMaxLength() |
|
1160 | |||
1161 | /** |
||
1162 | * {@inheritDoc} |
||
1163 | */ |
||
1164 | 5 | public function getClobTypeDeclarationSQL(array $field) |
|
1168 | |||
1169 | /** |
||
1170 | * {@inheritDoc} |
||
1171 | */ |
||
1172 | 37 | protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef) |
|
1176 | |||
1177 | /** |
||
1178 | * {@inheritDoc} |
||
1179 | */ |
||
1180 | public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration) |
||
1184 | |||
1185 | /** |
||
1186 | * {@inheritDoc} |
||
1187 | */ |
||
1188 | public function getDateTypeDeclarationSQL(array $fieldDeclaration) |
||
1192 | |||
1193 | /** |
||
1194 | * {@inheritDoc} |
||
1195 | */ |
||
1196 | public function getTimeTypeDeclarationSQL(array $fieldDeclaration) |
||
1200 | |||
1201 | /** |
||
1202 | * {@inheritDoc} |
||
1203 | */ |
||
1204 | 3 | public function getBooleanTypeDeclarationSQL(array $field) |
|
1208 | |||
1209 | /** |
||
1210 | * {@inheritDoc} |
||
1211 | */ |
||
1212 | 40 | protected function doModifyLimitQuery($query, $limit, $offset = null) |
|
1247 | |||
1248 | /** |
||
1249 | * Remove ORDER BY clauses in subqueries - they're not supported by SQL Server. |
||
1250 | * Caveat: will leave ORDER BY in TOP N subqueries. |
||
1251 | * |
||
1252 | * @param $query |
||
1253 | * @return string |
||
1254 | */ |
||
1255 | 26 | private function scrubInnerOrderBy($query) |
|
1294 | |||
1295 | /** |
||
1296 | * Check an ORDER BY clause to see if it is in a TOP N query or subquery. |
||
1297 | * |
||
1298 | * @param string $query The query |
||
1299 | * @param int $currentPosition Start position of ORDER BY clause |
||
1300 | * @return bool true if ORDER BY is in a TOP N query, false otherwise |
||
1301 | */ |
||
1302 | 26 | private function isOrderByInTopNSubquery($query, $currentPosition) |
|
1329 | |||
1330 | /** |
||
1331 | * {@inheritDoc} |
||
1332 | */ |
||
1333 | public function supportsLimitOffset() |
||
1337 | |||
1338 | /** |
||
1339 | * {@inheritDoc} |
||
1340 | */ |
||
1341 | 3 | View Code Duplication | public function convertBooleans($item) |
1355 | |||
1356 | /** |
||
1357 | * {@inheritDoc} |
||
1358 | */ |
||
1359 | public function getCreateTemporaryTableSnippetSQL() |
||
1363 | |||
1364 | /** |
||
1365 | * {@inheritDoc} |
||
1366 | */ |
||
1367 | public function getTemporaryTableName($tableName) |
||
1371 | |||
1372 | /** |
||
1373 | * {@inheritDoc} |
||
1374 | */ |
||
1375 | public function getDateTimeFormatString() |
||
1379 | |||
1380 | /** |
||
1381 | * {@inheritDoc} |
||
1382 | */ |
||
1383 | public function getDateFormatString() |
||
1387 | |||
1388 | /** |
||
1389 | * {@inheritDoc} |
||
1390 | */ |
||
1391 | public function getTimeFormatString() |
||
1395 | |||
1396 | /** |
||
1397 | * {@inheritDoc} |
||
1398 | */ |
||
1399 | public function getDateTimeTzFormatString() |
||
1403 | |||
1404 | /** |
||
1405 | * {@inheritDoc} |
||
1406 | */ |
||
1407 | 1 | public function getName() |
|
1411 | |||
1412 | /** |
||
1413 | * {@inheritDoc} |
||
1414 | */ |
||
1415 | 15 | protected function initializeDoctrineTypeMappings() |
|
1445 | |||
1446 | /** |
||
1447 | * {@inheritDoc} |
||
1448 | */ |
||
1449 | public function createSavePoint($savepoint) |
||
1453 | |||
1454 | /** |
||
1455 | * {@inheritDoc} |
||
1456 | */ |
||
1457 | public function releaseSavePoint($savepoint) |
||
1461 | |||
1462 | /** |
||
1463 | * {@inheritDoc} |
||
1464 | */ |
||
1465 | public function rollbackSavePoint($savepoint) |
||
1469 | |||
1470 | /** |
||
1471 | * {@inheritdoc} |
||
1472 | */ |
||
1473 | 21 | public function getForeignKeyReferentialActionSQL($action) |
|
1482 | |||
1483 | /** |
||
1484 | * {@inheritDoc} |
||
1485 | */ |
||
1486 | 7 | View Code Duplication | public function appendLockHint($fromClause, $lockMode) |
1502 | |||
1503 | /** |
||
1504 | * {@inheritDoc} |
||
1505 | */ |
||
1506 | public function getForUpdateSQL() |
||
1510 | |||
1511 | /** |
||
1512 | * {@inheritDoc} |
||
1513 | */ |
||
1514 | 57 | protected function getReservedKeywordsClass() |
|
1518 | |||
1519 | /** |
||
1520 | * {@inheritDoc} |
||
1521 | */ |
||
1522 | 91 | public function quoteSingleIdentifier($str) |
|
1526 | |||
1527 | /** |
||
1528 | * {@inheritDoc} |
||
1529 | */ |
||
1530 | 3 | public function getTruncateTableSQL($tableName, $cascade = false) |
|
1536 | |||
1537 | /** |
||
1538 | * {@inheritDoc} |
||
1539 | */ |
||
1540 | 3 | public function getBlobTypeDeclarationSQL(array $field) |
|
1544 | |||
1545 | /** |
||
1546 | * {@inheritDoc} |
||
1547 | */ |
||
1548 | 57 | public function getDefaultValueDeclarationSQL($field) |
|
1575 | |||
1576 | /** |
||
1577 | * {@inheritdoc} |
||
1578 | * |
||
1579 | * Modifies column declaration order as it differs in Microsoft SQL Server. |
||
1580 | */ |
||
1581 | 85 | public function getColumnDeclarationSQL($name, array $field) |
|
1603 | |||
1604 | /** |
||
1605 | * Returns a unique default constraint name for a table and column. |
||
1606 | * |
||
1607 | * @param string $table Name of the table to generate the unique default constraint name for. |
||
1608 | * @param string $column Name of the column in the table to generate the unique default constraint name for. |
||
1609 | * |
||
1610 | * @return string |
||
1611 | */ |
||
1612 | 45 | private function generateDefaultConstraintName($table, $column) |
|
1616 | |||
1617 | /** |
||
1618 | * Returns a hash value for a given identifier. |
||
1619 | * |
||
1620 | * @param string $identifier Identifier to generate a hash value for. |
||
1621 | * |
||
1622 | * @return string |
||
1623 | */ |
||
1624 | 48 | private function generateIdentifierName($identifier) |
|
1631 | } |
||
1632 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.