t1gor/Robots.txt-Parser-Class

View on GitHub
source/Parser/DirectiveProcessors/UserAgentProcessor.php

Summary

Maintainability
A
0 mins
Test Coverage

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

class UserAgentProcessor extends AbstractDirectiveProcessor implements DirectiveProcessorInterface {

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

            $this->log('New useragent is equal to current one, skipping ...');

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

            $prevParts = explode(':', $prevLine);

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

    }

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

            $root[$newUserAgent] = [];

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

        return Directive::USERAGENT;

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

        if ($newUserAgent === $currentUserAgent) {

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

        }

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

            $pervLineUserAgent = trim($prevParts[1]);

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

        $parts = explode(':', $line);

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

        if ($this->matches($prevLine)) {

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

    public function getDirectiveName(): string {

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

        if (empty($root) && $newUserAgent === '*') {

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

        $currentUserAgent = trim($parts[1]);

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

            $root[$pervLineUserAgent] = & $root[$currentUserAgent];

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

        if (!isset($root[$currentUserAgent])) {

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

            return;

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

        }

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

        // if one user-agent is followed by another one - just link them

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

        }

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

            $root[$currentUserAgent] = [];

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

    }

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

    public function process(string $line, array & $root, string & $currentUserAgent = '*', string $prevLine = '') {

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

        $newUserAgent = trim($parts[1]);

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

        }

Opening brace should be on a new line
Open

    public function process(string $line, array & $root, string & $currentUserAgent = '*', string $prevLine = '') {

Opening brace should be on a new line
Open

    public function getDirectiveName(): string {

There are no issues that match your filters.

Category
Status