Similar blocks of code found in 2 locations. Consider refactoring. Open
echo ' <div style="padding:5px; background-color: #EEEEEE; border: 1px solid #D9D9D9;">
<span style="font-weight: bold; color: #0A3760;">' . _AM_XOOPSTUBE_SUB_FILESWAITINGINFO . '<br><br></span>
<span style="padding: 12px;">' . _AM_XOOPSTUBE_SUB_FILESWAITINGVALIDATION . '<b>' . $new_array_count . '</b><br><br><span>
<div style="padding: 8px;"><li> ' . $xtubeImageArray['approve'] . ' ' . _AM_XOOPSTUBE_SUB_APPROVEWAITINGFILE . '<br>
<li> ' . $xtubeImageArray['editimg'] . ' ' . _AM_XOOPSTUBE_SUB_EDITWAITINGFILE . '<br>
- 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 102.
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
The DEFAULT body must start on the line following the statement Open
default:
- Exclude checks
The CASE body must start on the line following the statement Open
case 'approve':
- Exclude checks
There must be one USE keyword per declaration Open
use XoopsModules\Xoopstube\{
- Exclude checks
Line exceeds 120 characters; contains 122 characters Open
<span style="font-weight: bold; color: #0A3760;">' . _AM_XOOPSTUBE_SUB_FILESWAITINGINFO . '<br><br></span>
- Exclude checks
Line exceeds 120 characters; contains 135 characters Open
$datetime = Utility::getTimestamp(formatTimestamp($new['date'], $GLOBALS['xoopsModuleConfig']['dateformatadmin']));
- Exclude checks
Line exceeds 120 characters; contains 141 characters Open
echo '<td class="even" style="text-align: center;" nowrap><span style="font-size: small;">' . $returnsource . '</span></td>';
- Exclude checks
Line exceeds 120 characters; contains 130 characters Open
echo '<td class="even" style="text-align: center;"><span style="font-size: small;">' . $datetime . '</span></td>';
- Exclude checks
Line exceeds 120 characters; contains 129 characters Open
// $page = ( $new_array_count > $GLOBALS['xoopsModuleConfig']['admin_perpage'] ) ? _AM_XOOPSTUBE_MINDEX_PAGE : '';
- Exclude checks
Line exceeds 120 characters; contains 127 characters Open
$sql = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE published = 0 ORDER BY lid DESC';
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
echo '<th style="text-align: center;"><span style="font-size: small;">' . _AM_XOOPSTUBE_VIDSOURCE2 . '</span></th>';
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
$tags['VIDEO_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/singlevideo.php?cid=' . $cid . '&lid=' . $lid;
- Exclude checks
Line exceeds 120 characters; contains 138 characters Open
echo '<td class="even" style="text-align: center;" nowrap><span style="font-size: small;">' . $submitter . '</span></td>';
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
$sql = 'SELECT cid, title, publisher, notifypub FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . $lid;
- Exclude checks
Line exceeds 120 characters; contains 138 characters Open
<span style="padding: 12px;">' . _AM_XOOPSTUBE_SUB_FILESWAITINGVALIDATION . '<b>' . $new_array_count . '</b><br><br><span>
- Exclude checks
Line exceeds 120 characters; contains 143 characters Open
<div style="padding: 8px;"><li> ' . $xtubeImageArray['approve'] . ' ' . _AM_XOOPSTUBE_SUB_APPROVEWAITINGFILE . '<br>
- Exclude checks
Line exceeds 120 characters; contains 155 characters Open
$icon = $new['published'] ? $approved : '<a href="newvideos.php?op=approve&lid=' . $lid . '">' . $xtubeImageArray['approve'] . ' </a>';
- Exclude checks
Line exceeds 120 characters; contains 168 characters Open
$sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' SET published=' . $time . ", status=1, publisher='" . $publisher . "' WHERE lid=" . $lid;
- Exclude checks
Line exceeds 120 characters; contains 131 characters Open
echo '<tr><td style="text-align: center;" class="head" colspan="6">' . _AM_XOOPSTUBE_SUB_NOFILESWAITING . '</td></tr>';
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
$tags['CATEGORY_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/viewcat.php?cid=' . $cid;
- Exclude checks
Line exceeds 120 characters; contains 124 characters Open
echo '<th style="text-align: left;"><span style="font-size: small;">' . _AM_XOOPSTUBE_MINDEX_TITLE . '</span></th>';
- Exclude checks
Line exceeds 120 characters; contains 125 characters Open
echo '<td class="head" style="text-align: center;"><span style="font-size: small;">' . $lid . '</span></td>';
- Exclude checks
Line exceeds 120 characters; contains 136 characters Open
// 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' SET published=' . $time . ', status=1, publisher='
- Exclude checks
Line exceeds 120 characters; contains 163 characters Open
echo '<td class="even" nowrap><a href="newvideos.php?op=edit&lid=' . $lid . '"><span style="font-size: small;">' . $title . '</span></a></td>';
- Exclude checks