educach/dsb-client

View on GitHub
src/Educa/DSB/Client/Curriculum/PerCurriculum.php

Summary

Maintainability
D
3 days
Test Coverage

Function fetchObjectivesAndProgressions has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    public static function fetchObjectivesAndProgressions($url, $root, $dictionary, $objectiveIds)
    {
        if (preg_match('/\/$/', $url)) {
            $url = rtrim($url, '/');
        }
Severity: Minor
Found in src/Educa/DSB/Client/Curriculum/PerCurriculum.php - About 5 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

File PerCurriculum.php has 369 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/**
 * @file
 * Contains \Educa\DSB\Client\Curriculum\PerCurriculum.
Severity: Minor
Found in src/Educa/DSB/Client/Curriculum/PerCurriculum.php - About 4 hrs to fix

    Method fetchObjectivesAndProgressions has 100 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function fetchObjectivesAndProgressions($url, $root, $dictionary, $objectiveIds)
        {
            if (preg_match('/\/$/', $url)) {
                $url = rtrim($url, '/');
            }
    Severity: Major
    Found in src/Educa/DSB/Client/Curriculum/PerCurriculum.php - About 4 hrs to fix

      Function fetchDomainsAndDisciplines has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          public static function fetchDomainsAndDisciplines($url, $root, $dictionary)
          {
              if (preg_match('/\/$/', $url)) {
                  $url = rtrim($url, '/');
              }
      Severity: Minor
      Found in src/Educa/DSB/Client/Curriculum/PerCurriculum.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

      Method fetchDomainsAndDisciplines has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static function fetchDomainsAndDisciplines($url, $root, $dictionary)
          {
              if (preg_match('/\/$/', $url)) {
                  $url = rtrim($url, '/');
              }
      Severity: Major
      Found in src/Educa/DSB/Client/Curriculum/PerCurriculum.php - About 2 hrs to fix

        Method describeDataStructure has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function describeDataStructure()
            {
                return array(
                    (object) array(
                        'type' => 'cycles',
        Severity: Minor
        Found in src/Educa/DSB/Client/Curriculum/PerCurriculum.php - About 1 hr to fix

          Method describeTermTypes has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function describeTermTypes()
              {
                  return array(
                      (object) array(
                          'type' => 'cycles',
          Severity: Minor
          Found in src/Educa/DSB/Client/Curriculum/PerCurriculum.php - About 1 hr to fix

            Function termFactory has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function termFactory($type, $taxonId, $name = null)
                {
                    $code = $url = $schoolYears = null;
                    if (isset($this->curriculumDictionary["{$type}:{$taxonId}"])) {
                        $definition = $this->curriculumDictionary["{$type}:{$taxonId}"];
            Severity: Minor
            Found in src/Educa/DSB/Client/Curriculum/PerCurriculum.php - About 55 mins 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

            There are no issues that match your filters.

            Category
            Status