mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-01-14 11:08:40 +00:00
backup
This commit is contained in:
parent
acf9a247f0
commit
ebbc08fe9b
|
|
@ -95,6 +95,8 @@ final class BasicOcr
|
|||
}
|
||||
|
||||
// $magicNumber = $unpack[1];
|
||||
// 2051 === image data (should always be this)
|
||||
// 2049 === label data
|
||||
|
||||
if (($read = \fread($fp, 4)) === false || ($unpack = \unpack('N', $read)) === false) {
|
||||
return []; // @codeCoverageIgnore
|
||||
|
|
@ -159,7 +161,10 @@ final class BasicOcr
|
|||
if (($read = \fread($fp, 4)) === false || ($unpack = \unpack('N', $read)) === false) {
|
||||
return []; // @codeCoverageIgnore
|
||||
}
|
||||
$magicNumber = $unpack[1];
|
||||
|
||||
// $magicNumber = $unpack[1];
|
||||
// 2051 === image data
|
||||
// 2049 === label data (should always be this)
|
||||
|
||||
if (($read = \fread($fp, 4)) === false || ($unpack = \unpack('N', $read)) === false) {
|
||||
return []; // @codeCoverageIgnore
|
||||
|
|
@ -258,7 +263,7 @@ final class BasicOcr
|
|||
}
|
||||
|
||||
\fwrite($out, \pack('N', 2051));
|
||||
\fwrite($out, \pack('N', 1));
|
||||
\fwrite($out, \pack('N', \count($images)));
|
||||
\fwrite($out, \pack('N', $resolution));
|
||||
\fwrite($out, \pack('N', $resolution));
|
||||
|
||||
|
|
@ -299,7 +304,7 @@ final class BasicOcr
|
|||
}
|
||||
|
||||
for ($i = 0; $i < $size; ++$i) {
|
||||
\fwrite($out, \pack('C', \round($mnist[$i] * 255)));
|
||||
\fwrite($out, \pack('C', (int) \round($mnist[$i] * 255)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -325,7 +330,7 @@ final class BasicOcr
|
|||
}
|
||||
|
||||
\fwrite($out, \pack('N', 2049));
|
||||
\fwrite($out, \pack('N', 1));
|
||||
\fwrite($out, \pack('N', \count($data)));
|
||||
|
||||
foreach ($data as $e) {
|
||||
\fwrite($out, \pack('C', $e));
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ final class EUVATBffOnline implements EUVATInterface
|
|||
}
|
||||
|
||||
$result['status'] = 0;
|
||||
} catch (\Throwable $t) {
|
||||
} catch (\Throwable $_) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ final class EUVATBffOnline implements EUVATInterface
|
|||
$result['name'] = $matches[1] ?? 'B';
|
||||
|
||||
$result['status'] = 0;
|
||||
} catch (\Throwable $t) {
|
||||
} catch (\Throwable $_) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ final class EUVATVies implements EUVATInterface
|
|||
$result = \array_merge($result, self::parseResponse($json));
|
||||
|
||||
$result['status'] = $json['userError'] === 'VALID' ? 0 : -1;
|
||||
} catch (\Throwable $t) {
|
||||
} catch (\Throwable $_) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
@ -182,7 +182,7 @@ final class EUVATVies implements EUVATInterface
|
|||
}
|
||||
|
||||
$result['status'] = $json['userError'] === 'VALID' ? 0 : -1;
|
||||
} catch (\Throwable $t) {
|
||||
} catch (\Throwable $_) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ final class ApplicationManager
|
|||
$class::install($this->app, $info, $this->app->appSettings);
|
||||
|
||||
return true;
|
||||
} catch (\Throwable $t) {
|
||||
} catch (\Throwable $_) {
|
||||
return false; // @codeCoverageIgnore
|
||||
}
|
||||
}
|
||||
|
|
@ -155,7 +155,7 @@ final class ApplicationManager
|
|||
$this->uninstallFiles($source);
|
||||
|
||||
return true;
|
||||
} catch (\Throwable $t) {
|
||||
} catch (\Throwable $_) {
|
||||
return false; // @codeCoverageIgnore
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -877,6 +877,9 @@ final class ReadMapper extends DataMapperAbstract
|
|||
}
|
||||
|
||||
$objects = $objectMapper->execute();
|
||||
if (empty($objects) || (!\is_array($objects) && $objects->id === 0)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($refClass === null) {
|
||||
$refClass = new \ReflectionClass($obj);
|
||||
|
|
|
|||
|
|
@ -1115,7 +1115,7 @@ class Email implements MessageInterface
|
|||
\PKCS7_DETACHED,
|
||||
$this->signExtracertFiles
|
||||
);
|
||||
} catch (\Throwable $t) {
|
||||
} catch (\Throwable $_) {
|
||||
$sign = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -523,19 +523,19 @@ final class ModuleManager
|
|||
|
||||
/* Install providing but only if receiving module is already installed */
|
||||
$providing = $info->getProviding();
|
||||
foreach ($providing as $key => $version) {
|
||||
foreach ($providing as $key => $_) {
|
||||
if (isset($installed[$key])) {
|
||||
$this->installProviding('/Modules/' . $module, $key);
|
||||
}
|
||||
}
|
||||
|
||||
/* Install receiving and applications */
|
||||
foreach ($this->installed as $key => $value) {
|
||||
foreach ($this->installed as $key => $_) {
|
||||
$this->installProviding('/Modules/' . $key, $module);
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (\Throwable $t) {
|
||||
} catch (\Throwable $_) {
|
||||
return false; // @codeCoverageIgnore
|
||||
}
|
||||
}
|
||||
|
|
@ -593,7 +593,7 @@ final class ModuleManager
|
|||
}
|
||||
|
||||
return true;
|
||||
} catch (\Throwable $t) {
|
||||
} catch (\Throwable $_) {
|
||||
return false; // @codeCoverageIgnore
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -280,4 +280,14 @@ final class FileUtils
|
|||
{
|
||||
return !\preg_match('#^[a-z][a-z\d+.-]*://#i', $path);
|
||||
}
|
||||
|
||||
public static function makeSafeFileName(string $name) : string
|
||||
{
|
||||
$name = \preg_replace("/[^A-Za-z0-9\-_.]/", '_', $name);
|
||||
$name = \preg_replace("/_+/", '_', $name);
|
||||
$name = \trim($name, '_');
|
||||
$name = \strtolower($name);
|
||||
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -490,7 +490,7 @@ final class Directory extends FileAbstract implements DirectoryInterface
|
|||
|
||||
try {
|
||||
\mkdir($path, $permission, $recursive);
|
||||
} catch (\Throwable $t) {
|
||||
} catch (\Throwable $_) {
|
||||
return false; // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2023,8 +2023,28 @@ abstract class MimeType extends Enum
|
|||
{
|
||||
try {
|
||||
return (string) (self::getByName('M_' . \strtoupper($extension)) ?? 'application/octet-stream');
|
||||
} catch (\Throwable $t) {
|
||||
} catch (\Throwable $_) {
|
||||
return 'application/octet-stream';
|
||||
}
|
||||
}
|
||||
|
||||
public static function mimeToExtension(string $mime) : ?string
|
||||
{
|
||||
switch($mime) {
|
||||
case self::M_PDF:
|
||||
return 'pdf';
|
||||
case self::M_JPEG:
|
||||
case self::M_JPG:
|
||||
return 'jpg';
|
||||
case self::M_BMP:
|
||||
return 'bmp';
|
||||
case self::M_GIF:
|
||||
return 'gif';
|
||||
case self::M_HTML:
|
||||
case self::M_HTM:
|
||||
return 'htm';
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ final class Currency
|
|||
|
||||
self::$ecbCurrencies[\strtoupper((string) ($attributes['currency']))] = (float) ($attributes['rate']);
|
||||
}
|
||||
} catch (\Throwable $t) {
|
||||
} catch (\Throwable $_) {
|
||||
self::$ecbCurrencies = []; // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ class Tar implements ArchiveInterface
|
|||
$tar->extractTo($destination . '/');
|
||||
|
||||
return true;
|
||||
} catch (\Throwable $t) {
|
||||
} catch (\Throwable $_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ class Zip implements ArchiveInterface
|
|||
$zip->extractTo($destination . '/');
|
||||
|
||||
return $zip->close();
|
||||
} catch (\Throwable $t) {
|
||||
} catch (\Throwable $_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -386,7 +386,7 @@ final class EigenvalueDecompositionTest extends \PHPUnit\Framework\TestCase
|
|||
$eig = new EigenvalueDecomposition($A);
|
||||
++$c;
|
||||
} while (true);
|
||||
} catch (\Throwable $t) {
|
||||
} catch (\Throwable $_) {
|
||||
var_dump($c);
|
||||
var_dump($array);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ final class DirectoryTest extends \PHPUnit\Framework\TestCase
|
|||
if (!$mkdir || !$put) {
|
||||
throw new \Exception();
|
||||
}
|
||||
} catch (\Throwable $t) {
|
||||
} catch (\Throwable $_) {
|
||||
self::$con = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ final class FileTest extends \PHPUnit\Framework\TestCase
|
|||
if (!$mkdir || !$put) {
|
||||
throw new \Exception();
|
||||
}
|
||||
} catch (\Throwable $t) {
|
||||
} catch (\Throwable $_) {
|
||||
self::$con = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ final class FtpStorageTest extends \PHPUnit\Framework\TestCase
|
|||
if (!$mkdir || !$put) {
|
||||
throw new \Exception();
|
||||
}
|
||||
} catch (\Throwable $t) {
|
||||
} catch (\Throwable $_) {
|
||||
self::$con = null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ final class CurrencyTest extends \PHPUnit\Framework\TestCase
|
|||
|
||||
Rest::request($request)->getBody();
|
||||
self::$reachable = true;
|
||||
} catch (\Throwable $t) {
|
||||
} catch (\Throwable $_) {
|
||||
self::$reachable = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user