t1gor/Robots.txt-Parser-Class

View on GitHub

Showing 1,364 of 1,364 total issues

Opening brace should be on a new line
Open

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

Opening brace should be on a new line
Open

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

Opening brace should be on a new line
Open

    protected function __construct() {

Opening brace should be on a new line
Open

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

Opening brace should be on a new line
Open

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

Opening brace should be on a new line
Open

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

Opening brace should be on a new line
Open

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

Opening brace should be on a new line
Open

    public function getContentIterated(): \Generator {

Opening brace should be on a new line
Open

    public function getContentRaw(): string {

Opening brace should be on a new line
Open

    public static function fromStream($stream): self {

Opening brace should be on a new line
Open

    public static function fromString(string $input = ''): self {

Opening brace should be on a new line
Open

    public function __destruct() {

Opening brace should be on a new line
Open

    public function setEncoding(string $encoding) {

Opening brace should be on a new line
Open

    protected function setStream($stream): GeneratorBasedReader {

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

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

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

CamelCaseVariableName

Since: 0.2

It is considered best practice to use the camelCase notation to name variables.

Example

class ClassName {
    public function doSomething() {
        $data_module = new DataModule();
    }
}

Source

Define a constant instead of duplicating this literal "logger" 3 times.
Open

                && isset($this->params['logger'])

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "logger" 3 times.
Open

                && isset($this->params['logger'])

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "{useragent}" 3 times.
Open

                '{useragent}' => $currentUserAgent,

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Define a constant instead of duplicating this literal "logger" 5 times.
Open

            if (isset($this->params['logger']) && $this->params['logger'] instanceof LoggerInterface) {

Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

Noncompliant Code Example

With the default threshold of 3:

function run() {
  prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
  execute('action1');
  release('action1');
}

Compliant Solution

ACTION_1 = 'action1';

function run() {
  prepare(ACTION_1);
  execute(ACTION_1);
  release(ACTION_1);
}

Exceptions

To prevent generating some false-positives, literals having less than 5 characters are excluded.

Severity
Category
Status
Source
Language