mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-11 22:38:42 +00:00
cs fixes
This commit is contained in:
parent
b1ded69873
commit
308261b2be
|
|
@ -241,12 +241,12 @@ final class MbStringUtils
|
||||||
*/
|
*/
|
||||||
public static function mb_entropy(string $value) : float
|
public static function mb_entropy(string $value) : float
|
||||||
{
|
{
|
||||||
$entropy = 0.0;
|
$entropy = 0.0;
|
||||||
$size = \mb_strlen($value);
|
$size = \mb_strlen($value);
|
||||||
$countChars = self::mb_count_chars($value);
|
$countChars = self::mb_count_chars($value);
|
||||||
|
|
||||||
foreach ($countChars as $v) {
|
foreach ($countChars as $v) {
|
||||||
$p = $v / $size;
|
$p = $v / $size;
|
||||||
$entropy -= $p * \log($p) / \log(2);
|
$entropy -= $p * \log($p) / \log(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -173,12 +173,12 @@ final class StringUtils
|
||||||
*/
|
*/
|
||||||
public static function entropy(string $value) : float
|
public static function entropy(string $value) : float
|
||||||
{
|
{
|
||||||
$entropy = 0.0;
|
$entropy = 0.0;
|
||||||
$size = \strlen($value);
|
$size = \strlen($value);
|
||||||
$countChars = \count_chars($value, 1);
|
$countChars = \count_chars($value, 1);
|
||||||
|
|
||||||
foreach ($countChars as $v) {
|
foreach ($countChars as $v) {
|
||||||
$p = $v / $size;
|
$p = $v / $size;
|
||||||
$entropy -= $p * \log($p) / \log(2);
|
$entropy -= $p * \log($p) / \log(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user