codeformunich/Muenchen-Transparent

View on GitHub
protected/models/Termin.php

Summary

Maintainability
C
1 day
Test Coverage

The method Termin::copyToHistory() calls the typical debug function print_r() which is mostly only used during development.
Open

                RISTools::report_ris_parser_error("Termin:moveToHistory Error", print_r($history->getErrors(), true));
Severity: Minor
Found in protected/models/Termin.php by phpmd

DevelopmentCodeFragment

Since: 2.3.0

Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.

Example

class SuspectCode {

    public function doSomething(array $items)
    {
        foreach ($items as $i => $item) {
            // …

            if ('qafoo' == $item) var_dump($i);

            // …
        }
    }
}

Source https://phpmd.org/rules/design.html#developmentcodefragment

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

class Termin extends CActiveRecord implements IRISItemHasDocuments
{
    public const CANCELED_STR = 'Entfällt';

    public const TYP_AUTO = 0;
Severity: Minor
Found in protected/models/Termin.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 Termin has an overall complexity of 56 which is very high. The configured complexity threshold is 50.
Open

class Termin extends CActiveRecord implements IRISItemHasDocuments
{
    public const CANCELED_STR = 'Entfällt';

    public const TYP_AUTO = 0;
Severity: Minor
Found in protected/models/Termin.php by phpmd

Termin has 23 functions (exceeds 20 allowed). Consider refactoring.
Open

class Termin extends CActiveRecord implements IRISItemHasDocuments
{
    public const CANCELED_STR = 'Entfällt';

    public const TYP_AUTO = 0;
Severity: Minor
Found in protected/models/Termin.php - About 2 hrs to fix

    File Termin.php has 259 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * This is the model class for table "termine".
     *
    Severity: Minor
    Found in protected/models/Termin.php - About 2 hrs to fix

      Method termine_stadtrat_zeitraum has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          public function termine_stadtrat_zeitraum(?int $ba_nr, \DateTime $dateFrom, \DateTime $dateTo, bool $asc = true, int $limit = 0)
      Severity: Minor
      Found in protected/models/Termin.php - About 35 mins to fix

        Avoid too many return statements within this method.
        Open

                return $tos[0];
        Severity: Major
        Found in protected/models/Termin.php - About 30 mins to fix

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

                  foreach ($data as $key => $val) ksort($data[$key]["gremien"]);
          Severity: Minor
          Found in protected/models/Termin.php by phpmd

          UnusedLocalVariable

          Since: 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 https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

          Avoid unused parameters such as '$ba_nr'.
          Open

              public function neueste_str_protokolle($ba_nr, $zeit_von, $zeit_bis, $limit = 0)
          Severity: Minor
          Found in protected/models/Termin.php by phpmd

          UnusedFormalParameter

          Since: 0.2

          Avoid passing parameters to methods or constructors and then not using those parameters.

          Example

          class Foo
          {
              private function bar($howdy)
              {
                  // $howdy is not used
              }
          }

          Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter

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

                  $params = [
                      'condition' => $ba_sql . ' AND datum_letzte_aenderung >= "' . addslashes($zeit_von) . '" AND datum_letzte_aenderung <= "' . addslashes($zeit_bis) . '"',
                      'order'     => 'datum DESC',
                      'with'      => [
                          'antraegeDokumente' => [
          Severity: Minor
          Found in protected/models/Termin.php and 1 other location - About 55 mins to fix
          protected/models/Termin.php on lines 208..215

          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

          Further Reading

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

                  $params = [
                      'condition' => $ba_sql . ' AND datum_letzte_aenderung >= "' . addslashes($zeit_von) . '" AND datum_letzte_aenderung <= "' . addslashes($zeit_bis) . '"',
                      'order'     => 'datum DESC',
                      'with'      => [
                          'antraegeDokumente' => [
          Severity: Minor
          Found in protected/models/Termin.php and 1 other location - About 55 mins to fix
          protected/models/Termin.php on lines 232..239

          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

          Further Reading

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

              public function relations()
              {
                  // NOTE: you may need to adjust the relation name and the related
                  // class name for the relations automatically generated below.
                  return [
          Severity: Major
          Found in protected/models/Termin.php and 3 other locations - About 55 mins to fix
          protected/models/AntragOrt.php on lines 62..73
          protected/models/Tagesordnungspunkt.php on lines 71..82
          protected/models/TagesordnungspunktHistory.php on lines 66..77

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

          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 3 locations. Consider refactoring.
          Open

              public function rules()
              {
                  // NOTE: you should only define rules for those attributes that
                  // will receive user inputs.
                  return [
          Severity: Minor
          Found in protected/models/Termin.php and 2 other locations - About 30 mins to fix
          protected/models/Dokument.php on lines 105..117
          protected/models/TerminHistory.php on lines 46..58

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

          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

          There are no issues that match your filters.

          Category
          Status