t1gor/Robots.txt-Parser-Class

View on GitHub
source/Parser/UserAgent/UserAgentMatcher.php

Summary

Maintainability
A
0 mins
Test Coverage

Showing 20 of 20 total issues

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

class UserAgentMatcher implements UserAgentMatcherInterface {

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

return $userAgentMatch;

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

use LogsIfAvailableTrait;

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

return $userAgent;

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

}

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

$this->log("Matched {$userAgentMatch} for user agent {$userAgent}");

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

$this->log("Failed to match user agent '{$userAgent}', falling back to '*'");

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

if ($userAgent === '*') {

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 __construct(?LoggerInterface $logger = null) {

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

$this->logger = $logger;

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

public function getMatching(string $userAgent, array $available = []): string {

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 (false !== $userAgentMatch) {

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

$uaParser = new UserAgentParser($userAgent);

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

$userAgentMatch = $uaParser->getMostSpecific($available);

Opening brace should be on a new line
Open

public function __construct(?LoggerInterface $logger = null) {

Opening brace should be on a new line
Open

public function getMatching(string $userAgent, array $available = []): string {
Category
Status