dmelo/you2better

View on GitHub
src/YouBetter/YouBetter.php

Summary

Maintainability
D
1 day
Test Coverage

Method saveUrl has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function saveUrl($url)
    {
        $this->logger->info("saving url: $url");
        $url = parse_url($url);
        $host = 'ssl://' . $url['host'];
Severity: Major
Found in src/YouBetter/YouBetter.php - About 3 hrs to fix

    Method processRequest has 85 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function processRequest()
        {
            // config
            $conf = include('you2better-conf.php');
    
    
    Severity: Major
    Found in src/YouBetter/YouBetter.php - About 3 hrs to fix

      Function saveUrl has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          private function saveUrl($url)
          {
              $this->logger->info("saving url: $url");
              $url = parse_url($url);
              $host = 'ssl://' . $url['host'];
      Severity: Minor
      Found in src/YouBetter/YouBetter.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 checkFileSize has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          private function checkFileSize($cacheFilenameHeader, $cacheFilenameContent)
          {
              $ret = false;
              if (($fd = fopen($cacheFilenameHeader, 'r')) !== false) {
                  while (!feof($fd)) {
      Severity: Minor
      Found in src/YouBetter/YouBetter.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 processRequest has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          public function processRequest()
          {
              // config
              $conf = include('you2better-conf.php');
      
      
      Severity: Minor
      Found in src/YouBetter/YouBetter.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

      Method checkFileSize has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function checkFileSize($cacheFilenameHeader, $cacheFilenameContent)
          {
              $ret = false;
              if (($fd = fopen($cacheFilenameHeader, 'r')) !== false) {
                  while (!feof($fd)) {
      Severity: Minor
      Found in src/YouBetter/YouBetter.php - About 1 hr to fix

        There are no issues that match your filters.

        Category
        Status