linpax/microphp-framework

View on GitHub

Showing 1,083 of 1,083 total issues

Form has 52 functions (exceeds 20 allowed). Consider refactoring.
Open

class Form
{
    /**
     * Render label tag
     *
Severity: Major
Found in src/form/Form.php - About 7 hrs to fix

    File Form.php has 401 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php /** MicroForm */
    
    namespace Micro\Form;
    
    use Micro\Web\Html\Html;
    Severity: Minor
    Found in src/form/Form.php - About 5 hrs to fix

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

          public static function audio(array $sources = [], array $tracks = [], array $attributes = [], $noCodec = '')
          {
              $srcs = '';
      
              foreach ($sources AS $name => $value) {
      Severity: Major
      Found in src/web/html/Html5TagTrait.php and 1 other location - About 4 hrs to fix
      src/web/html/Html5TagTrait.php on lines 51..69

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

      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

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

          public static function video(array $sources = [], array $videos = [], array $attributes = [], $noCodec = '')
          {
              $srcs = '';
      
              foreach ($sources AS $name => $value) {
      Severity: Major
      Found in src/web/html/Html5TagTrait.php and 1 other location - About 4 hrs to fix
      src/web/html/Html5TagTrait.php on lines 84..102

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

      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

      Function run has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          public function run($model, $client = false)
          {
              $elements = explode(',', str_replace(' ', '', array_shift($this->rule)));
              $name = array_shift($this->rule);
      
      
      Severity: Minor
      Found in src/validator/Validator.php - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          public function update($table, array $elements = [], $conditions = '')
          {
              $keys = array_keys($elements);
      
              if (0 === count($keys)) {
      Severity: Major
      Found in src/db/drivers/MysqlDriver.php and 1 other location - About 3 hrs to fix
      src/db/drivers/PgsqlDriver.php on lines 191..212

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

      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

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

          public function update($table, array $elements = [], $conditions = '')
          {
              $keys = array_keys($elements);
      
              if (0 === count($keys)) {
      Severity: Major
      Found in src/db/drivers/PgsqlDriver.php and 1 other location - About 3 hrs to fix
      src/db/drivers/MysqlDriver.php on lines 183..204

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

      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

      The class Ftp has 13 public methods. Consider refactoring Ftp to keep number of public methods under 10.
      Open

      final class Ftp
      {
          /**
           * Last error
           *
      Severity: Minor
      Found in src/web/Ftp.php by phpmd

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      The class Threads has an overall complexity of 51 which is very high. The configured complexity threshold is 50.
      Open

      abstract class Threads
      {
          /** @var string $name thread name */
          private $name;
          /** @var integer $pid process ID */
      Severity: Minor
      Found in src/cli/Threads.php by phpmd

      The class LocalDriver has 15 public methods. Consider refactoring LocalDriver to keep number of public methods under 10.
      Open

      class LocalDriver extends File
      {
          /**
           * @inheritdoc
           */
      Severity: Minor
      Found in src/file/drivers/LocalDriver.php by phpmd

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      The class Form has an overall complexity of 61 which is very high. The configured complexity threshold is 50.
      Open

      class Form
      {
          /**
           * Render label tag
           *
      Severity: Minor
      Found in src/form/Form.php by phpmd

      The class Html has 14 public methods. Consider refactoring Html to keep number of public methods under 10.
      Open

      class Html
      {
          use TagTrait, HeadTagTrait, TableTagTrait, Html5TagTrait, FieldTagTrait {
              TagTrait::openTag insteadof HeadTagTrait, TableTagTrait, Html5TagTrait, FieldTagTrait;
              TagTrait::closeTag insteadof HeadTagTrait, TableTagTrait, Html5TagTrait, FieldTagTrait;
      Severity: Minor
      Found in src/web/html/Html.php by phpmd

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      The class Form has 50 non-getter- and setter-methods. Consider refactoring Form to keep number of methods under 25.
      Open

      class Form
      {
          /**
           * Render label tag
           *
      Severity: Minor
      Found in src/form/Form.php by phpmd

      TooManyMethods

      Since: 0.1

      A class with too many methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      The default was changed from 10 to 25 in PHPMD 2.3.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanymethods

      The class Model has an overall complexity of 61 which is very high. The configured complexity threshold is 50.
      Open

      abstract class Model extends FormModel implements IModel
      {
          /** @var string $primaryKey Primary key on table */
          public static $primaryKey = 'id';
          /** @var string $tableName Table name */
      Severity: Minor
      Found in src/mvc/models/Model.php by phpmd

      The class Form has 50 public methods. Consider refactoring Form to keep number of public methods under 10.
      Open

      class Form
      {
          /**
           * Render label tag
           *
      Severity: Minor
      Found in src/form/Form.php by phpmd

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      The class GridViewWidget has an overall complexity of 53 which is very high. The configured complexity threshold is 50.
      Open

      class GridViewWidget extends Widget
      {
          /** @var int $page Current page on table */
          public $page = 0;
          /** @var int $limit Limit current rows */
      Severity: Minor
      Found in src/widget/GridViewWidget.php by phpmd

      The class Model has 20 public methods. Consider refactoring Model to keep number of public methods under 10.
      Open

      abstract class Model extends FormModel implements IModel
      {
          /** @var string $primaryKey Primary key on table */
          public static $primaryKey = 'id';
          /** @var string $tableName Table name */
      Severity: Minor
      Found in src/mvc/models/Model.php by phpmd

      TooManyPublicMethods

      Since: 0.1

      A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.

      By default it ignores methods starting with 'get' or 'set'.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanypublicmethods

      Function validate has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

          public function validate(IFormModel $model)
          {
              foreach ($this->elements AS $element) {
                  if (!$model->checkAttributeExists($element)) {
                      /** @var UploadedFileInterface[] $files */
      Severity: Minor
      Found in src/validator/FileValidator.php - About 3 hrs to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          public function textAreaFieldRow(IFormModel $model, $property, array $options = [])
          {
              $element = $this->getField($model, $property);
              $options['id'] = $element['id'];
      
      
      Severity: Major
      Found in src/form/Form.php and 22 other locations - About 2 hrs to fix
      src/form/Form.php on lines 128..137
      src/form/Form.php on lines 194..203
      src/form/Form.php on lines 235..244
      src/form/Form.php on lines 277..286
      src/form/Form.php on lines 359..368
      src/form/Form.php on lines 402..411
      src/form/Form.php on lines 448..457
      src/form/Form.php on lines 493..502
      src/form/Form.php on lines 535..544
      src/form/Form.php on lines 579..588
      src/form/Form.php on lines 620..629
      src/form/Form.php on lines 661..670
      src/form/Form.php on lines 702..711
      src/form/Form.php on lines 743..752
      src/form/Form.php on lines 784..793
      src/form/Form.php on lines 825..834
      src/form/Form.php on lines 866..875
      src/form/Form.php on lines 907..916
      src/form/Form.php on lines 948..957
      src/form/Form.php on lines 989..998
      src/form/Form.php on lines 1030..1039
      src/form/Form.php on lines 1071..1080

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

      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

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

          public function fileFieldRow(IFormModel $model, $property, array $options = [])
          {
              $element = $this->getField($model, $property);
              $options['id'] = $element['id'];
      
      
      Severity: Major
      Found in src/form/Form.php and 22 other locations - About 2 hrs to fix
      src/form/Form.php on lines 128..137
      src/form/Form.php on lines 235..244
      src/form/Form.php on lines 277..286
      src/form/Form.php on lines 318..327
      src/form/Form.php on lines 359..368
      src/form/Form.php on lines 402..411
      src/form/Form.php on lines 448..457
      src/form/Form.php on lines 493..502
      src/form/Form.php on lines 535..544
      src/form/Form.php on lines 579..588
      src/form/Form.php on lines 620..629
      src/form/Form.php on lines 661..670
      src/form/Form.php on lines 702..711
      src/form/Form.php on lines 743..752
      src/form/Form.php on lines 784..793
      src/form/Form.php on lines 825..834
      src/form/Form.php on lines 866..875
      src/form/Form.php on lines 907..916
      src/form/Form.php on lines 948..957
      src/form/Form.php on lines 989..998
      src/form/Form.php on lines 1030..1039
      src/form/Form.php on lines 1071..1080

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

      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

      Severity
      Category
      Status
      Source
      Language