Oefenweb/cakephp-uni-login-webservice

View on GitHub

Showing 9 of 21 total issues

File UniLoginTest.php has 287 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
App::uses('UniLogin', 'UniLoginWebservice.Model');
App::uses('PHPUnitUtil', 'Lib');

class TestUniLogin extends UniLogin {
Severity: Minor
Found in Test/Case/Model/UniLoginTest.php - About 2 hrs to fix

    Function _convertInstitutionList has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function _convertInstitutionList($institutionList) {
            $result = false;
            if (is_object($institutionList)) {
                $property = 'InstitutionSimpel';
                if (property_exists($institutionList, $property)) {
    Severity: Minor
    Found in Model/UniLogin.php - About 2 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

    Function _convertUserList has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        protected function _convertUserList($userList) {
            $result = false;
            if (is_object($userList)) {
                $property = 'PersonSimpel';
                if (property_exists($userList, $property)) {
    Severity: Minor
    Found in Model/UniLogin.php - About 2 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 UniLogin.php has 258 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    App::uses('UniLoginWebserviceAppModel', 'UniLoginWebservice.Model');
    
    /**
     * UniLogin Model.
    Severity: Minor
    Found in Model/UniLogin.php - About 2 hrs to fix

      Method testConvertInstitutionValid has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function testConvertInstitutionValid() {
              $institution = new stdClass();
              $institution->Instnr = '101001';
              $institution->Navn = 'Name of institution.';
              $institution->Type = '121';
      Severity: Minor
      Found in Test/Case/Model/UniLoginTest.php - About 1 hr to fix

        Method _convertUser has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function _convertUser($user, $minimal = false) {
                $mapping = [
                    'uni_login_key' => 'Brugerid',
                    'full_name' => 'Navn',
                    'first_name' => 'Fornavn',
        Severity: Minor
        Found in Model/UniLogin.php - About 1 hr to fix

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

              protected function _convertUser($user, $minimal = false) {
                  $mapping = [
                      'uni_login_key' => 'Brugerid',
                      'full_name' => 'Navn',
                      'first_name' => 'Fornavn',
          Severity: Minor
          Found in Model/UniLogin.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 _convertInstitution has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function _convertInstitution($institution, $minimal = false) {
                  $mapping = [
                      'uni_login_key' => 'Instnr',
                      'name' => 'Navn',
                      'type' => 'Type',
          Severity: Minor
          Found in Model/UniLogin.php - About 1 hr to fix

            Function _convertInstitution has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                protected function _convertInstitution($institution, $minimal = false) {
                    $mapping = [
                        'uni_login_key' => 'Instnr',
                        'name' => 'Navn',
                        'type' => 'Type',
            Severity: Minor
            Found in Model/UniLogin.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

            Severity
            Category
            Status
            Source
            Language