Function __construct
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
public function __construct($input = null, $minWordSize = null, $format = null, $params = array(), $prng = null){
$this->defaultFilename = realpath(dirname(__FILE__)).'/top10000.txt';
if ($minWordSize===null) { $minWordSize = $this->defaultMinWordSize; } else { $this->defaultMinWordSize = $minWordSize; }
- 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 getRandomWordsArray
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
public function getRandomWordsArray($count = null, $unique = null){
if ($unique === null) { $unique = $this->defaultUnique; }
// be aware unique = true invalidates
// countWordsOn(password) * log2(countWordsOn(Dictionary))
// as a valid measure of the entropy in bits!
- 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 readWordsFromFile
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function readWordsFromFile($filename = null, $splitPattern = null, $add = null, $minWordSize = null){
if ($filename === null) { $filename = $this->defaultFilename; }
if ($splitPattern === null) { $splitPattern = $this->defaultSplitPattern; }
if ($add === null) { $add = $this->defaultAdd; }
if ($minWordSize === null) { $minWordSize = $this->defaultMinWordSize; }
- 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 readWords
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
public function readWords($input = null, $format = null, $params = array(), $minWordSize = null){
if ($format === null) { $format = $this->defaultFormat; }
if (!is_array($params)) { throw new Exception ('$params must be array'); }
if (isset($params['add'])){
- 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 readWordsFromFile
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function readWordsFromFile($filename = null, $splitPattern = null, $add = null, $minWordSize = null){
if ($filename === null) { $filename = $this->defaultFilename; }
if ($splitPattern === null) { $splitPattern = $this->defaultSplitPattern; }
if ($add === null) { $add = $this->defaultAdd; }
if ($minWordSize === null) { $minWordSize = $this->defaultMinWordSize; }
Method __construct
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function __construct($input = null, $minWordSize = null, $format = null, $params = array(), $prng = null){
$this->defaultFilename = realpath(dirname(__FILE__)).'/top10000.txt';
if ($minWordSize===null) { $minWordSize = $this->defaultMinWordSize; } else { $this->defaultMinWordSize = $minWordSize; }
Function readWordsFromPDO
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
public function readWordsFromPDO($dbh = null, $table = null, $column = null, $add = null, $minWordSize = null){
if ($dbh === null) { $dbh = $this->defaultDbh; }
if ($table === null) { $table = $this->defaultTable; }
if ($column === null) { $column = $this->defaultColumn; }
if ($add === null) { $add = $this->defaultAdd; }
- 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 readWords
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function readWords($input = null, $format = null, $params = array(), $minWordSize = null){
if ($format === null) { $format = $this->defaultFormat; }
if (!is_array($params)) { throw new Exception ('$params must be array'); }
if (isset($params['add'])){
Function readWordsFromArray
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public function readWordsFromArray($newWords, $add = null, $minWordSize = null){
if ($add === null) { $add = $this->defaultAdd; }
if ($minWordSize === null) { $minWordSize = $this->defaultMinWordSize; }
if (
!is_bool($add)
- 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 readWordsFromPDO
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function readWordsFromPDO($dbh = null, $table = null, $column = null, $add = null, $minWordSize = null){
if ($dbh === null) { $dbh = $this->defaultDbh; }
if ($table === null) { $table = $this->defaultTable; }
if ($column === null) { $column = $this->defaultColumn; }
if ($add === null) { $add = $this->defaultAdd; }
Method __construct
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function __construct($input = null, $minWordSize = null, $format = null, $params = array(), $prng = null){
Method readWordsFromPDO
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function readWordsFromPDO($dbh = null, $table = null, $column = null, $add = null, $minWordSize = null){
Function countWords
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
public function countWords($words = null, $minWordSize = null, $minReadWordsWordSize = null){
if ($words === null) { $words = $this->words; }
if ($minWordSize === null) { $minWordSize = $this->minWordSize; }
if ($minReadWordsWordSize === null) { $minReadWordsWordSize = $this->minReadWordsWordSize; }
if (!array($words)) { throw new Exception('$words must be an array'); }
- 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"