mambax7/cardealer

View on GitHub
blocks/part.php

Summary

Maintainability
D
2 days
Test Coverage

editCardealerPart accesses the super-global variable $GLOBALS.
Open

function editCardealerPart($options)
{

    $form = MB_CARDEALER_DISPLAY;
    $form .= "<input type='hidden' name='options[0]' value='" . $options[0] . "' />";
Severity: Minor
Found in blocks/part.php by phpmd

Since: PHPMD 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example:

class Foo {
      public function bar() {
          $name = $_POST['foo'];
      }
  }

Source: http://phpmd.org/rules/controversial.txt

showCardealerPart accesses the super-global variable $GLOBALS.
Open

function showCardealerPart($options)
{

    $block     = [];
    $blockType = $options[0];
Severity: Minor
Found in blocks/part.php by phpmd

Since: PHPMD 0.2

Accessing a super-global variable directly is considered a bad practice. These variables should be encapsulated in objects that are provided by a framework, for instance.

Example:

class Foo {
      public function bar() {
          $name = $_POST['foo'];
      }
  }

Source: http://phpmd.org/rules/controversial.txt

Avoid unused local variables such as '$i'.
Open

    foreach (array_keys($partArray) as $i) {
Severity: Minor
Found in blocks/part.php by phpmd

Since: PHPMD 0.2

Detects when a local variable is declared and/or assigned, but not used.

Example:

class Foo {
      public function doSomething()
      {
          $i = 5; // Unused
      }
  }

Source: http://phpmd.org/rules/unusedcode.txt

Similar blocks of code found in 6 locations. Consider refactoring.
Open

<?php

/*
 You may not change or alter any portion of this comment or credits
 of supporting developers from this source code or any supporting source code
Severity: Major
Found in blocks/part.php and 5 other locations - About 2 days to fix
blocks/customer.php on lines 1..92
blocks/service.php on lines 1..92
blocks/servpart.php on lines 1..93
blocks/vehicle.php on lines 1..93
blocks/workorder.php on lines 1..94

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 472.

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

Further Reading

Line exceeds 120 characters; contains 146 characters
Open

    $form .= MB_CARDEALER_TITLELENGTH . " : <input name='options[2]' size='5' maxlength='255' value='" . $options[2] . "' type='text' /><br><br>";
Severity: Minor
Found in blocks/part.php by phpcodesniffer

Line exceeds 120 characters; contains 182 characters
Open

        $form    .= "<option value='" . $partnum . "' " . (false === in_array($partnum, $options) ? '' : "selected='selected'") . '>' . $partArray[$i]->getVar('title') . '</option>';
Severity: Minor
Found in blocks/part.php by phpcodesniffer

Line exceeds 120 characters; contains 146 characters
Open

    $form      .= "<option value='0' " . (false === in_array(0, $options) ? '' : "selected='selected'") . '>' . MB_CARDEALER_ALLCAT . '</option>';
Severity: Minor
Found in blocks/part.php by phpcodesniffer

There are no issues that match your filters.

Category
Status