VIPnytt/RobotsTxtParser

View on GitHub

Showing 12 of 12 total issues

Method request has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function request($options = [])
    {
        $curl = curl_init();
        $caPathOrFile = CaBundle::getSystemCaRootBundlePath();
        // Set default cURL options
Severity: Minor
Found in src/UriClient.php - About 1 hr to fix

    Method cron has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function cron($timeLimit = self::CRON_EXEC_TIME, $workerID = self::WORKER_ID)
        {
            $start = microtime(true);
            $workerID = $this->setWorkerID($workerID);
            $log = [];
    Severity: Minor
    Found in src/Client/Cache/MySQL/Manage.php - About 1 hr to fix

      Method refresh has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function refresh()
          {
              $client = new UriClient($this->base, $this->curlOptions, $this->byteLimit);
              $effective = $client->getEffectiveUri();
              if ($effective == $this->base) {
      Severity: Minor
      Found in src/Client/Cache/MySQL/Base.php - About 1 hr to fix

        Method client has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function client()
            {
                $query = $this->pdo->prepare(<<<SQL
        SELECT
          content,
        Severity: Minor
        Found in src/Client/Cache/MySQL/Base.php - About 1 hr to fix

          Method displacePush has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function displacePush($nextUpdate)
              {
                  $query = $this->pdo->prepare(<<<SQL
          SELECT
            validUntil,
          Severity: Minor
          Found in src/Client/Cache/MySQL/Base.php - About 1 hr to fix

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

                private function arrayDiffAssocRecursive(array &$array1, array &$array2)
                {
                    $difference = [];
                    foreach ($array1 as $key => &$value) {
                        if (is_array($value)) {
            Severity: Minor
            Found in src/Import.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

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

                public function cron($timeLimit = self::CRON_EXEC_TIME, $workerID = self::WORKER_ID)
                {
                    $start = microtime(true);
                    $workerID = $this->setWorkerID($workerID);
                    $log = [];
            Severity: Minor
            Found in src/Client/Cache/MySQL/Manage.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

                    $baseUri,
                    $statusCode,
                    $content,
                    $encoding = self::ENCODING,
                    $effectiveUri = null,
            Severity: Minor
            Found in src/TxtClient.php - About 45 mins to fix

              Method callback has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function callback($errno, $errstr, $errfile = '', $errline = 0, $errcontext = [])
              Severity: Minor
              Found in src/Handler/ErrorHandler.php - About 35 mins to fix

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

                    private function determine($timestamp)
                    {
                        $values = [];
                        foreach ($this->rates as $array) {
                            if (!isset($array['from']) ||
                Severity: Minor
                Found in src/Client/Directives/RequestRateClient.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 arrayMergeRecursiveEx has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function arrayMergeRecursiveEx(array $array1, array &$array2)
                    {
                        foreach ($array2 as $key => &$value) {
                            if (is_array($value) &&
                                isset($array1[$key]) &&
                Severity: Minor
                Found in src/Import.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 lineBreak has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function lineBreak()
                    {
                        if ($this->previousRoot !== $this->directive &&
                            in_array($this->directive, array_keys(RobotsTxtParser::TOP_LEVEL_DIRECTIVES)) ||
                            $this->previous !== self::DIRECTIVE_USER_AGENT &&
                Severity: Minor
                Found in src/Handler/RenderHandler.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