mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-11 22:38:42 +00:00
fix after change to php 7.4
This commit is contained in:
parent
dd68825329
commit
7b1cf0e660
|
|
@ -49,7 +49,7 @@ abstract class ConnectionAbstract implements ConnectionInterface
|
||||||
* @var string
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public string string $prefix = '';
|
public string $prefix = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database data.
|
* Database data.
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ class FileCache extends ConnectionAbstract
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected $type = CacheType::FILE;
|
protected string $type = CacheType::FILE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delimiter for cache meta data
|
* Delimiter for cache meta data
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,9 @@ class RedisCache extends ConnectionAbstract
|
||||||
$this->status = CacheStatus::OK;
|
$this->status = CacheStatus::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
public function close() : void
|
public function close() : void
|
||||||
{
|
{
|
||||||
if ($this->con !== null) {
|
if ($this->con !== null) {
|
||||||
|
|
|
||||||
|
|
@ -29,16 +29,52 @@ class Builder extends QueryBuilder
|
||||||
{
|
{
|
||||||
public string $createTable = '';
|
public string $createTable = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fields.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public array $createFields = [];
|
public array $createFields = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Database to drop.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public string $dropDatabase = '';
|
public string $dropDatabase = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Table to drop.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public string $dropTable = '';
|
public string $dropTable = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tables.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public array $selectTables = ['*'];
|
public array $selectTables = ['*'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Select fields.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public string $selectFields = '';
|
public string $selectFields = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @todo: ?????.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public bool $createTableSettings = true;
|
public bool $createTableSettings = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,13 @@ class SchemaMapper
|
||||||
*/
|
*/
|
||||||
protected ?ConnectionAbstract $db = null;
|
protected ?ConnectionAbstract $db = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param ConnectionAbstract $db Database connection
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function __construct(ConnectionAbstract $db)
|
public function __construct(ConnectionAbstract $db)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ class HttpSession implements SessionInterface
|
||||||
$this->destroy();
|
$this->destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->sessionData = $_SESSION;
|
$this->sessionData = $_SESSION ?? [];
|
||||||
$_SESSION = null;
|
$_SESSION = null;
|
||||||
$this->sessionData['lastActivity'] = \time();
|
$this->sessionData['lastActivity'] = \time();
|
||||||
$this->sid = \session_id();
|
$this->sid = \session_id();
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use phpOMS\System\File\PathException;
|
||||||
* @link https://orange-management.org
|
* @link https://orange-management.org
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
final class Dispatcher
|
final class Dispatcher implements DispatcherInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -61,16 +61,7 @@ final class Dispatcher
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatch controller.
|
* {@inheritdoc}
|
||||||
*
|
|
||||||
* @param array|\Closure|string $controller Controller
|
|
||||||
* @param null|array|mixed ...$data Data
|
|
||||||
*
|
|
||||||
* @return array Returns array of all dispatched results
|
|
||||||
*
|
|
||||||
* @throws \UnexpectedValueException This exception is thrown for unsupported controller representations
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
*/
|
||||||
public function dispatch($controller, ...$data) : array
|
public function dispatch($controller, ...$data) : array
|
||||||
{
|
{
|
||||||
|
|
|
||||||
32
Dispatcher/DispatcherInterface.php
Normal file
32
Dispatcher/DispatcherInterface.php
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Orange Management
|
||||||
|
*
|
||||||
|
* PHP Version 7.4
|
||||||
|
*
|
||||||
|
* @package phpOMS\Dispatcher
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link https://orange-management.org
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace phpOMS\Dispatcher;
|
||||||
|
|
||||||
|
interface DispatcherInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispatch controller.
|
||||||
|
*
|
||||||
|
* @param array|\Closure|string $controller Controller
|
||||||
|
* @param null|array|mixed ...$data Data
|
||||||
|
*
|
||||||
|
* @return array Returns array of all dispatched results
|
||||||
|
*
|
||||||
|
* @throws \UnexpectedValueException This exception is thrown for unsupported controller representations
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function dispatch($controller, ...$data) : array;
|
||||||
|
}
|
||||||
|
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
||||||
namespace phpOMS\Event;
|
namespace phpOMS\Event;
|
||||||
|
|
||||||
use phpOMS\Dispatcher\Dispatcher;
|
use phpOMS\Dispatcher\Dispatcher;
|
||||||
|
use phpOMS\Dispatcher\DispatcherInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EventManager class.
|
* EventManager class.
|
||||||
|
|
@ -51,10 +52,10 @@ final class EventManager implements \Countable
|
||||||
/**
|
/**
|
||||||
* Dispatcher.
|
* Dispatcher.
|
||||||
*
|
*
|
||||||
* @var Dispatcher|Object<dispatch>
|
* @var DispatcherInterface|Object<dispatch>
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private ?Dispatcher $dispatcher = null;
|
private ?DispatcherInterface $dispatcher = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
|
@ -65,10 +66,12 @@ final class EventManager implements \Countable
|
||||||
*/
|
*/
|
||||||
public function __construct(Dispatcher $dispatcher = null)
|
public function __construct(Dispatcher $dispatcher = null)
|
||||||
{
|
{
|
||||||
$this->dispatcher = $dispatcher ?? new class() {
|
$this->dispatcher = $dispatcher ?? new class() implements DispatcherInterface {
|
||||||
public function dispatch($func, ...$data) : void
|
public function dispatch($func, ...$data) : array
|
||||||
{
|
{
|
||||||
$func(...$data);
|
$func(...$data);
|
||||||
|
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -301,44 +301,29 @@ class Matrix implements \ArrayAccess, \Iterator
|
||||||
$mDim = $this->m;
|
$mDim = $this->m;
|
||||||
$nDim = $this->n;
|
$nDim = $this->n;
|
||||||
|
|
||||||
if ($this->m > $this->n) {
|
$rank = \max($mDim, $nDim);
|
||||||
$mDim = $this->n;
|
$selected = \array_fill(0, $mDim, false);
|
||||||
$nDim = $this->m;
|
|
||||||
$matrix = \array_map(null, ...$matrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
$rank = $mDim;
|
for ($i = 0; $i < $nDim; ++$i) {
|
||||||
|
$j;
|
||||||
|
for ($j = 0; $j < $mDim; ++$j) {
|
||||||
|
if (!$selected[$j] && \abs($matrix[$j][$i]) > 0.0001)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
for ($row = 0; $row < $rank; ++$row) {
|
if ($j === $mDim) {
|
||||||
if (isset($matrix[$row][$row]) && $matrix[$row][$row] !== 0) {
|
--$rank;
|
||||||
for ($col = 0; $col < $mDim; ++$col) {
|
|
||||||
if ($col !== $row) {
|
|
||||||
$mult = $matrix[$col][$row] / $matrix[$row][$row];
|
|
||||||
|
|
||||||
for ($i = 0; $i < $rank; ++$i) {
|
|
||||||
$matrix[$col][$i] -= $mult * $matrix[$row][$i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$reduce = true;
|
$selected[$j] = true;
|
||||||
|
for ($p = $i + 1; $p < $nDim; ++$p) {
|
||||||
for ($i = $row + 1; $i < $mDim; ++$i) {
|
$matrix[$j][$p] /= $matrix[$j][$i];
|
||||||
if (isset($matrix[$i][$row]) && $matrix[$i][$row] !== 0) {
|
|
||||||
$this->swapRow($matrix, $row, $i, $rank);
|
|
||||||
$reduce = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($reduce) {
|
for ($k = 0; $k < $mDim; ++$k) {
|
||||||
--$rank;
|
if ($k !== $j && \abs($matrix[$k][$i]) > 0.0001) {
|
||||||
|
for ($p = $i + 1; $p < $nDim; ++$p)
|
||||||
for ($i = 0; $i < $mDim; ++$i) {
|
$matrix[$k][$p] -= $matrix[$j][$p] * $matrix[$k][$i];
|
||||||
$matrix[$i][$row] = $matrix[$i][$rank];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
--$row;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -361,9 +346,9 @@ class Matrix implements \ArrayAccess, \Iterator
|
||||||
private function swapRow(array &$matrix, int $row1, int $row2, int $col) : void
|
private function swapRow(array &$matrix, int $row1, int $row2, int $col) : void
|
||||||
{
|
{
|
||||||
for ($i = 0; $i < $col; ++$i) {
|
for ($i = 0; $i < $col; ++$i) {
|
||||||
$temp = $matrix[$row1][$i];
|
$temp = $matrix[$row1][$i];
|
||||||
$matrix[$row1] = $matrix[$row2][$i];
|
$matrix[$row1][$i] = $matrix[$row2][$i];
|
||||||
$matrix[$row2] = $temp;
|
$matrix[$row2][$i] = $temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ final class PackageManager
|
||||||
$state = \sodium_crypto_generichash_init();
|
$state = \sodium_crypto_generichash_init();
|
||||||
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if ($file === 'package.cert') {
|
if ($file === 'package.cert' || \is_dir($this->extractPath . '/' . $file)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,10 +44,10 @@ class Address implements \JsonSerializable
|
||||||
/**
|
/**
|
||||||
* Location.
|
* Location.
|
||||||
*
|
*
|
||||||
* @var Location
|
* @var null|Location
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private Location $location = null;
|
private ?Location $location = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ class SmartDateTime extends \DateTime
|
||||||
$yearChange = ((int) $this->format('m') - 1 + $m) < 0 && ((int) $this->format('m') - 1 + $m) % 12 === 0 ? $yearChange - 1 : $yearChange;
|
$yearChange = ((int) $this->format('m') - 1 + $m) < 0 && ((int) $this->format('m') - 1 + $m) % 12 === 0 ? $yearChange - 1 : $yearChange;
|
||||||
$yearNew = (int) $this->format('Y') + $y + $yearChange;
|
$yearNew = (int) $this->format('Y') + $y + $yearChange;
|
||||||
$monthNew = ((int) $this->format('m') + $m) % 12;
|
$monthNew = ((int) $this->format('m') + $m) % 12;
|
||||||
$monthNew = $monthNew === 0 ? 12 : $monthNew < 0 ? 12 + $monthNew : $monthNew;
|
$monthNew = $monthNew === 0 ? 12 : ($monthNew < 0 ? 12 + $monthNew : $monthNew);
|
||||||
$dayMonthOld = \cal_days_in_month($calendar, (int) $this->format('m'), (int) $this->format('Y'));
|
$dayMonthOld = \cal_days_in_month($calendar, (int) $this->format('m'), (int) $this->format('Y'));
|
||||||
$dayMonthNew = \cal_days_in_month($calendar, $monthNew, $yearNew);
|
$dayMonthNew = \cal_days_in_month($calendar, $monthNew, $yearNew);
|
||||||
$dayOld = (int) $this->format('d');
|
$dayOld = (int) $this->format('d');
|
||||||
|
|
|
||||||
|
|
@ -329,6 +329,6 @@ class PriorityQueue implements \Countable, \Serializable
|
||||||
*/
|
*/
|
||||||
public function unserialize($data) : void
|
public function unserialize($data) : void
|
||||||
{
|
{
|
||||||
$this->queue = \json_decode($data);
|
$this->queue = \json_decode($data, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -310,7 +310,7 @@ class Directory extends FileAbstract implements FtpContainerInterface, Directory
|
||||||
) = $chunks;
|
) = $chunks;
|
||||||
|
|
||||||
$e['permission'] = FileUtils::permissionToOctal(\substr($e['permission'], 1));
|
$e['permission'] = FileUtils::permissionToOctal(\substr($e['permission'], 1));
|
||||||
$e['type'] = $chunks[0]{0} === 'd' ? 'dir' : 'file';
|
$e['type'] = $chunks[0][0] === 'd' ? 'dir' : 'file';
|
||||||
|
|
||||||
$data[$names[$key]] = $e;
|
$data[$names[$key]] = $e;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -255,7 +255,7 @@ final class ArrayUtils
|
||||||
$str .= $key . ' => \'' . $value . '\', ';
|
$str .= $key . ' => \'' . $value . '\', ';
|
||||||
break;
|
break;
|
||||||
case 'boolean':
|
case 'boolean':
|
||||||
$str .= $key . ' => ' . ($value['default'] ? 'true' : 'false') . ', ';
|
$str .= $key . ' => ' . ($value ? 'true' : 'false') . ', ';
|
||||||
break;
|
break;
|
||||||
case 'NULL':
|
case 'NULL':
|
||||||
$str .= $key . ' => null, ';
|
$str .= $key . ' => null, ';
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class C128a extends C128Abstract
|
||||||
* @var int
|
* @var int
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected static $CHECKSUM = 103;
|
protected static int $CHECKSUM = 103;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Char weighted array.
|
* Char weighted array.
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class C128b extends C128Abstract
|
||||||
* @var int
|
* @var int
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected static $CHECKSUM = 104;
|
protected static int $CHECKSUM = 104;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Char weighted array.
|
* Char weighted array.
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class C128c extends C128Abstract
|
||||||
* @var int
|
* @var int
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected static $CHECKSUM = 105;
|
protected static int $CHECKSUM = 105;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Char weighted array.
|
* Char weighted array.
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class DispatcherTest extends \PHPUnit\Framework\TestCase
|
||||||
|
|
||||||
protected function setUp() : void
|
protected function setUp() : void
|
||||||
{
|
{
|
||||||
$this->app = new class() extends ApplicationAbstract { protected $appName = 'Api'; };
|
$this->app = new class() extends ApplicationAbstract { protected string $appName = 'Api'; };
|
||||||
$this->app->router = new Router();
|
$this->app->router = new Router();
|
||||||
$this->app->dispatcher = new Dispatcher($this->app);
|
$this->app->dispatcher = new Dispatcher($this->app);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ class ModuleManagerTest extends \PHPUnit\Framework\TestCase
|
||||||
|
|
||||||
protected function setUp() : void
|
protected function setUp() : void
|
||||||
{
|
{
|
||||||
$this->app = new class() extends ApplicationAbstract { protected $appName = 'Api'; };
|
$this->app = new class() extends ApplicationAbstract { protected string $appName = 'Api'; };
|
||||||
$this->app->appName = 'Api';
|
$this->app->appName = 'Api';
|
||||||
$this->app->dbPool = $GLOBALS['dbpool'];
|
$this->app->dbPool = $GLOBALS['dbpool'];
|
||||||
$this->app->dispatcher = new Dispatcher($this->app);
|
$this->app->dispatcher = new Dispatcher($this->app);
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class PackageManagerTest extends \PHPUnit\Framework\TestCase
|
||||||
$state = \sodium_crypto_generichash_init();
|
$state = \sodium_crypto_generichash_init();
|
||||||
|
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if ($file === 'package.cert') {
|
if ($file === 'package.cert' || \is_dir(__DIR__ . '/testPackage' . '/' . $file)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class ViewTest extends \PHPUnit\Framework\TestCase
|
||||||
|
|
||||||
$this->app = new class() extends ApplicationAbstract
|
$this->app = new class() extends ApplicationAbstract
|
||||||
{
|
{
|
||||||
protected $appName = 'Api';
|
protected string $appName = 'Api';
|
||||||
};
|
};
|
||||||
|
|
||||||
$this->app->l11nManager = new L11nManager($this->app->appName);
|
$this->app->l11nManager = new L11nManager($this->app->appName);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user