t1gor/Robots.txt-Parser-Class

View on GitHub

Showing 1,364 of 1,364 total issues

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

interface UserAgentMatcherInterface extends LoggerAwareInterface {

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

trait LogsIfAvailableTrait {

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

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

abstract class DirectiveProcessorsFactory {

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

abstract class AbstractDirectiveProcessor implements DirectiveProcessorInterface {

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 SitemapProcessor extends AbstractDirectiveProcessor implements DirectiveProcessorInterface {

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

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

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

interface DirectiveProcessorInterface {

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

class UserAgentProcessor extends AbstractDirectiveProcessor implements DirectiveProcessorInterface {

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

abstract class AbstractAllowanceProcessor extends AbstractDirectiveProcessor implements DirectiveProcessorInterface {

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

class DisallowProcessor extends AbstractAllowanceProcessor 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

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function 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

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

class SkipCommentedLinesFilter extends \php_user_filter implements CustomFilterInterface {

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

class SkipEndOfCommentedLineFilter extends \php_user_filter implements CustomFilterInterface {

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

class GeneratorBasedReader implements ReaderInterface {

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 TrimSpacesLeftFilter extends \php_user_filter implements CustomFilterInterface {

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

interface CustomFilterInterface {
Severity
Category
Status
Source
Language