educach/dsb-client

View on GitHub

Showing 54 of 67 total issues

Function putDescription has a Cognitive Complexity of 8 (exceeds 5 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 45 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 getVCName has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    public static function getVCName($vocabularyEntry, array $languageFallback = null)
    {
        $vocabularyEntry = (array) $vocabularyEntry;
        if (isset($vocabularyEntry['ontologyName'])) {
            if (isset($languageFallback)) {
Severity: Minor
Found in src/Educa/DSB/Client/Utils.php - About 45 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 __construct has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public function __construct($type, $id, $name = null, $code = null, $url = null, $schoolYears = null)
Severity: Minor
Found in src/Educa/DSB/Client/Curriculum/Term/PerTerm.php - About 45 mins to fix

    Function setTreeBasedOnTaxonTree has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function setTreeBasedOnTaxonTree($trees)
        {
            // Prepare a new root item.
            $this->root = $this->termFactory('root', 'root');
    
    
    Severity: Minor
    Found in src/Educa/DSB/Client/Curriculum/BaseCurriculum.php - About 35 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 findChildrenByNameRecursive has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function findChildrenByNameRecursive($name)
        {
            $result = array();
            foreach ($this->getChildren() as $child) {
                if ($child->describe()->name == $name) {
    Severity: Minor
    Found in src/Educa/DSB/Client/Curriculum/Term/BaseTerm.php - About 35 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 findChildByCodeRecursive has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function findChildByCodeRecursive($code)
        {
            foreach ($this->getChildren() as $child) {
                if ($child->getCode() == $code) {
                    return $child;
    Severity: Minor
    Found in src/Educa/DSB/Client/Curriculum/Term/Traits/HasCode.php - About 35 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 getPartnerStatistics has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

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

        public static function getLSValue($langString, array $languageFallback = array('de', 'fr', 'it', 'rm', 'en'))
        {
            if (is_scalar($langString)) {
                return $langString;
            } else {
    Severity: Minor
    Found in src/Educa/DSB/Client/Utils.php - About 35 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 findChildrenByTypeRecursive has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function findChildrenByTypeRecursive($type)
        {
            $result = array();
            foreach ($this->getChildren() as $child) {
                if ($child->describe()->type == $type) {
    Severity: Minor
    Found in src/Educa/DSB/Client/Curriculum/Term/BaseTerm.php - About 35 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 findChildByIdentifierRecursive has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        public function findChildByIdentifierRecursive($id)
        {
            foreach ($this->getChildren() as $child) {
                if ($child->describe()->id == $id) {
                    return $child;
    Severity: Minor
    Found in src/Educa/DSB/Client/Curriculum/Term/BaseTerm.php - About 35 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

    Avoid too many return statements within this method.
    Open

            return (object) array(
                'curriculum' => $root,
                'dictionary' => $dictionary,
            );
    Severity: Major
    Found in src/Educa/DSB/Client/Curriculum/LP21Curriculum.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                                      return $carry;
      Severity: Major
      Found in src/Educa/DSB/Client/Curriculum/LP21Curriculum.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return $nodes;
        Severity: Major
        Found in src/Educa/DSB/Client/Curriculum/LP21Curriculum.php - About 30 mins to fix

          Function getPartner has a Cognitive Complexity of 6 (exceeds 5 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 25 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

          Severity
          Category
          Status
          Source
          Language