Similar blocks of code found in 2 locations. Consider refactoring. Open
$tmpRow = new Row([new Cell($checkbox.' '.$counter), new Cell($memberUsername), new Cell($memberName), new Cell($memberEmail), new Cell($memberPhone), new Cell($memberStatus), new Cell($cell6Content, false)]);
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 99.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Line exceeds 120 characters; contains 130 characters Open
<button type='button' class='btn btn-default dropdown-toggle' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>
- Exclude checks
Line exceeds 120 characters; contains 210 characters Open
$batchDeleteModalHtml = $htmlUtility->generateConfirmationModal('batchDeleteConfirmationModal', 'batchDeleteConfirmationModalLabel', 'Delete', $formHandler, 'batchDeleteForm', '/admin/batch-delete-member');
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
<button type='button' class='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>×</span></button>
- Exclude checks
Line exceeds 120 characters; contains 228 characters Open
<a href='#' data-toggle='modal' data-target='#safeBatchDeleteConfirmationModal' data-callback='getCheckboxesValues' data-callbackArgs=\"input[name='selectedMembers[]']\"><span class='text-danger'>Delete Safely</span></a>
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
<button type='button' class='btn btn-primary' data-toggle='modal' data-target='#addModal'>New</button>
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
<button type='button' class='btn btn-default dropdown-toggle' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>
- Exclude checks
Line exceeds 120 characters; contains 206 characters Open
<a href='#' data-toggle='modal' data-target='#deleteConfirmationModal' data-id='{$memberId}' data-name='{$memberName}' data-email='{$memberEmail}'><span class='text-danger'>Delete Forever</span></a>
- Exclude checks
Line exceeds 120 characters; contains 210 characters Open
$safeDeleteModalHtml = $htmlUtility->generateConfirmationModal('safeDeleteConfirmationModal', 'safeDeleteConfirmationModalLabel', 'Safe Delete', $formHandler, 'safeDeleteForm', '/admin/safe-delete-member');
- Exclude checks
Line exceeds 120 characters; contains 232 characters Open
$safeBatchDeleteModalHtml = $htmlUtility->generateConfirmationModal('safeBatchDeleteConfirmationModal', 'safeBatchDeleteConfirmationModalLabel', 'Safe Delete', $formHandler, 'batchDeleteForm', '/admin/safe-batch-delete-member');
- Exclude checks
Line exceeds 120 characters; contains 184 characters Open
$deleteModalHtml = $htmlUtility->generateConfirmationModal('deleteConfirmationModal', 'deleteConfirmationModalLabel', 'Delete', $formHandler, 'deleteForm', '/admin/delete-member');
- Exclude checks
Line exceeds 120 characters; contains 123 characters Open
<input type='text' class='form-control' name='username' id='updateFormUsername' placeholder='Username'>
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
<form class='addForm' data-url='/admin/add-member' data-submitter='global' data-close-on-success='true' data-refresh='true'>
- Exclude checks
Line exceeds 120 characters; contains 132 characters Open
<button type='button' class='close' data-dismiss='modal' aria-label='Close'><span aria-hidden='true'>×</span></button>
- Exclude checks
Line exceeds 120 characters; contains 225 characters Open
<a href='#' data-toggle='modal' data-target='#batchDeleteConfirmationModal' data-callback='getCheckboxesValues' data-callbackArgs=\"input[name='selectedMembers[]']\"><span class='text-danger'>Delete Forever</span></a>
- Exclude checks
Line exceeds 120 characters; contains 156 characters Open
<a type='button' class='btn btn-primary' onclick=\"checkAll(this, 'input[name=\'selectedMembers[]\']');\"><i class='fa fa-check' aria-hidden='true'></i></a>
- Exclude checks
Line exceeds 120 characters; contains 209 characters Open
<a href='#' data-toggle='modal' data-target='#safeDeleteConfirmationModal' data-id='{$memberId}' data-name='{$memberName}' data-email='{$memberEmail}'><span class='text-danger'>Delete Safely</span></a>
- Exclude checks
Line exceeds 120 characters; contains 221 characters Open
$tmpRow = new Row([new Cell($checkbox.' '.$counter), new Cell($memberUsername), new Cell($memberName), new Cell($memberEmail), new Cell($memberPhone), new Cell($memberStatus), new Cell($cell6Content, false)]);
- Exclude checks
Line exceeds 120 characters; contains 154 characters Open
<form class='updateForm' data-url='/admin/update-member' data-submitter='global' data-refresh='true' data-populate='true' data-appendwhitelist='id'>
- Exclude checks
Line exceeds 120 characters; contains 247 characters Open
<a href='#' data-toggle='modal' data-target='#editModal' data-username='{$memberUsername}' data-id='{$memberId}' data-name='{$memberName}' data-email='{$memberEmail}' data-phone='{$memberPhone}' data-status='{$memberStatus}'>Quick Edit</a>
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
<input type='password' class='form-control' name='passwordConfirmation' id='passwordConfirmation'>
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 4 Open
} else {
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 4 Open
if ($numberHeadCell instanceof HeadCell) {
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 4 Open
if (!empty($members)) {
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
}
- Exclude checks
Line indented incorrectly; expected 4 spaces, found 8 Open
foreach ($members as $member) {
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 4 Open
}
- Exclude checks
Line indented incorrectly; expected 0 spaces, found 4 Open
}
- Exclude checks