educach/dsb-client

View on GitHub

Showing 67 of 67 total issues

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

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

    Method setTreeBasedOnTaxonPath has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function setTreeBasedOnTaxonPath($paths, $purpose = 'discipline')
        {
            // Prepare a new root item.
            $this->root = $this->termFactory('root', 'root');
    
    
    Severity: Minor
    Found in src/Educa/DSB/Client/Curriculum/BaseCurriculum.php - About 1 hr to fix

      Method postDescription has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function postDescription($json, $catalogs = array(), $previewImage = false)
          {
              if (empty($this->tokenKey)) {
                  throw new ClientAuthenticationException("No token found. Cannot create a LOM description without a token.");
              }
      Severity: Minor
      Found in src/Educa/DSB/Client/ApiClient/ClientV2.php - About 1 hr to fix

        Function postDescription has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            public function postDescription($json, $catalogs = array(), $previewImage = false)
            {
                if (empty($this->tokenKey)) {
                    throw new ClientAuthenticationException("No token found. Cannot create a LOM description without a token.");
                }
        Severity: Minor
        Found in src/Educa/DSB/Client/ApiClient/ClientV2.php - About 1 hr 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

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

            protected function termFactory($type, $taxonId, $name = null)
            {
                $code = $version = $url = $cycles = $cantons = null;
                if (isset($this->curriculumDictionary[$taxonId])) {
                    $definition = $this->curriculumDictionary[$taxonId];
        Severity: Minor
        Found in src/Educa/DSB/Client/Curriculum/LP21Curriculum.php - About 1 hr 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 describeTermTypes has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function describeTermTypes()
            {
                return array(
                    (object) array(
                        'type' => 'fachbereich',
        Severity: Minor
        Found in src/Educa/DSB/Client/Curriculum/LP21Curriculum.php - About 1 hr 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

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

                public function describeDataStructure()
                {
                    return array(
                        (object) array(
                            'type' => 'school context',
            src/Educa/DSB/Client/Curriculum/EducaCurriculum.php on lines 63..87

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

            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 describeDataStructure()
                {
                    return array(
                        (object) array(
                            'type' => 'educa_school_levels',
            Severity: Major
            Found in src/Educa/DSB/Client/Curriculum/EducaCurriculum.php and 1 other location - About 1 hr to fix
            src/Educa/DSB/Client/Curriculum/ClassificationSystemCurriculum.php on lines 171..195

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

            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

            Method getPartner has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function getPartner($partner = null)
                {
                    if (empty($this->tokenKey)) {
                        throw new ClientAuthenticationException("No token found. Cannot load a partner without a token.");
                    }
            Severity: Minor
            Found in src/Educa/DSB/Client/ApiClient/ClientV2.php - About 1 hr to fix

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

                  public function getPartnerStatistics(
                      $partnerId,
                      $from,
                      $to,
                      $aggregationMethod = 'day',
              Severity: Minor
              Found in src/Educa/DSB/Client/ApiClient/ClientV2.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 isLegacyLOMCHFormat has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function isLegacyLOMCHFormat()
                      {
                          $metaDataSchema = $this->getField('metaMetadata.metadataSchema');
                          if (!empty($metaDataSchema)) {
                              // Is the data an array? If not, we are dealing with a legacy
                  Severity: Minor
                  Found in src/Educa/DSB/Client/Lom/LomDescription.php - About 1 hr 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 4 locations. Consider refactoring.
                  Open

                      public function post($path, array $options = array())
                      {
                          $options = $this->preProcessHeaders($options);
                          try {
                              $response = $this->client->post($this->apiUrl . $path, $options);
                  Severity: Major
                  Found in src/Educa/DSB/Client/ApiClient/AbstractClient.php and 3 other locations - About 1 hr to fix
                  src/Educa/DSB/Client/ApiClient/AbstractClient.php on lines 186..204
                  src/Educa/DSB/Client/ApiClient/AbstractClient.php on lines 223..241
                  src/Educa/DSB/Client/ApiClient/AbstractClient.php on lines 261..279

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

                  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 put($path, array $options = array())
                      {
                          $options = $this->preProcessHeaders($options);
                          try {
                              $response = $this->client->put($this->apiUrl . $path, $options);
                  Severity: Major
                  Found in src/Educa/DSB/Client/ApiClient/AbstractClient.php and 3 other locations - About 1 hr to fix
                  src/Educa/DSB/Client/ApiClient/AbstractClient.php on lines 148..166
                  src/Educa/DSB/Client/ApiClient/AbstractClient.php on lines 223..241
                  src/Educa/DSB/Client/ApiClient/AbstractClient.php on lines 261..279

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

                  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 delete($path, array $options = array())
                      {
                          $options = $this->preProcessHeaders($options);
                          try {
                              $response = $this->client->delete($this->apiUrl . $path, $options);
                  Severity: Major
                  Found in src/Educa/DSB/Client/ApiClient/AbstractClient.php and 3 other locations - About 1 hr to fix
                  src/Educa/DSB/Client/ApiClient/AbstractClient.php on lines 148..166
                  src/Educa/DSB/Client/ApiClient/AbstractClient.php on lines 186..204
                  src/Educa/DSB/Client/ApiClient/AbstractClient.php on lines 223..241

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

                  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 get($path, array $options = array())
                      {
                          $options = $this->preProcessHeaders($options);
                          try {
                              $response = $this->client->get($this->apiUrl . $path, $options);
                  Severity: Major
                  Found in src/Educa/DSB/Client/ApiClient/AbstractClient.php and 3 other locations - About 1 hr to fix
                  src/Educa/DSB/Client/ApiClient/AbstractClient.php on lines 148..166
                  src/Educa/DSB/Client/ApiClient/AbstractClient.php on lines 186..204
                  src/Educa/DSB/Client/ApiClient/AbstractClient.php on lines 261..279

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

                  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

                  Method search has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function search(
                          $query = '',
                          array $useFacets = [],
                          array $filters = [],
                          array $additionalFields = [],
                  Severity: Minor
                  Found in src/Educa/DSB/Client/ApiClient/ClientV2.php - About 1 hr to fix

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

                        public function findChildrenByTypeRecursive($type)
                        {
                            $result = array();
                            foreach ($this->getChildren() as $child) {
                                if ($child->describe()->type == $type) {
                    Severity: Major
                    Found in src/Educa/DSB/Client/Curriculum/Term/BaseTerm.php and 1 other location - About 1 hr to fix
                    src/Educa/DSB/Client/Curriculum/Term/BaseTerm.php on lines 343..356

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

                    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 findChildrenByNameRecursive($name)
                        {
                            $result = array();
                            foreach ($this->getChildren() as $child) {
                                if ($child->describe()->name == $name) {
                    Severity: Major
                    Found in src/Educa/DSB/Client/Curriculum/Term/BaseTerm.php and 1 other location - About 1 hr to fix
                    src/Educa/DSB/Client/Curriculum/Term/BaseTerm.php on lines 375..388

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

                    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