t1gor/Robots.txt-Parser-Class

View on GitHub
source/Directive.php

Summary

Maintainability
A
0 mins
Test Coverage

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

        return "/^(?!(" . implode('|', Directive::getAll()) . ")\s*:+).+/mui";
Severity: Minor
Found in source/Directive.php by phpmd

StaticAccess

Since: 1.4.0

Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

Example

class Foo
{
    public function bar()
    {
        Bar::baz();
    }
}

Source https://phpmd.org/rules/cleancode.html#staticaccess

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

abstract class Directive {
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

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

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

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

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

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

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

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

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

     * @link https://yandex.com/support/webmaster/robot-workings/user-agent.html#user-agent
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

    const CACHE = 'cache';
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

    const DISALLOW = 'disallow';
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

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

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

     * @link https://yandex.com/support/webmaster/robot-workings/crawl-delay.html#crawl-delay
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

     * @link http://www.conman.org/people/spc/robots2.html
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

            $rule = trim(str_ireplace($directive . ':', '', $rule));
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

    const USERAGENT = 'user-agent';
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

    const CLEAN_PARAM = 'clean-param';
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

    public static function getRequestRateRegex(): string {
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

    public static function getAllowDisallowRegex(): string {
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

    const SITEMAP = 'sitemap';
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

    const REQUEST_RATE = 'request-rate';
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

            self::DISALLOW,
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

            self::HOST,
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

        if ($directive !== false) {
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

            self::USERAGENT,
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

            self::CACHE_DELAY,
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

     * @link https://yandex.com/support/webmaster/robot-workings/clean-param.html#clean-param
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

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

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

    public static function stripInline(string $rule): string {
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

    const ALLOW = 'allow';
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

    const CRAWL_DELAY = 'crawl-delay';
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

            self::CRAWL_DELAY,
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

    public static function getCrawlDelayRegex(): string {
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

     * @link https://yandex.com/support/webmaster/robot-workings/sitemap.html#sitemap
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

    public static function getAll(): array {
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

            self::REQUEST_RATE,
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

    public static function getRegex(): string {
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

     * @TODO finish me
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

    public static function attemptGetInline(string $rule) {
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

    const VISIT_TIME = 'visit-time';
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

        return [
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

            self::ALLOW,
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

            if (0 === strpos(mb_strtolower($rule), $directive . ':')) {
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

                return $directive;
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

     * @link https://yandex.com/support/webmaster/robot-workings/allow-disallow.html#allow-disallow
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

    const CACHE_DELAY = 'cache-delay';
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

            self::SITEMAP,
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

            self::CLEAN_PARAM,
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

            self::VISIT_TIME,
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

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

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

        foreach (static::getAll() as $directive) {
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

        return $rule;
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

     * Extended standard directives
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

        return "/^" . self::REQUEST_RATE . ":+\s*(?![0-9]+\/[0-9]+).*/mui";
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

        return "/^" . self::CRAWL_DELAY . ":+\s*(\D+)$/mui";
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

        return "/^(" . self::ALLOW . "|" . self::DISALLOW . "):+\s*\\{1}.*$/mui";
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

    const HOST = 'host';
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

        return "/^(?!(" . implode('|', Directive::getAll()) . ")\s*:+).+/mui";
Severity: Minor
Found in source/Directive.php by phpcodesniffer

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

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

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

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

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

        $directive = static::attemptGetInline($rule);
Severity: Minor
Found in source/Directive.php by phpcodesniffer

Opening brace should be on a new line
Open

    public static function stripInline(string $rule): string {
Severity: Minor
Found in source/Directive.php by phpcodesniffer

Opening brace should be on a new line
Open

    public static function attemptGetInline(string $rule) {
Severity: Minor
Found in source/Directive.php by phpcodesniffer

Opening brace should be on a new line
Open

    public static function getAll(): array {
Severity: Minor
Found in source/Directive.php by phpcodesniffer

Opening brace should be on a new line
Open

    public static function getRegex(): string {
Severity: Minor
Found in source/Directive.php by phpcodesniffer

Opening brace should be on a new line
Open

    public static function getCrawlDelayRegex(): string {
Severity: Minor
Found in source/Directive.php by phpcodesniffer

Opening brace should be on a new line
Open

    public static function getRequestRateRegex(): string {
Severity: Minor
Found in source/Directive.php by phpcodesniffer

Opening brace should be on a new line
Open

    public static function getAllowDisallowRegex(): string {
Severity: Minor
Found in source/Directive.php by phpcodesniffer

There are no issues that match your filters.

Category
Status