source/Parser/DirectiveProcessors/CrawlDelayProcessor.php
Avoid unused parameters such as '$prevLine'. Open
Open
public function process(string $line, array & $root, string & $currentUserAgent = '*', string $prevLine = '') {
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Opening brace of a class must be on the line after the definition Open
Open
class CrawlDelayProcessor extends AbstractDirectiveProcessor implements DirectiveProcessorInterface {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$entry = trim($parts[1]);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
if (false === $filteredCrawlDelay) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$this->log(strtr('{directive} with value {faulty} dropped as invalid for {useragent}', [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$parts = explode(':', $line);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'{faulty}' => $entry,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function process(string $line, array & $root, string & $currentUserAgent = '*', string $prevLine = '') {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'{useragent}' => $currentUserAgent
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
public function getDirectiveName(): string {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
return Directive::CRAWL_DELAY;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
'{directive}' => Directive::CRAWL_DELAY,
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
]));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$filteredCrawlDelay = filter_var($entry, FILTER_VALIDATE_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
Open
$root[$currentUserAgent][Directive::CRAWL_DELAY] = $filteredCrawlDelay;
- Exclude checks
Opening brace should be on a new line Open
Open
public function getDirectiveName(): string {
- Exclude checks
Opening brace should be on a new line Open
Open
public function process(string $line, array & $root, string & $currentUserAgent = '*', string $prevLine = '') {
- Exclude checks