for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Codecraft63\CertsignLogin;
class Decryptor
{
use Util;
/**
* Decrypt text using certsign login private key.
*
* @param string $input
* @param string $key
* @throws \Exception
* @return string
*/
public static function decrypt(string $input, string $key): string
list($cipher, $iv_size, $key_size) = self::getCipher();
$key_size
list($first,,$third)
This checks looks for assignemnts to variables using the list(...) function, where not all assigned variables are subsequently used.
list(...)
Consider the following code example.
<?php function returnThreeValues() { return array('a', 'b', 'c'); } list($a, $b, $c) = returnThreeValues(); print $a . " - " . $c;
Only the variables $a and $c are used. There was no need to assign $b.
$a
$c
$b
Instead, the list call could have been.
list($a,, $c) = returnThreeValues();
$iv = substr($key, 0, $iv_size);
$key = substr($key, 0, $iv_size);
mcrypt_generic_init($cipher, $key, $iv);
$data = base64_decode(str_replace("certplus", "\\+", $input));
$data = mdecrypt_generic($cipher, $data);
self::finalizeCipher($cipher);
return trim($data);
}
This checks looks for assignemnts to variables using the
list(...)function, where not all assigned variables are subsequently used.Consider the following code example.
Only the variables
$aand$care used. There was no need to assign$b.Instead, the list call could have been.