Showing 6 of 6 total issues
File Page.php
has 269 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
namespace SeoAnalyzer;
use SeoAnalyzer\HttpClient\Client;
Function getOverusedKeywords
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
protected function getOverusedKeywords(array $keywords, int $maxPercentage = 10, int $maxPhraseWords = 4): array
{
$overusedWords = [];
for ($i = 1; $i <= $maxPhraseWords; $i++) {
if (!empty($keywords[$i])) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method setUpContentKeywordFactors
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function setUpContentKeywordFactors(string $keyword)
{
$this->setFactors([
Factor::KEYWORD_URL => [
self::TEXT => $this->getFactor(Factor::URL_PARSED_HOST),
Function getKeywords
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
protected function getKeywords(array $words, int $maxPhraseWords): array
{
$count = count($words);
$keywords = [];
for ($i = 0; $i < $count; $i++) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function analyzeWithKeyword
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected function analyzeWithKeyword(array $keywords, array $overusedWords): string
{
$this->name = 'KeywordDensityKeyword';
unset($this->value);
$this->value[Factor::KEYWORDS] = $keywords;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function setUpMetrics
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function setUpMetrics(array $config = [])
{
$metrics = [];
foreach ($config as $factor) {
$metric = $factor;
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"