Function generateKeypair
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
final public function generateKeypair($keybits = 512, $digest_alg = 'sha512')
{
try {
/* see: http://www.php.net/manual/en/function.openssl-pkey-new.php */
if (function_exists('openssl_pkey_new')) {
- 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 generateKeypair
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
final public function generateKeypair($keybits = 512, $digest_alg = 'sha512')
{
try {
/* see: http://www.php.net/manual/en/function.openssl-pkey-new.php */
if (function_exists('openssl_pkey_new')) {
Function encrypt
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function encrypt($text, $key = '', $iv = '', $bit_check = 8, $cipher_type = 'AES-256-CBC')
{
try {
if (function_exists('openssl_pkey_new')) {
/* Ensure the key & IV is the same for both encrypt & decrypt. */
- 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 decrypt
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
public function decrypt($encrypted_text, $key = '', $iv = '', $bit_check = 8, $cipher_type = 'AES-256-CBC')
{
try {
/* Ensure the key & IV is the same for both encrypt & decrypt. */
if (!empty($encrypted_text)) {
- 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 encrypt
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function encrypt($text, $key = '', $iv = '', $bit_check = 8, $cipher_type = 'AES-256-CBC')
Method decrypt
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public function decrypt($encrypted_text, $key = '', $iv = '', $bit_check = 8, $cipher_type = 'AES-256-CBC')
Avoid too many return
statements within this method. Open
return false;