Similar blocks of code found in 2 locations. Consider refactoring. Open
$tmpRow = new Row([new Cell($checkbox.' '.$counter), new Cell($childUsername), new Cell($childName), new Cell($childEmail), new Cell($childPhone), new Cell($childStatus), 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 181 characters Open
$deleteModalHtml = $htmlUtility->generateConfirmationModal('deleteConfirmationModal', 'deleteConfirmationModalLabel', 'Delete', $formHandler, 'deleteForm', '/account/delete-child');
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
<input type='text' class='form-control' name='username' id='addFormUsername' placeholder='Username'>
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
<button type='button' class='btn btn-primary' data-toggle='modal' data-target='#addMemberModal'>New Member</button>
- Exclude checks
Line exceeds 120 characters; contains 126 characters Open
<input type='password' class='form-control' name='passwordConfirmation' id='passwordConfirmation'>
- Exclude checks
Line exceeds 120 characters; contains 128 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 128 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 212 characters Open
$tmpRow = new Row([new Cell($checkbox.' '.$counter), new Cell($childUsername), new Cell($childName), new Cell($childEmail), new Cell($childPhone), new Cell($childStatus), new Cell($cell6Content, false)]);
- Exclude checks
Line exceeds 120 characters; contains 128 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 214 characters Open
<a href='#' data-toggle='modal' data-target='#batchDeleteConfirmationModal' data-callback='getCheckboxesValues' data-callbackArgs=\"input[name='selectedChildren[]']\"><span class='text-danger'>Delete</span></a>
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
$newModalHtml = "<div class='modal fade' id='addMemberModal' tabindex='-1' role='dialog' aria-labelledby='addMemberModalLabel'>
- Exclude checks
Line exceeds 120 characters; contains 157 characters Open
<a type='button' class='btn btn-primary' onclick=\"checkAll(this, 'input[name=\'selectedChildren[]\']');\"><i class='fa fa-check' aria-hidden='true'></i></a>
- Exclude checks
Line exceeds 120 characters; contains 207 characters Open
$batchDeleteModalHtml = $htmlUtility->generateConfirmationModal('batchDeleteConfirmationModal', 'batchDeleteConfirmationModalLabel', 'Delete', $formHandler, 'batchDeleteForm', '/account/batch-delete-child');
- Exclude checks
Line exceeds 120 characters; contains 191 characters Open
<a href='#' data-toggle='modal' data-target='#deleteConfirmationModal' data-id='{$childId}' data-name='{$childName}' data-email='{$childEmail}'><span class='text-danger'>Delete</span></a>
- Exclude checks