keboola/gooddata-php-client

View on GitHub
src/Projects.php

Summary

Maintainability
C
1 day
Test Coverage

File Projects.php has 285 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php
/**
 * @package gooddata-php-client
 * @copyright Keboola
 * @author Jakub Matejka <jakub@keboola.com>
Severity: Minor
Found in src/Projects.php - About 2 hrs to fix

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

        public function inviteUser($pid, $email, $role = Projects::ROLE_ADMIN, $filters = [])
        {
            $projectRoleUri = $this->getRoleUri($pid, $role);
    
            try {
    Severity: Minor
    Found in src/Projects.php - About 1 hr to fix

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

          public function createProject($title, $authToken, $description = null, $testing = false, $driver = 'Pg')
          {
              $result = $this->client->post('/gdc/projects', [
                  'project' => [
                      'content' => [
      Severity: Minor
      Found in src/Projects.php - About 1 hr to fix

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

            public function addUser($pid, $uid, $role = self::ROLE_ADMIN)
            {
                $projectRoleUri = $this->getRoleUri($pid, $role);
        
                $uri = "/gdc/projects/$pid/users";
        Severity: Minor
        Found in src/Projects.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 addUser has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function addUser($pid, $uid, $role = self::ROLE_ADMIN)
            {
                $projectRoleUri = $this->getRoleUri($pid, $role);
        
                $uri = "/gdc/projects/$pid/users";
        Severity: Minor
        Found in src/Projects.php - About 1 hr to fix

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

              public function inviteUser($pid, $email, $role = Projects::ROLE_ADMIN, $filters = [])
              {
                  $projectRoleUri = $this->getRoleUri($pid, $role);
          
                  try {
          Severity: Minor
          Found in src/Projects.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 createProject has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              public function createProject($title, $authToken, $description = null, $testing = false, $driver = 'Pg')
          Severity: Minor
          Found in src/Projects.php - About 35 mins to fix

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

                public function createProject($title, $authToken, $description = null, $testing = false, $driver = 'Pg')
                {
                    $result = $this->client->post('/gdc/projects', [
                        'project' => [
                            'content' => [
            Severity: Minor
            Found in src/Projects.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 isAccessible has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function isAccessible($pid)
                {
                    $projectUri = self::getUriFromPid($pid);
                    $uid = $this->client->getUsers()->getCurrentUid();
                    foreach ($this->client->getUsers()->getProjectsYield($uid) as $projects) {
            Severity: Minor
            Found in src/Projects.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

            Function cancelInvitation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                public function cancelInvitation($pid, $email)
                {
                    $result = $this->client->get("/gdc/projects/$pid/invitations");
                    foreach ($result['invitations'] as $r) {
                        if (strtolower($r['invitation']['content']['email']) != strtolower($email)) {
            Severity: Minor
            Found in src/Projects.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

            There are no issues that match your filters.

            Category
            Status