Skip to content

Commit a9a5fc4

Browse files
committed
Sync.
1 parent 31554ad commit a9a5fc4

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/Demojibakefier.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Demojibakefier (last modified: 2026.03.18).
3+
* Demojibakefier (last modified: 2026.03.20).
44
*
55
* Intended to normalise the character encoding of a given string to a
66
* preferred character encoding when the given string's byte sequences don't
@@ -329,7 +329,7 @@ public function shannonEntropy(string $String)
329329
}
330330
$Total = 0;
331331
foreach ($Chars as $Char) {
332-
$Total += abs(($Char / $Len) * log(($Char / $Len), 2));
332+
$Total += \abs(($Char / $Len) * \log(($Char / $Len), 2));
333333
}
334334
return $Total;
335335
}
@@ -363,11 +363,11 @@ public function normalise(string $String): string
363363
if (!$this->checkConformity($String, $Encoding)) {
364364
continue;
365365
}
366-
$Attempt = iconv($Encoding, $this->NormaliseTo, $String);
366+
$Attempt = \iconv($Encoding, $this->NormaliseTo, $String);
367367
if ($Attempt === false || !$this->checkConformity($Attempt, $this->NormaliseTo)) {
368368
continue;
369369
}
370-
if (\strcmp(iconv($this->NormaliseTo, $Encoding, $Attempt), $String) === 0) {
370+
if (\strcmp(\iconv($this->NormaliseTo, $Encoding, $Attempt), $String) === 0) {
371371
$Valid[$Encoding] = $Attempt;
372372
if ($Encoding === $this->NormaliseTo) {
373373
break;
@@ -563,7 +563,7 @@ private function weigh(string $String, array &$Arr): void
563563
}
564564

565565
$RateAZ = \preg_match_all('~[\x41-\x5A\x61-\x7A]~', $String) / $this->Len;
566-
$EntrAZ = \round(abs($RateAZ * log($RateAZ, 2)), 2);
566+
$EntrAZ = \round(\abs($RateAZ * \log($RateAZ, 2)), 2);
567567

568568
/** More common versus less common byte sequences in 1-byte encodings. */
569569
foreach ([
@@ -591,7 +591,7 @@ private function weigh(string $String, array &$Arr): void
591591
] as $Encoding => $Bytes) {
592592
if (isset($Arr[$Encoding]['Weight'])) {
593593
$RateThis = \preg_match_all('~' . $Bytes . '~', $String) / $this->Len;
594-
$EntrThis = \round(abs($RateThis * log($RateThis, 2)), 2);
594+
$EntrThis = \round(\abs($RateThis * \log($RateThis, 2)), 2);
595595
if ($EntrThis !== $EntrAZ) {
596596
$Arr[$Encoding]['Weight'] += ($EntrThis > $EntrAZ) ? 0.5 : -0.5;
597597
}

src/YAML.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* YAML handler (last modified: 2026.03.18).
3+
* YAML handler (last modified: 2026.03.20).
44
*
55
* This file is a part of the "common classes package", utilised by a number of
66
* packages and projects, including CIDRAM and phpMussel.
@@ -248,11 +248,11 @@ public function process(string $In, array &$Arr, int $Depth = 0, bool $Refs = fa
248248
return;
249249
});
250250

251-
$Attempt = iconv($this->LastInputEncoding, 'UTF-8', $In);
251+
$Attempt = \iconv($this->LastInputEncoding, 'UTF-8', $In);
252252
if (
253253
$Attempt === false ||
254254
!$this->Demojibakefier->checkConformity($Attempt, 'UTF-8') ||
255-
\strcmp(iconv('UTF-8', $this->LastInputEncoding, $Attempt), $In) !== 0
255+
\strcmp(\iconv('UTF-8', $this->LastInputEncoding, $Attempt), $In) !== 0
256256
) {
257257
return false;
258258
}
@@ -1069,14 +1069,14 @@ private function unescape(string $Value = '', string $Style = '"'): string
10691069
if (($Decoded = \hex2bin($Captured[2])) === false) {
10701070
return $Captured[0];
10711071
}
1072-
$Reversed = ($Attempt = iconv('UTF-16BE', 'UTF-8', $Decoded)) === false ? '' : iconv('UTF-8', 'UTF-16BE', $Attempt);
1072+
$Reversed = ($Attempt = \iconv('UTF-16BE', 'UTF-8', $Decoded)) === false ? '' : \iconv('UTF-8', 'UTF-16BE', $Attempt);
10731073
return $Captured[1] . (($Attempt !== false && \strcmp($Reversed, $Decoded) === 0) ? $Attempt : $Decoded);
10741074
}, $Value);
10751075
$Value = \preg_replace_callback('~(?<!\\\\)\\\\((?:\\\\{2})*)U([\dA-Fa-f]{8})~', function ($Captured) {
10761076
if (($Decoded = \hex2bin($Captured[2])) === false) {
10771077
return $Captured[0];
10781078
}
1079-
$Reversed = ($Attempt = iconv('UTF-32BE', 'UTF-8', $Decoded)) === false ? '' : iconv('UTF-8', 'UTF-32BE', $Attempt);
1079+
$Reversed = ($Attempt = \iconv('UTF-32BE', 'UTF-8', $Decoded)) === false ? '' : \iconv('UTF-8', 'UTF-32BE', $Attempt);
10801080
return $Captured[1] . (($Attempt !== false && \strcmp($Reversed, $Decoded) === 0) ? $Attempt : $Decoded);
10811081
}, $Value);
10821082
$Value = \str_replace('\\\\', '\\', $Value);

0 commit comments

Comments
 (0)