gridonic/hapi

View on GitHub

Showing 43 of 43 total issues

HarvestApi has 110 functions (exceeds 20 allowed). Consider refactoring.
Open

 class HarvestApi
 {
    /**
     *  WAIT
     */
Severity: Major
Found in src/Harvest/HarvestApi.php - About 2 days to fix

    File HarvestApi.php has 802 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace Harvest;
    
    use Harvest\Model\Client,
    Severity: Major
    Found in src/Harvest/HarvestApi.php - About 1 day to fix

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

          protected function performMultiPart($url, $data)
          {
              $rData = null;
              $code = null;
              $success = false;
      Severity: Major
      Found in src/Harvest/HarvestApi.php and 1 other location - About 4 hrs to fix
      src/Harvest/HarvestApi.php on lines 2590..2608

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

      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

          protected function performPut($url, $data)
          {
              $rData = null;
              $code = null;
              $success = false;
      Severity: Major
      Found in src/Harvest/HarvestApi.php and 1 other location - About 4 hrs to fix
      src/Harvest/HarvestApi.php on lines 2723..2741

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

      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

      Function parseNode has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function parseNode($node)
          {
              $item = null;
              switch ($node->nodeName) {
                  case "expense-category":
      Severity: Minor
      Found in src/Harvest/HarvestApi.php - About 3 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

      Method parseNode has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function parseNode($node)
          {
              $item = null;
              switch ($node->nodeName) {
                  case "expense-category":
      Severity: Major
      Found in src/Harvest/HarvestApi.php - About 2 hrs to fix

        File HarvestReports.php has 264 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        
        namespace Harvest;
        
        
        Severity: Minor
        Found in src/Harvest/HarvestReports.php - About 2 hrs to fix

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

              public function getActiveTimers()
              {
                  $result = $this->getActiveUsers( );
                  if ( $result->isSuccess() ) {
                      $data = array();
          Severity: Minor
          Found in src/Harvest/HarvestReports.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

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

                  while (! $success) {
                      $ch = $this->generateDeleteCurl($url);
                      $data = curl_exec($ch);
                      $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
                      if ($this->_mode == HarvestApi::RETRY && $code == "503") {
          Severity: Major
          Found in src/Harvest/HarvestApi.php and 1 other location - About 1 hr to fix
          src/Harvest/HarvestApi.php on lines 2541..2551

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

          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

                  while (! $success) {
                      $ch = $this->generateCurl($url);
                      $data = curl_exec($ch);
                      $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
                      if ($this->_mode == HarvestApi::RETRY && $code == "503") {
          Severity: Major
          Found in src/Harvest/HarvestApi.php and 1 other location - About 1 hr to fix
          src/Harvest/HarvestApi.php on lines 2688..2698

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

          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

          Function performPost has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function performPost($url, $data, $multi = "id")
              {
                  $rData = null;
                  $code = null;
                  $success = false;
          Severity: Minor
          Found in src/Harvest/HarvestApi.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 performGet has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              protected function performGet($url, $multi = true)
              {
                  $data = null;
                  $code = null;
                  $success = false;
          Severity: Minor
          Found in src/Harvest/HarvestApi.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 performPost has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function performPost($url, $data, $multi = "id")
              {
                  $rData = null;
                  $code = null;
                  $success = false;
          Severity: Minor
          Found in src/Harvest/HarvestApi.php - About 1 hr to fix

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

                public function __call($method, $arguments)
                {
                    if ( count($arguments) == 0 ) {
                        return $this->get( $method );
                    } elseif ( count( $arguments ) == 1 ) {
            Severity: Minor
            Found in src/Harvest/Model/Harvest.php and 1 other location - About 55 mins to fix
            src/Harvest/Model/DailyActivity.php on lines 96..105

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

            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

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

                public function __call($method, $arguments)
                {
                    if ( count($arguments) == 0 ) {
                        return $this->get( $method );
                    } elseif ( count( $arguments ) == 1 ) {
            Severity: Minor
            Found in src/Harvest/Model/DailyActivity.php and 1 other location - About 55 mins to fix
            src/Harvest/Model/Harvest.php on lines 113..122

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

            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 getUserEntries($user_id, Range $range, $project_id = null)
                {
                    $url = "people/" . $user_id . "/entries?from=" . $range->from() . '&to=' . $range->to();
                    if (! is_null($project_id)) {
                        $url .= "&project_id=" . $project_id;
            Severity: Minor
            Found in src/Harvest/HarvestApi.php and 1 other location - About 50 mins to fix
            src/Harvest/HarvestApi.php on lines 1802..1810

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

            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 getProjectEntries($project_id, Range $range, $user_id = null)
                {
                    $url = "projects/" . $project_id . "/entries?from=" . $range->from() . '&to=' . $range->to();
                    if (! is_null($user_id)) {
                        $url .= "&user_id=" . $user_id;
            Severity: Minor
            Found in src/Harvest/HarvestApi.php and 1 other location - About 50 mins to fix
            src/Harvest/HarvestApi.php on lines 1833..1841

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

            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

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

                public function toURL()
                {
                    $query = "";
                    if(!is_null($this->_page)) {
                        $query .= "&page=" . $this->_page;
            Severity: Minor
            Found in src/Harvest/Model/Invoice/Filter.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 get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function get($property)
                {
                    switch ($property) {
                        case 'code':
                            return $this->_code;
            Severity: Minor
            Found in src/Harvest/Model/Result.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 getUsersActiveTimer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                public function getUsersActiveTimer($user_id)
                {
                    $result = $this->getUserEntries( $user_id, Range::today( $this->_timeZone ) );
                    if ( $result->isSuccess() ) {
                        $data = null;
            Severity: Minor
            Found in src/Harvest/HarvestReports.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