educach/dsb-client

View on GitHub

Showing 54 of 67 total issues

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

      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

            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

              Method putDescription has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Function authenticate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function authenticate()
                    {
                        if (!file_exists($this->privateKeyPath)) {
                            throw new ClientAuthenticationException("Private key could not be loaded. Is the path correct ?");
                        }
                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

                Method __construct has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function __construct($type, $id, $name = null, $code = null, $version = null, $url = null, $cycles = null, $cantons = null)
                Severity: Major
                Found in src/Educa/DSB/Client/Curriculum/Term/LP21Term.php - About 1 hr to fix

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

                      public function mapTerm($source, $target, TermInterface $term)
                      {
                          if (
                              ($source == 'educa' && $target == 'classification system') ||
                              ($source == 'classification system' && $target == 'educa')
                  Severity: Minor
                  Found in src/Educa/DSB/Client/Curriculum/ClassificationSystemCurriculum.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

                  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

                  Method getPartnerStatistics has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                          $partnerId,
                          $from,
                          $to,
                          $aggregationMethod = 'day',
                          $lomId = null,
                  Severity: Major
                  Found in src/Educa/DSB/Client/ApiClient/ClientV2.php - About 50 mins to fix

                    Method loadPartnerStatistics has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function loadPartnerStatistics($partnerId, $from, $to, $aggregationMethod = 'day', $lomId = null, $limit = null, $offset = null);
                    Severity: Major
                    Found in src/Educa/DSB/Client/ApiClient/ClientInterface.php - About 50 mins to fix

                      Method search has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                              $query = '',
                              array $useFacets = array(),
                              array $filters = array(),
                              array $additionalFields = array(),
                              $offset = 0,
                      Severity: Major
                      Found in src/Educa/DSB/Client/ApiClient/ClientInterface.php - About 50 mins to fix

                        Method search has 7 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                                $query = '',
                                array $useFacets = [],
                                array $filters = [],
                                array $additionalFields = [],
                                $offset = 0,
                        Severity: Major
                        Found in src/Educa/DSB/Client/ApiClient/ClientV2.php - About 50 mins to fix

                          Method getPartnerStatistics has 7 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              public function getPartnerStatistics($partnerId, $from, $to, $aggregationMethod = 'day', $lomId = null, $limit = null, $offset = null);
                          Severity: Major
                          Found in src/Educa/DSB/Client/ApiClient/ClientInterface.php - About 50 mins to fix

                            Method loadPartnerStatistics has 7 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                    $partnerId,
                                    $from,
                                    $to,
                                    $aggregationMethod = 'day',
                                    $lomId = null,
                            Severity: Major
                            Found in src/Educa/DSB/Client/ApiClient/ClientV2.php - About 50 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language