t1gor/Robots.txt-Parser-Class

View on GitHub

Showing 1,364 of 1,364 total issues

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

public function filter($in, $out, &$consumed, $closing) {

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

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

public function filter($in, $out, &$consumed, $closing);

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

public function __construct(string $in) {
Severity: Minor
Found in source/Parser/Url.php by phpmd

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

public function filter($in, $out, &$consumed, $closing) {

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

public function filter($in, $out, &$consumed, $closing) {

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

protected function parse(string $url) {
$parsed = parse_url($url);
 
if ($parsed === false) {
$this->log("Failed to parse URL from {$url}");
Severity: Minor
Found in source/Parser/Url.php - About 45 mins to fix

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

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

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

    protected function processDirective(string $directive, string $line, &$tree, string &$userAgent, string $prevLine = '') {
    Severity: Minor
    Found in source/Parser/TreeBuilder.php - About 35 mins to fix

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

      class DisallowProcessor extends AbstractAllowanceProcessor implements DirectiveProcessorInterface {

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

      class SitemapProcessor extends AbstractDirectiveProcessor implements DirectiveProcessorInterface {

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

      public function build(): array {
      $currentUserAgent = '*';
      $tree = [];
      $prevLine = '';
       
       
      Severity: Minor
      Found in source/Parser/TreeBuilder.php - About 35 mins to fix

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

      class CleanParamProcessor extends AbstractDirectiveProcessor implements DirectiveProcessorInterface {

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

      abstract class AbstractDirectiveProcessor implements DirectiveProcessorInterface {

      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

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

      class AllowProcessor extends AbstractAllowanceProcessor implements DirectiveProcessorInterface {

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

      class HostProcessor extends AbstractDirectiveProcessor implements DirectiveProcessorInterface {

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

      class TreeBuilder implements TreeBuilderInterface {

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

      trait LogsIfAvailableTrait {
      Severity
      Category
      Status
      Source
      Language