t1gor/Robots.txt-Parser-Class

View on GitHub
source/RobotsTxtParser.php

Summary

Maintainability
D
2 days
Test Coverage

Showing 527 of 527 total issues

File RobotsTxtParser.php has 353 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php declare(strict_types=1);
 
namespace t1gor\RobotsTxtParser;
 
use Psr\Log\LoggerAwareInterface;
Severity: Minor
Found in source/RobotsTxtParser.php - About 4 hrs to fix

    The class RobotsTxtParser has an overall complexity of 103 which is very high. The configured complexity threshold is 50.
    Open

    class RobotsTxtParser implements LoggerAwareInterface {
     
    use LogsIfAvailableTrait;
     
    // default encoding
    Severity: Minor
    Found in source/RobotsTxtParser.php by phpmd

    RobotsTxtParser has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class RobotsTxtParser implements LoggerAwareInterface {
     
    use LogsIfAvailableTrait;
     
    // default encoding
    Severity: Minor
    Found in source/RobotsTxtParser.php - About 3 hrs to fix

      Function parseURL has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      protected function parseURL($url) {
      $parsed = parse_url($url);
      if ($parsed === false) {
      return false;
      } elseif (!isset($parsed['scheme']) || !$this->isValidScheme($parsed['scheme'])) {
      Severity: Minor
      Found in source/RobotsTxtParser.php - About 1 hr to fix

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

      public function render($eol = "\r\n") {
      $input = $this->getRules();
      krsort($input);
      $output = [];
      foreach ($input as $userAgent => $rules) {
      Severity: Minor
      Found in source/RobotsTxtParser.php - About 1 hr to fix

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

      public function render($eol = "\r\n") {
      $input = $this->getRules();
      krsort($input);
      $output = [];
      foreach ($input as $userAgent => $rules) {
      Severity: Minor
      Found in source/RobotsTxtParser.php - About 1 hr to fix

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

        public function getSitemaps(?string $userAgent = null): array {
        $this->buildTree();
        $maps = [];
         
        if (!is_null($userAgent)) {
        Severity: Minor
        Found in source/RobotsTxtParser.php - About 1 hr to fix

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

        protected function checkRules(string $rule, string $path, string $userAgent = '*'): bool {
        // check for disallowed http status code
        if ($this->checkHttpStatusCodeRule()) {
        return ($rule === Directive::DISALLOW);
        }
        Severity: Minor
        Found in source/RobotsTxtParser.php - About 1 hr to fix

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

        $content,
        string $encoding = self::DEFAULT_ENCODING,
        ?TreeBuilderInterface $treeBuilder = null,
        ?ReaderInterface $reader = null,
        ?UserAgentMatcherInterface $userAgentMatcher = null
        Severity: Minor
        Found in source/RobotsTxtParser.php - About 35 mins to fix

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

          public function getHost(?string $userAgent = null) {
          $this->buildTree();
           
          if (!is_null($userAgent)) {
          $userAgent = $this->userAgentMatcher->getMatching($userAgent, array_keys($this->tree));
          Severity: Minor
          Found in source/RobotsTxtParser.php - About 35 mins to fix

          Avoid too many return statements within this method.
          Open

          return $parsed;
          Severity: Major
          Found in source/RobotsTxtParser.php - About 30 mins to fix

            The method parseURL() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10.
            Open

            protected function parseURL($url) {
            $parsed = parse_url($url);
            if ($parsed === false) {
            return false;
            } elseif (!isset($parsed['scheme']) || !$this->isValidScheme($parsed['scheme'])) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            The class RobotsTxtParser has a coupling between objects value of 15. Consider to reduce the number of dependencies under 13.
            Open

            class RobotsTxtParser implements LoggerAwareInterface {
             
            use LogsIfAvailableTrait;
             
            // default encoding
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            Missing class import via use statement (line '236', column '13').
            Open

            throw new \RuntimeException(WarmingMessages::SET_UA_DEPRECATED);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            Avoid using static access to class '\t1gor\RobotsTxtParser\Parser\HostName' in method 'isValidHostName'.
            Open

            return HostName::isValid($host);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            The method parseURL uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

            } else {
            if (!isset($parsed['host']) || !$this->isValidHostName($parsed['host'])) {
            return false;
            } else {
            if (!isset($parsed['port'])) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            Avoid using static access to class 't1gor\RobotsTxtParser\Directive' in method 'checkRuleSwitch'.
            Open

            switch (Directive::attemptGetInline($rule)) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            The method parseURL uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

            } else {
            if (!isset($parsed['port'])) {
            $parsed['port'] = getservbyname($parsed['scheme'], 'tcp');
            if (!is_int($parsed['port'])) {
            return false;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            Avoid using static access to class 't1gor\RobotsTxtParser\Directive' in method 'checkRuleSwitch'.
            Open

            if ($this->checkCleanParamRule(Directive::stripInline($rule), $path)) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            Avoid using static access to class 't1gor\RobotsTxtParser\Directive' in method 'checkRuleSwitch'.
            Open

            if ($this->checkHostRule(Directive::stripInline($rule))) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            Avoid using static access to class '\t1gor\RobotsTxtParser\Stream\GeneratorBasedReader' in method '__construct'.
            Open

            ? GeneratorBasedReader::fromStream($content)
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            The method getSitemaps uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

            } else {
            foreach ($this->tree as $userAgentBased) {
            if (isset($userAgentBased[Directive::SITEMAP]) && !empty($userAgentBased[Directive::SITEMAP])) {
            $maps = array_merge($maps, $userAgentBased[Directive::SITEMAP]);
            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            The method render uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
            Open

            } else {
            $output[] = $directive . ': ' . $value;
            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            Avoid using static access to class '\t1gor\RobotsTxtParser\Parser\DirectiveProcessorsFactory' in method 'buildTree'.
            Open

            DirectiveProcessorsFactory::getDefault($this->logger),
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            Avoid using static access to class '\t1gor\RobotsTxtParser\Stream\GeneratorBasedReader' in method '__construct'.
            Open

            : GeneratorBasedReader::fromString($content);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            Avoid using static access to class '\t1gor\RobotsTxtParser\Parser\Url' in method 'isValidScheme'.
            Open

            return Url::isValidScheme($scheme);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            Avoid unused private fields such as '$userAgent'.
            Open

            private $userAgent = '*';
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            Avoid unused private fields such as '$content'.
            Open

            private $content = '';
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            Avoid unused parameters such as '$userAgent'.
            Open

            public function setUserAgent(string $userAgent) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            Avoid variables with short names like $b. Configured minimum length is 3.
            Open

            usort($value, function ($a, $b) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            Avoid variables with short names like $a. Configured minimum length is 3.
            Open

            usort($value, function ($a, $b) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            Blank line found at start of control structure
            Open

            switch (Directive::attemptGetInline($rule)) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace of a class must be on the line after the definition
            Open

            class RobotsTxtParser implements LoggerAwareInterface {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Scope keyword "private" must be followed by a single space
            Open

            private $content = '';
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            CASE statements must be defined using a colon
            Open

            case Directive::HOST;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Only one argument is allowed per line in a multi-line function call
            Open

            $host, [
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            private string $encoding = '';
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            ?TreeBuilderInterface $treeBuilder = null,
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            ) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if ($this->encoding !== static::DEFAULT_ENCODING) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            DirectiveProcessorsFactory::getDefault($this->logger),
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return $this->logger;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if ($this->reader instanceof LoggerAwareInterface) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (!isset($parsed['host']) || !$this->isValidHostName($parsed['host'])) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (!isset($parsed['port'])) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return $parsed;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            private function explodeCleanParamRule($rule) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // strip any invalid characters from path prefix
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @param int $code
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // Check each directive for rules, allowed by default
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            public function __construct(
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->treeBuilder = $treeBuilder;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->reader = is_resource($content)
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            : GeneratorBasedReader::fromString($content);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->logger
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->reader->setLogger($this->logger);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            } elseif (!isset($parsed['scheme']) || !$this->isValidScheme($parsed['scheme'])) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (!is_int($code) || $code < 100 || $code > 599) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return true;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // robots.txt file content
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->userAgentMatcher = new UserAgentMatcher();
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->reader->setEncoding($this->encoding);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // construct a tree builder if not passed
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->logger = $logger;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if ($parsed === false) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * Explode Clean-Param rule
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @return bool
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            public function setHttpStatusCode(int $code): bool {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->buildTree();
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            protected function checkRules(string $rule, string $path, string $userAgent = '*'): bool {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $userAgent = $this->userAgentMatcher->getMatching($userAgent, array_keys($this->tree));
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            private function checkHttpStatusCodeRule(): bool {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            use LogsIfAvailableTrait;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            private $userAgent = '*';
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->treeBuilder = new TreeBuilder(
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $parsed['port'] = getservbyname($parsed['scheme'], 'tcp');
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // check for disallowed http status code
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $content,
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            ?ReaderInterface $reader = null,
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            /**
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->log('UserAgentMatcher is not passed, using a default one...');
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            protected function checkRuleSwitch(string $rule, string $path): bool {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            public function setLogger(LoggerInterface $logger): void {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return true;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            private static function isValidHostName(string $host): bool {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return false;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->httpStatusCode = $code;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @param string $userAgent - which robot to check for
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            protected $rules = [];
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // robots.txt http status code
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            private $url = null;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            string $encoding = self::DEFAULT_ENCODING,
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            ?UserAgentMatcherInterface $userAgentMatcher = null
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->encoding = $encoding;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            public function getLogger(): ?LoggerInterface {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return Url::isValidScheme($scheme);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (!is_int($parsed['port'])) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $cleanParam['path'] = isset($array[1]) ? $this->encode_url(preg_replace('/[^A-Za-z0-9\.-\/\*\_]/', '', $array[1])) : '/*';
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $cleanParam['param'][] = trim($key);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return $this->checkRules(Directive::ALLOW, $url->getPath(), $userAgent);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // rule match
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            protected ?int $httpStatusCode;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->reader = $reader;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            );
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            /**
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // split into parameter and path
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            public function isAllowed(string $url, ?string $userAgent = '*'): bool {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @return void
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            /**
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return ($rule === Directive::DISALLOW);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $result = ($rule === Directive::ALLOW);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            foreach ([Directive::DISALLOW, Directive::ALLOW] as $directive) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // rules set
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            ? GeneratorBasedReader::fromStream($content)
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @return bool
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            private static function isValidScheme($scheme) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * Parse URL
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @param string $url
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            */
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return true;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @param string $path - path to check
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if ($this->checkCleanParamRule(Directive::stripInline($rule), $path)) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // url
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->userAgentMatcher = $userAgentMatcher;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (!empty($this->tree)) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return HostName::isValid($host);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // strip multi-spaces
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            foreach ($param as $key) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            /**
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * Set UserAgent
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            public function setUserAgent(string $userAgent) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @return bool
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            continue;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @return bool
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->log("Disallowed by HTTP status code {$this->httpStatusCode}");
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            case Directive::CLEAN_PARAM:
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            private ?UserAgentMatcherInterface $userAgentMatcher;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (is_null($this->reader)) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->log('Reader is not passed, using a default one...');
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (is_null($this->treeBuilder)) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @param string $scheme
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return false;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            /**
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @param string $userAgent
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @param string $rule - rule to check
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            foreach ($this->tree[$userAgent][$directive] as $robotRule) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * Check HTTP status code rule
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            switch (Directive::attemptGetInline($rule)) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if ($this->userAgentMatcher instanceof LoggerAwareInterface) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Line exceeds 120 characters; contains 135 characters
            Open

            $parsed['custom'] = (isset($parsed['path']) ? $parsed['path'] : '/') . (isset($parsed['query']) ? '?' . $parsed['query'] : '');
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            */
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // check rule
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // host set
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            private ?TreeBuilderInterface $treeBuilder;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (is_null($this->userAgentMatcher)) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * Validate URL scheme
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            */
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @return array|false
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $rule = preg_replace('/\s+/S', ' ', $rule);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return $cleanParam;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * Set the HTTP status code
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            */
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * Check rules
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            */
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return $result;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            */
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // default encoding
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            private array $tree = [];
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            /**
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return false;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            /**
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $url = new Url($url);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            protected $host = null;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            private function buildTree() {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->userAgentMatcher->setLogger($this->logger);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $parsed = parse_url($url);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return false;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            } else {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $parsed['custom'] = (isset($parsed['path']) ? $parsed['path'] : '/') . (isset($parsed['query']) ? '?' . $parsed['query'] : '');
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $array = explode(' ', $rule, 2);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $cleanParam = [];
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Line exceeds 120 characters; contains 130 characters
            Open

            $cleanParam['path'] = isset($array[1]) ? $this->encode_url(preg_replace('/[^A-Za-z0-9\.-\/\*\_]/', '', $array[1])) : '/*';
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->log('Invalid HTTP status code, not taken into account.', ['code' => $code], LogLevel::WARNING);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            !is_null($this->logger) && $url->setLogger($this->logger);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (!isset($this->tree[$userAgent][$directive])) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $result = ($rule === $directive);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            const DEFAULT_ENCODING = 'UTF-8';
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // UserAgent
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->treeBuilder->setContent($this->reader->getContentIterated());
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->tree = $this->treeBuilder->build();
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            protected function parseURL($url) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            } else {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $param = explode('&', $array[0]);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return false;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            throw new \RuntimeException(WarmingMessages::SET_UA_DEPRECATED);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if ($this->checkHttpStatusCodeRule()) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if ($this->checkRuleSwitch($robotRule, $path)) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return false;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            private $content = '';
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            private ?ReaderInterface $reader;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->log('Creating a default tree builder as none passed...');
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @param string $rule
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @return array
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            */
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @deprecated please check rules for exact user agent instead
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (isset($this->httpStatusCode) && $this->httpStatusCode >= 500 && $this->httpStatusCode <= 599) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return false;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            foreach ($cleanParam['param'] as $param) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return true;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (mb_strrpos($value, '/') == (mb_strlen($value) - 1)
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (!isset($this->url)) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $url['scheme'] . '://' . $url['host'] . ':' . $url['port'],
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->log('Rule match: ' . Directive::HOST . ' directive');
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return false;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * Check url wrapper
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->buildTree();
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->log("{$directive} directive (unofficial): Not found, fallback to " . Directive::CRAWL_DELAY . " directive");
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return 0;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            public function getCleanParam(): array {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (!isset($this->tree[Directive::CLEAN_PARAM]) || empty($this->tree[Directive::CLEAN_PARAM])) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            break;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (preg_match('@' . $escaped . '@', $path)) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return false;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $value = '^' . $value;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @param string $rule
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            private function checkHostRule($rule) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $url['host'],
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->log(Directive::CLEAN_PARAM . ' directive: Not found');
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            /**
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            });
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            foreach ($value as $subValue) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->log(sprintf("Rules not found for the given User-Agent '%s'", $userAgent));
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @note NULL is returned to public API compatibility reasons. Will be removed in the future.
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (!is_null($userAgent)) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            */
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (!strpos($path, "?$param=")
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->log('Rule match: ' . Directive::CLEAN_PARAM . ' directive');
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            */
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            krsort($input);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            } else {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $output[] = '';
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->log(sprintf("No direct match found for '%s', fallback to *", $userAgent));
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @return string[]|string|null
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            public function getSitemaps(?string $userAgent = null): array {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return $this->checkBasicRule($rule, $path);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @return bool
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (in_array(
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            */
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return $this->tree[$userAgent];
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            public function getHost(?string $userAgent = null) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->buildTree();
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (!$this->checkBasicRule($cleanParam['path'], $path)) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * Check basic rule
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            */
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $escaped = strtr($this->prepareRegexRule($rule), ['@' => '\@']);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            /**
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @param string|null $userAgent - which robot to check for
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @return array
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @deprecated
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @return string
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // return all rules
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @param ?string $userAgent
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            } else {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            foreach ($this->tree as $userAgentBased) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * Check Clean-Param rule
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // change @ to \@
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            )) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            public function getDelay(string $userAgent = "*", string $type = Directive::CRAWL_DELAY) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (isset($this->tree[$userAgent][Directive::CRAWL_DELAY])) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $directive = ucfirst($directive);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (is_array($value)) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return [];
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $userAgent = $this->userAgentMatcher->getMatching($userAgent, array_keys($this->tree));
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Line exceeds 120 characters; contains 124 characters
            Open

            if (isset($this->tree[$userAgent][Directive::SITEMAP]) && !empty($this->tree[$userAgent][Directive::SITEMAP])) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            case Directive::HOST;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (substr($value, 0, 2) != '.*') {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $url = $this->parseURL($this->url);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @return bool
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $url = new Url($url);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return [];
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * Render
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $output = [];
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // Not multibyte
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // Shorter paths later
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return $this->tree['*'];
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return null;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $maps = array_merge($maps, $userAgentBased[Directive::SITEMAP]);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return true;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->log($error_msg, [], LogLevel::ERROR);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            ? Directive::CACHE_DELAY
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            : Directive::CRAWL_DELAY;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->buildTree();
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return $this->tree[Directive::CLEAN_PARAM];
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @param string $eol
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            foreach ($rules as $directive => $value) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            /**
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return $maps;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            private function checkCleanParamRule($rule, $path) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            protected function prepareRegexRule(string $value): string {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (mb_strlen($value) > 2 && mb_substr($value, -2) == '\$') {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $value .= '.*';
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            */
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $url['host'] . ':' . $url['port'],
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->buildTree();
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return $this->tree[$userAgent][$directive];
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return $this->tree[$userAgent][Directive::CRAWL_DELAY];
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            */
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $output[] = $directive . ': ' . $value;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $output[] = '';
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->buildTree();
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (isset($this->tree['*'])) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (isset($this->tree[$userAgent][Directive::HOST]) && !empty($this->tree[$userAgent][Directive::HOST])) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            private function checkBasicRule(string $rule, string $path): bool {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            ) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Line exceeds 120 characters; contains 127 characters
            Open

            $this->log("{$directive} directive (unofficial): Not found, fallback to " . Directive::CRAWL_DELAY . " directive");
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $output[] = $directive . ': ' . $subValue;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // direct match
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (!is_null($userAgent)) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @param string $path
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $escape = ['$' => '\$', '?' => '\?', '.' => '\.', '*' => '.*', '[' => '\[', ']' => '\]'];
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $url['scheme'] . '://' . $url['host'],
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return $this->checkRules(Directive::DISALLOW, $url->getPath(), $userAgent);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            /**
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            foreach ($sitemaps as $sitemap) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            public function getRules(?string $userAgent = null) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (isset($this->tree[$userAgent])) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            foreach ($this->tree as $userAgentBased) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return !empty($hosts) ? $hosts : null;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return true;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            break;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            default:
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $cleanParam = $this->explodeCleanParamRule($rule);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            || mb_strrpos($value, '=') == (mb_strlen($value) - 1)
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return $value;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return false;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            ]
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            !is_null($this->logger) && $url->setLogger($this->logger);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $directive = in_array($type, [Directive::CACHE, Directive::CACHE_DELAY])
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            public function getLog(): array {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            */
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $maps = [];
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @param string $rule
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // check if path prefix matches the path of the url we're checking
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @return bool
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $error_msg = WarmingMessages::INLINED_HOST;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $host, [
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @deprecated
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            foreach ($input as $userAgent => $rules) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $host = $this->getHost();
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $output[] = 'Sitemap: ' . $sitemap;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return $this->tree;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->buildTree();
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $userAgent = $this->userAgentMatcher->getMatching($userAgent, array_keys($this->tree));
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if ($this->checkHostRule(Directive::stripInline($rule))) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            && !strpos($path, "&$param=")
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            ) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->log('Rule match: Path');
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $value = substr($value, 0, -2) . '$';
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            || mb_strrpos($value, '?') == (mb_strlen($value) - 1)
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            /**
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * Check Host rule
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $host = trim(str_ireplace(Directive::HOST . ':', '', mb_strtolower($rule)));
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @param string $url - url to check
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (isset($this->tree[$userAgent][$directive])) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return $this->reader->getContentRaw();
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            usort($value, function ($a, $b) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if ($userAgent === null) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (isset($userAgentBased[Directive::SITEMAP]) && !empty($userAgentBased[Directive::SITEMAP])) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            /**
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return false;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            /**
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // match result
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return true;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            public function isDisallowed(string $url, string $userAgent = '*'): bool {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // return delay for requested directive
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $this->log("$directive directive: Not found");
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            public function getContent(): string {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            * @see RobotsTxtParser::getLogger()
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $output[] = 'User-agent: ' . $userAgent;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return mb_strlen($a) < mb_strlen($b);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            // fallback for *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return $this->tree[$userAgent][Directive::HOST];
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (isset($userAgentBased[Directive::HOST]) && !empty($userAgentBased[Directive::HOST])) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if (isset($this->tree[$userAgent][Directive::SITEMAP]) && !empty($this->tree[$userAgent][Directive::SITEMAP])) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $value = str_replace(array_keys($escape), array_values($escape), $value);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            /**
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            *
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $input = $this->getRules();
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $output[] = 'Host: ' . $host;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $sitemaps = $this->getSitemaps();
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return implode($eol, $output);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $userAgent = $this->userAgentMatcher->getMatching($userAgent, array_keys($this->tree));
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            */
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            $hosts = [];
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            array_push($hosts, $userAgentBased[Directive::HOST]);
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            public function render($eol = "\r\n") {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            if ($host !== null) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            }
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Spaces must be used to indent lines; tabs are not allowed
            Open

            return $this->tree[$userAgent][Directive::SITEMAP];
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            public function isAllowed(string $url, ?string $userAgent = '*'): bool {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            public function setLogger(LoggerInterface $logger): void {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            public function setHttpStatusCode(int $code): bool {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            private function checkHttpStatusCodeRule(): bool {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            protected function checkRules(string $rule, string $path, string $userAgent = '*'): bool {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            private function buildTree() {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            protected function parseURL($url) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            public function setUserAgent(string $userAgent) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            public function getLogger(): ?LoggerInterface {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            private static function isValidHostName(string $host): bool {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            private function explodeCleanParamRule($rule) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            protected function checkRuleSwitch(string $rule, string $path): bool {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            private static function isValidScheme($scheme) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            public function getCleanParam(): array {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            private function checkHostRule($rule) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            public function getHost(?string $userAgent = null) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            public function getSitemaps(?string $userAgent = null): array {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            private function checkBasicRule(string $rule, string $path): bool {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            public function getDelay(string $userAgent = "*", string $type = Directive::CRAWL_DELAY) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            public function render($eol = "\r\n") {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            private function checkCleanParamRule($rule, $path) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            protected function prepareRegexRule(string $value): string {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            public function getLog(): array {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            public function getRules(?string $userAgent = null) {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            public function getContent(): string {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            Opening brace should be on a new line
            Open

            public function isDisallowed(string $url, string $userAgent = '*'): bool {
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpcodesniffer

            The variable $error_msg is not named in camelCase.
            Open

            private function checkHostRule($rule) {
            if (!isset($this->url)) {
            $error_msg = WarmingMessages::INLINED_HOST;
            $this->log($error_msg, [], LogLevel::ERROR);
            return false;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd

            The variable $error_msg is not named in camelCase.
            Open

            private function checkHostRule($rule) {
            if (!isset($this->url)) {
            $error_msg = WarmingMessages::INLINED_HOST;
            $this->log($error_msg, [], LogLevel::ERROR);
            return false;
            Severity: Minor
            Found in source/RobotsTxtParser.php by phpmd
            Category
            Status