Showing 21 of 21 total issues
File top10000.php
has 10003 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
$validSymbols = array(
'the',
'of',
'and',
Method createImage
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function createImage($word, $width = null, $height = null){
if (!is_int($width)){
$width = $this->defaultWidth;
}
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
Function validate
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
'validate' : function(opts){
var XHR = new XMLHttpRequest(),
responseJSON,
parameters,
Method generateTrie
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
private function generateTrie(&$validSymbols){
if (is_string($validSymbols)){
$validSymbols = array($validSymbols);
}
Function validate
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
public function validate($uuid, $word, $ip = null){
if ($ip === null){
$ip = $this->ip;
}
if ($ip === false){
- 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 __construct
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($sessionId, $dbh = null, $dBParams = null, $tableName = 'captchalot'){
if (!isset($sessionId)||!is_string($sessionId)||strlen($sessionId)<1){
throw new Exception(
'Invalid session id.',
Function createImage
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public function createImage($word, $width = null, $height = null){
if (!is_int($width)){
$width = $this->defaultWidth;
}
- 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 __construct
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct(
$defaultInternalOrExternalSymbols = null,
$defaultLength = null,
$useExternalSymbolsArray = true,
$prng = null
Method validate
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function validate($uuid, $word, $ip = null){
if ($ip === null){
$ip = $this->ip;
}
if ($ip === false){
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"
Further reading
Function __construct
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($sessionId, $dbh = null, $dBParams = null, $tableName = 'captchalot'){
if (!isset($sessionId)||!is_string($sessionId)||strlen($sessionId)<1){
throw new Exception(
'Invalid session id.',
- 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 __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($session, $ip = null, $uuidGenerator = null, $wordGenerator = null, $imageGenerator = null){
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($dBHost, $dBPort, $dBUser, $dBPassword, $dBName){
Avoid too many return
statements within this method. Open
return false;
Function echoImage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function echoImage(){
$uuid = $this->uuidGenerator->v4();
$word = $this->wordGenerator->generateWord();
$image = $this->imageGenerator->createImage($word);
- 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"