Function generateTrie
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
private function generateTrie(&$validSymbols){
if (is_string($validSymbols)){
$validSymbols = array($validSymbols);
}
- 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 __construct
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
public function __construct(
$defaultInternalOrExternalSymbols = null,
$defaultLength = null,
$useExternalSymbolsArray = true,
$prng = null
- 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 generateTrie
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generateTrie(&$validSymbols){
if (is_string($validSymbols)){
$validSymbols = array($validSymbols);
}
Method __construct
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(
$defaultInternalOrExternalSymbols = null,
$defaultLength = null,
$useExternalSymbolsArray = true,
$prng = null
Method generateWord
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function generateWord($symbols = null, $length = null, $separator = ' '){
if ($symbols===null){
$symbols = $this->defaultSymbols;
}
Function validateWord
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function validateWord($word, $symbols = null){
if ($this->defaultTrie === null){
$this->defaultTrie = $this->generateTrie($this->defaultSymbols);
}
- 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 generateWord
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function generateWord($symbols = null, $length = null, $separator = ' '){
if ($symbols===null){
$symbols = $this->defaultSymbols;
}
- 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 isValidWord
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function isValidWord($word,&$trie){
$nodes = array($word);
while (count($nodes)>0){
$node = array_shift($nodes);
if ($this->inTrie($node,$trie)) { return true; }
- 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"