Function set_hash_method
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
function set_hash_method($hash_method = null){
if ($hash_method === null){
if (function_exists('password_hash') && !$this->full_compat){
$this->hash_method = 'password_hash';
} else if (CRYPT_BLOWFISH){
- 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
File PasswordHash.php
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
<?php
/**
* Portable PHP password hashing framework.
*
* Version 0.3 / SynappV2 (by elcodedocle, 2014).
Function HashPassword
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function HashPassword($password, $hash_method = null)
{
if ($hash_method === null){
$hash_method = $this->hash_method;
} else if (!$this->is_valid_hash_method($hash_method)){
- 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 crypt_private
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function crypt_private($password, $setting)
{
$output = '*0';
if (substr($setting, 0, 2) == $output)
$output = '*1';
Function gensalt_private
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function gensalt_private($input, $hash_method = null)
{
if ($hash_method === null){
$hash_method = $this->hash_method;
}
- 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 crypt_private
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function crypt_private($password, $setting)
{
$output = '*0';
if (substr($setting, 0, 2) == $output)
$output = '*1';
- 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 is_valid_hash_method
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function is_valid_hash_method($hash_method, $portable_hashes = false){
switch ($hash_method){
case 'password_hash':
if (function_exists('password_hash') && !$portable_hashes){
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
Method HashPassword
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function HashPassword($password, $hash_method = null)
{
if ($hash_method === null){
$hash_method = $this->hash_method;
} else if (!$this->is_valid_hash_method($hash_method)){
Method is_valid_hash_method
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function is_valid_hash_method($hash_method, $portable_hashes = false){
switch ($hash_method){
case 'password_hash':
if (function_exists('password_hash') && !$portable_hashes){
return true;
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
} else { return false; }
Avoid too many return
statements within this method. Open
return $hash;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
} else { return '*'; } // This is bad, and Solar Designer should feel bad.
Avoid too many return
statements within this method. Open
} else { return false; }
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
} else { return false; }
Avoid too many return
statements within this method. Open
return $output;
Function encode64
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function encode64($input, $count)
{
$output = '';
$i = 0;
do {
- 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"