Method xoFormField
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function xoFormField( $name, $value, $label, $help = '', $type='text') {
Call to undeclared function mysql_connect
in callable Open
if (!($link = @$func_connect($vars['DB_HOST'], $vars['DB_USER'], $vars['DB_PASS'], true))) {
- Exclude checks
Call to undeclared function mysql_pconnect
in callable Open
if (!($link = @$func_connect($vars['DB_HOST'], $vars['DB_USER'], $vars['DB_PASS'], true))) {
- Exclude checks
Variable $wizard
is undeclared Open
$wizard->redirectToPage('+1');
- Exclude checks
Variable $wizard
is undeclared Open
$wizard->setPage( 'dbconnection' );
- Exclude checks
Function xoFormField
defined at /code/htdocs/install/page_dbconnection.php:104
was previously defined at /code/upgrade/upd-icms-1.0-to-1.1/settings_salt.php:19
Open
function xoFormField( $name, $value, $label, $help = '', $type='text') {
- Exclude checks
Similar blocks of code found in 2 locations. Consider refactoring. Open
switch ($vars['DB_TYPE']) {
case 'mysql':
$func_connect = empty($vars['DB_PCONNECT'])?"mysql_connect":"mysql_pconnect";
if (!($link = @$func_connect($vars['DB_HOST'], $vars['DB_USER'], $vars['DB_PASS'], true))) {
$error = ERR_NO_DBCONNECTION;
- 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 177.
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
Space found after opening bracket of FOREACH loop Open
foreach ( $keys as $k) {
- Exclude checks
Expected 1 space after comma in function call; 4 found Open
<div class="dbconn_line"><?php echo xoFormField( 'DB_HOST', $vars['DB_HOST'], DB_HOST_LABEL, DB_HOST_HELP ); ?>
- Exclude checks
Blank line found at end of control structure Open
- Exclude checks
Expected 1 space after comma in function call; 8 found Open
<div class="dbconn_line"><?php echo xoFormField( 'DB_HOST', $vars['DB_HOST'], DB_HOST_LABEL, DB_HOST_HELP ); ?>
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
<?php if (!empty( $error ) ) echo '<div class="x2-note error">' . $error . "</div>\n"; ?>
- Exclude checks
Expected 1 space after comma in function call; 8 found Open
<div class="dbconn_line"><?php echo xoFormField( 'DB_USER', $vars['DB_USER'], DB_USER_LABEL, DB_USER_HELP ); ?>
- Exclude checks
Expected 1 space after comma in function call; 7 found Open
<div class="dbconn_line"><?php echo xoFormField( 'DB_PASS', $vars['DB_PASS'], DB_PASS_LABEL, DB_PASS_HELP, 'password' ); ?>
- Exclude checks
Space found after opening bracket of FOREACH loop Open
foreach ( $params as $name) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if (!defined( 'XOOPS_INSTALL' ) ) exit();
- Exclude checks
Incorrect spacing between default value and equals sign for argument "$type"; expected 1 but found 0 Open
function xoFormField( $name, $value, $label, $help = '', $type='text') {
- Exclude checks
Expected 0 spaces between opening bracket and argument "$name"; 1 found Open
function xoFormField( $name, $value, $label, $help = '', $type='text') {
- Exclude checks
Expected 1 space after comma in function call; 4 found Open
<div class="dbconn_line"><?php echo xoFormField( 'DB_USER', $vars['DB_USER'], DB_USER_LABEL, DB_USER_HELP ); ?>
- Exclude checks
Incorrect spacing between argument "$type" and equals sign; expected 1 but found 0 Open
function xoFormField( $name, $value, $label, $help = '', $type='text') {
- Exclude checks
Inline control structures are not allowed Open
if (!defined( 'XOOPS_INSTALL' ) ) exit();
- Exclude checks
Inline control structures are not allowed Open
<?php if (!empty( $error ) ) echo '<div class="x2-note error">' . $error . "</div>\n"; ?>
- Exclude checks
Inline control structures are not allowed Open
if (!empty($option['selected'])) $selected = " selected='selected'";
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if (!isset( $vars['DB_HOST'] ) || false !== @strpos( $_SERVER['HTTP_CACHE_CONTROL'], 'max-age=0' )) {
- Exclude checks
Multi-line function call not indented correctly; expected 16 spaces but found 20 Open
));
- Exclude checks
Closing parenthesis of a multi-line function call must be on a line by itself Open
));
- Exclude checks
Space after opening parenthesis of function call prohibited Open
<div class="dbconn_line"><?php echo xoFormField( 'DB_PASS', $vars['DB_PASS'], DB_PASS_LABEL, DB_PASS_HELP, 'password' ); ?>
- Exclude checks
Space after opening parenthesis of function call prohibited Open
<label> <?php echo htmlspecialchars( DB_PCONNECT_LABEL ); ?> <input
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$wizard->setPage( 'dbconnection' );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
<label> <?php echo htmlspecialchars( DB_PCONNECT_LABEL ); ?> <input
- Exclude checks
Space after opening parenthesis of function call prohibited Open
<?php if (!empty( $error ) ) echo '<div class="x2-note error">' . $error . "</div>\n"; ?>
- Exclude checks
Space after opening parenthesis of function call prohibited Open
<div class="dbconn_line"><?php echo xoFormField( 'DB_HOST', $vars['DB_HOST'], DB_HOST_LABEL, DB_HOST_HELP ); ?>
- Exclude checks
Space after opening parenthesis of function call prohibited Open
if (!isset( $vars['DB_HOST'] ) || false !== @strpos( $_SERVER['HTTP_CACHE_CONTROL'], 'max-age=0' )) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
if (!defined( 'XOOPS_INSTALL' ) ) exit();
- Exclude checks
Expected 0 spaces after opening bracket; 1 found Open
foreach ( $keys as $k) {
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$vars[ $k ] = defined( "XOOPS_$k" ) ? constant( "XOOPS_$k" ) : '';
- Exclude checks
Opening parenthesis of a multi-line function call must be the last content on the line Open
$dbh = new PDO('mysql:host=' . $vars['DB_HOST'],
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$value = htmlspecialchars( $value, ENT_QUOTES );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
<?php if (!empty( $error ) ) echo '<div class="x2-note error">' . $error . "</div>\n"; ?>
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if (!isset( $vars['DB_HOST'] ) || false !== @strpos( $_SERVER['HTTP_CACHE_CONTROL'], 'max-age=0' )) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$vars[ $k ] = defined( "XOOPS_$k" ) ? constant( "XOOPS_$k" ) : '';
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
<div class="dbconn_line"><?php echo xoFormField( 'DB_HOST', $vars['DB_HOST'], DB_HOST_LABEL, DB_HOST_HELP ); ?>
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
<div class="dbconn_line"><?php echo xoFormField( 'DB_PASS', $vars['DB_PASS'], DB_PASS_LABEL, DB_PASS_HELP, 'password' ); ?>
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
if (!defined( 'XOOPS_INSTALL' ) ) exit();
- Exclude checks
Expected 0 spaces after opening bracket; 1 found Open
foreach ( $params as $name) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
onclick="alert('<?php echo htmlspecialchars( DB_PCONNECT_HELPS ); ?>');"
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$wizard->setPage( 'dbconnection' );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
<div class="dbconn_line"><?php echo xoFormField( 'DB_USER', $vars['DB_USER'], DB_USER_LABEL, DB_USER_HELP ); ?>
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
<div class="xoform-help"><?php echo htmlspecialchars( DB_PCONNECT_HELP ); ?></div>
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$vars[ $k ] = defined( "XOOPS_$k" ) ? constant( "XOOPS_$k" ) : '';
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$label = htmlspecialchars( $label );
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$name = htmlspecialchars( $name, ENT_QUOTES );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$value = htmlspecialchars( $value, ENT_QUOTES );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
if (!isset( $vars['DB_HOST'] ) || false !== @strpos( $_SERVER['HTTP_CACHE_CONTROL'], 'max-age=0' )) {
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$vars[ $k ] = defined( "XOOPS_$k" ) ? constant( "XOOPS_$k" ) : '';
- Exclude checks
Expected 0 spaces before closing bracket; 1 found Open
$label = htmlspecialchars( $label );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
$name = htmlspecialchars( $name, ENT_QUOTES );
- Exclude checks
Space after opening parenthesis of function call prohibited Open
<div class="dbconn_line"><?php echo xoFormField( 'DB_USER', $vars['DB_USER'], DB_USER_LABEL, DB_USER_HELP ); ?>
- Exclude checks
Space after opening parenthesis of function call prohibited Open
onclick="alert('<?php echo htmlspecialchars( DB_PCONNECT_HELPS ); ?>');"
- Exclude checks
Space after opening parenthesis of function call prohibited Open
<div class="xoform-help"><?php echo htmlspecialchars( DB_PCONNECT_HELP ); ?></div>
- Exclude checks