mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-07 04:58:40 +00:00
undo serialize deprecation
This commit is contained in:
parent
9f0a6233a0
commit
c1fb9a31dc
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\Account;
|
namespace phpOMS\Account;
|
||||||
|
|
||||||
use phpOMS\Contract\ArrayableInterface;
|
|
||||||
use phpOMS\Localization\Localization;
|
use phpOMS\Localization\Localization;
|
||||||
use phpOMS\Stdlib\Base\Exception\InvalidEnumValue;
|
use phpOMS\Stdlib\Base\Exception\InvalidEnumValue;
|
||||||
use phpOMS\Validation\Network\Email;
|
use phpOMS\Validation\Network\Email;
|
||||||
|
|
@ -30,7 +29,7 @@ use phpOMS\Validation\Network\Email;
|
||||||
* @link https://karaka.app
|
* @link https://karaka.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
class Account implements \JsonSerializable, ArrayableInterface
|
class Account implements \JsonSerializable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Id.
|
* Id.
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\Account;
|
namespace phpOMS\Account;
|
||||||
|
|
||||||
use phpOMS\Contract\ArrayableInterface;
|
|
||||||
use phpOMS\Stdlib\Base\Exception\InvalidEnumValue;
|
use phpOMS\Stdlib\Base\Exception\InvalidEnumValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -25,7 +24,7 @@ use phpOMS\Stdlib\Base\Exception\InvalidEnumValue;
|
||||||
* @link https://karaka.app
|
* @link https://karaka.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
class Group implements \JsonSerializable, ArrayableInterface
|
class Group implements \JsonSerializable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Group id.
|
* Group id.
|
||||||
|
|
|
||||||
32
Contract/SerializableInterface.php
Normal file
32
Contract/SerializableInterface.php
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Karaka
|
||||||
|
*
|
||||||
|
* PHP Version 8.0
|
||||||
|
*
|
||||||
|
* @package phpOMS\Contract
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link https://karaka.app
|
||||||
|
*/
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace phpOMS\Contract;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a class Serializable.
|
||||||
|
*
|
||||||
|
* This is primarily used for classes that provide formatted output or output,
|
||||||
|
* that get rendered.
|
||||||
|
*
|
||||||
|
* @package phpOMS\Contract
|
||||||
|
* @license OMS License 1.0
|
||||||
|
* @link https://karaka.app
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
interface SerializableInterface
|
||||||
|
{
|
||||||
|
public function serialize() : string;
|
||||||
|
public function unserialize($data) : void;
|
||||||
|
}
|
||||||
|
|
@ -34,7 +34,7 @@ abstract class CacheValueType extends Enum
|
||||||
|
|
||||||
public const _ARRAY = 2; /* Data is array */
|
public const _ARRAY = 2; /* Data is array */
|
||||||
|
|
||||||
public const _SERIALIZABLE = 3; /* Data implements \Serializable */
|
public const _SERIALIZABLE = 3; /* Data implements SerializableInterface */
|
||||||
|
|
||||||
public const _FLOAT = 4; /* Data is float */
|
public const _FLOAT = 4; /* Data is float */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\DataStorage\Cache\Connection;
|
namespace phpOMS\DataStorage\Cache\Connection;
|
||||||
|
|
||||||
|
use phpOMS\Contract\SerializableInterface;
|
||||||
use phpOMS\DataStorage\Cache\CacheStatus;
|
use phpOMS\DataStorage\Cache\CacheStatus;
|
||||||
use phpOMS\DataStorage\Cache\CacheType;
|
use phpOMS\DataStorage\Cache\CacheType;
|
||||||
|
|
||||||
|
|
@ -164,7 +165,7 @@ abstract class ConnectionAbstract implements ConnectionInterface
|
||||||
return CacheValueType::_ARRAY;
|
return CacheValueType::_ARRAY;
|
||||||
} elseif ($value === null) {
|
} elseif ($value === null) {
|
||||||
return CacheValueType::_NULL;
|
return CacheValueType::_NULL;
|
||||||
} elseif ($value instanceof \Serializable) {
|
} elseif ($value instanceof SerializableInterface) {
|
||||||
return CacheValueType::_SERIALIZABLE;
|
return CacheValueType::_SERIALIZABLE;
|
||||||
} elseif ($value instanceof \JsonSerializable) {
|
} elseif ($value instanceof \JsonSerializable) {
|
||||||
return CacheValueType::_JSONSERIALIZABLE;
|
return CacheValueType::_JSONSERIALIZABLE;
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\DataStorage\Cache\Connection;
|
namespace phpOMS\DataStorage\Cache\Connection;
|
||||||
|
|
||||||
|
use phpOMS\Contract\SerializableInterface;
|
||||||
use phpOMS\DataStorage\Cache\CacheStatus;
|
use phpOMS\DataStorage\Cache\CacheStatus;
|
||||||
use phpOMS\DataStorage\Cache\CacheType;
|
use phpOMS\DataStorage\Cache\CacheType;
|
||||||
use phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException;
|
use phpOMS\DataStorage\Cache\Exception\InvalidConnectionConfigException;
|
||||||
|
|
@ -94,7 +95,7 @@ final class MemCached extends ConnectionAbstract
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(\is_scalar($value) || $value === null || \is_array($value) || $value instanceof \JsonSerializable || $value instanceof \Serializable)) {
|
if (!(\is_scalar($value) || $value === null || \is_array($value) || $value instanceof \JsonSerializable || $value instanceof SerializableInterface)) {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,7 +111,7 @@ final class MemCached extends ConnectionAbstract
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(\is_scalar($value) || $value === null || \is_array($value) || $value instanceof \JsonSerializable || $value instanceof \Serializable)) {
|
if (!(\is_scalar($value) || $value === null || \is_array($value) || $value instanceof \JsonSerializable || $value instanceof SerializableInterface)) {
|
||||||
throw new \InvalidArgumentException();
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -245,7 +246,7 @@ final class MemCached extends ConnectionAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj = new $namespace();
|
$obj = new $namespace();
|
||||||
$obj->__unserialize(\substr($raw, $namespaceEnd + 1));
|
$obj->unserialize(\substr($raw, $namespaceEnd + 1));
|
||||||
|
|
||||||
return $obj;
|
return $obj;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -418,7 +418,7 @@ final class RedisCache extends ConnectionAbstract
|
||||||
} elseif ($type === CacheValueType::_ARRAY) {
|
} elseif ($type === CacheValueType::_ARRAY) {
|
||||||
return (string) \json_encode($value);
|
return (string) \json_encode($value);
|
||||||
} elseif ($type === CacheValueType::_SERIALIZABLE) {
|
} elseif ($type === CacheValueType::_SERIALIZABLE) {
|
||||||
return \get_class($value) . self::DELIM . $value->__serialize();
|
return \get_class($value) . self::DELIM . $value->serialize();
|
||||||
} elseif ($type === CacheValueType::_JSONSERIALIZABLE) {
|
} elseif ($type === CacheValueType::_JSONSERIALIZABLE) {
|
||||||
return \get_class($value) . self::DELIM . ((string) \json_encode($value->jsonSerialize()));
|
return \get_class($value) . self::DELIM . ((string) \json_encode($value->jsonSerialize()));
|
||||||
} elseif ($type === CacheValueType::_NULL) {
|
} elseif ($type === CacheValueType::_NULL) {
|
||||||
|
|
@ -475,7 +475,7 @@ final class RedisCache extends ConnectionAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
$obj = new $namespace();
|
$obj = new $namespace();
|
||||||
$obj->__unserialize(\substr($raw, $namespaceEnd + 1));
|
$obj->unserialize(\substr($raw, $namespaceEnd + 1));
|
||||||
|
|
||||||
return $obj;
|
return $obj;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -355,7 +355,7 @@ abstract class DataMapperAbstract
|
||||||
} elseif ($type === 'Json') {
|
} elseif ($type === 'Json') {
|
||||||
return (string) \json_encode($value);
|
return (string) \json_encode($value);
|
||||||
} elseif ($type === 'Serializable') {
|
} elseif ($type === 'Serializable') {
|
||||||
return $value->__serialize();
|
return $value->serialize();
|
||||||
} elseif (\is_object($value) && \method_exists($value, 'getId')) {
|
} elseif (\is_object($value) && \method_exists($value, 'getId')) {
|
||||||
return $value->getId();
|
return $value->getId();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -632,7 +632,7 @@ final class ReadMapper extends DataMapperAbstract
|
||||||
if ($member === null || $value === null) {
|
if ($member === null || $value === null) {
|
||||||
$obj->{$def['internal']} = $value;
|
$obj->{$def['internal']} = $value;
|
||||||
} else {
|
} else {
|
||||||
$member->__unserialize($value);
|
$member->unserialize($value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -706,7 +706,7 @@ final class ReadMapper extends DataMapperAbstract
|
||||||
$refProp->setValue($obj, \json_decode($value, true));
|
$refProp->setValue($obj, \json_decode($value, true));
|
||||||
} elseif ($def['mapper']::COLUMNS[$column]['type'] === 'Serializable') {
|
} elseif ($def['mapper']::COLUMNS[$column]['type'] === 'Serializable') {
|
||||||
$member = $isPublic ? $obj->{$member} : $refProp->getValue($obj);
|
$member = $isPublic ? $obj->{$member} : $refProp->getValue($obj);
|
||||||
$member->__unserialize($value);
|
$member->unserialize($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$isPublic) {
|
if (!$isPublic) {
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
||||||
namespace phpOMS\DataStorage\Database\Query;
|
namespace phpOMS\DataStorage\Database\Query;
|
||||||
|
|
||||||
use phpOMS\Algorithm\Graph\DependencyResolver;
|
use phpOMS\Algorithm\Graph\DependencyResolver;
|
||||||
|
use phpOMS\Contract\SerializableInterface;
|
||||||
use phpOMS\DataStorage\Database\BuilderAbstract;
|
use phpOMS\DataStorage\Database\BuilderAbstract;
|
||||||
use phpOMS\DataStorage\Database\Connection\ConnectionAbstract;
|
use phpOMS\DataStorage\Database\Connection\ConnectionAbstract;
|
||||||
|
|
||||||
|
|
@ -1454,7 +1455,7 @@ class Builder extends BuilderAbstract
|
||||||
return $column;
|
return $column;
|
||||||
} elseif ($column instanceof Column) {
|
} elseif ($column instanceof Column) {
|
||||||
return $column->getColumn();
|
return $column->getColumn();
|
||||||
} elseif ($column instanceof \Serializable) {
|
} elseif ($column instanceof SerializableInterface) {
|
||||||
return $column->serialize();
|
return $column->serialize();
|
||||||
} elseif ($column instanceof self) {
|
} elseif ($column instanceof self) {
|
||||||
return \md5($column->toSql());
|
return \md5($column->toSql());
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\DataStorage\Database\Query\Grammar;
|
namespace phpOMS\DataStorage\Database\Query\Grammar;
|
||||||
|
|
||||||
|
use phpOMS\Contract\SerializableInterface;
|
||||||
use phpOMS\DataStorage\Database\GrammarAbstract;
|
use phpOMS\DataStorage\Database\GrammarAbstract;
|
||||||
use phpOMS\DataStorage\Database\Query\Builder;
|
use phpOMS\DataStorage\Database\Query\Builder;
|
||||||
use phpOMS\DataStorage\Database\Query\Column;
|
use phpOMS\DataStorage\Database\Query\Column;
|
||||||
|
|
@ -359,7 +360,7 @@ class Grammar extends GrammarAbstract
|
||||||
$encoded = \json_encode($value);
|
$encoded = \json_encode($value);
|
||||||
|
|
||||||
return $encoded ? $encoded : 'NULL';
|
return $encoded ? $encoded : 'NULL';
|
||||||
} elseif ($value instanceof \Serializable) {
|
} elseif ($value instanceof SerializableInterface) {
|
||||||
return $value->serialize();
|
return $value->serialize();
|
||||||
} elseif ($value instanceof Parameter) {
|
} elseif ($value instanceof Parameter) {
|
||||||
return $value->__toString();
|
return $value->__toString();
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -523,4 +523,6 @@ class ISO3166CharEnum extends Enum
|
||||||
public const _ZMB = 'ZMB';
|
public const _ZMB = 'ZMB';
|
||||||
|
|
||||||
public const _ZWE = 'ZWE';
|
public const _ZWE = 'ZWE';
|
||||||
|
|
||||||
|
public const _XXX = 'XXX';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -525,4 +525,6 @@ class ISO3166NameEnum extends Enum
|
||||||
public const _ZWE = 'Zimbabwe';
|
public const _ZWE = 'Zimbabwe';
|
||||||
|
|
||||||
public const _XKK = 'Kosovo';
|
public const _XKK = 'Kosovo';
|
||||||
|
|
||||||
|
public const _XXX = 'XXX';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -523,4 +523,6 @@ class ISO3166NumEnum extends Enum
|
||||||
public const _ZMB = '894';
|
public const _ZMB = '894';
|
||||||
|
|
||||||
public const _ZWE = '716';
|
public const _ZWE = '716';
|
||||||
|
|
||||||
|
public const _XXX = '000';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -525,4 +525,6 @@ class ISO3166TwoEnum extends Enum
|
||||||
public const _ZWE = 'ZW';
|
public const _ZWE = 'ZW';
|
||||||
|
|
||||||
public const _XKK = 'XK';
|
public const _XKK = 'XK';
|
||||||
|
|
||||||
|
public const _XXX = 'XX';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\Message\Socket;
|
namespace phpOMS\Message\Socket;
|
||||||
|
|
||||||
|
use phpOMS\Contract\SerializableInterface;
|
||||||
use phpOMS\Message\HeaderAbstract;
|
use phpOMS\Message\HeaderAbstract;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -26,7 +27,7 @@ use phpOMS\Message\HeaderAbstract;
|
||||||
* @link https://karaka.app
|
* @link https://karaka.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
class SocketHeader extends HeaderAbstract implements \Serializable
|
class SocketHeader extends HeaderAbstract implements SerializableInterface
|
||||||
{
|
{
|
||||||
private $sendFrom = null;
|
private $sendFrom = null;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\Model\Message;
|
namespace phpOMS\Model\Message;
|
||||||
|
|
||||||
use phpOMS\Contract\ArrayableInterface;
|
use phpOMS\Contract\SerializableInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dom class.
|
* Dom class.
|
||||||
|
|
@ -24,7 +24,7 @@ use phpOMS\Contract\ArrayableInterface;
|
||||||
* @link https://karaka.app
|
* @link https://karaka.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
final class Dom implements \Serializable, ArrayableInterface
|
final class Dom implements SerializableInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Message type.
|
* Message type.
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\Model\Message;
|
namespace phpOMS\Model\Message;
|
||||||
|
|
||||||
use phpOMS\Contract\ArrayableInterface;
|
use phpOMS\Contract\SerializableInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FormValidation class.
|
* FormValidation class.
|
||||||
|
|
@ -24,7 +24,7 @@ use phpOMS\Contract\ArrayableInterface;
|
||||||
* @link https://karaka.app
|
* @link https://karaka.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
final class FormValidation implements \JsonSerializable, \Serializable, ArrayableInterface
|
final class FormValidation implements \JsonSerializable, SerializableInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Message type.
|
* Message type.
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\Model\Message;
|
namespace phpOMS\Model\Message;
|
||||||
|
|
||||||
use phpOMS\Contract\ArrayableInterface;
|
use phpOMS\Contract\SerializableInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notify class.
|
* Notify class.
|
||||||
|
|
@ -24,7 +24,7 @@ use phpOMS\Contract\ArrayableInterface;
|
||||||
* @link https://karaka.app
|
* @link https://karaka.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
final class Notify implements \JsonSerializable, \Serializable, ArrayableInterface
|
final class Notify implements \JsonSerializable, SerializableInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Message type.
|
* Message type.
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\Model\Message;
|
namespace phpOMS\Model\Message;
|
||||||
|
|
||||||
use phpOMS\Contract\ArrayableInterface;
|
use phpOMS\Contract\SerializableInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redirect class.
|
* Redirect class.
|
||||||
|
|
@ -24,7 +24,7 @@ use phpOMS\Contract\ArrayableInterface;
|
||||||
* @link https://karaka.app
|
* @link https://karaka.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
final class Redirect implements \JsonSerializable, \Serializable, ArrayableInterface
|
final class Redirect implements \JsonSerializable, SerializableInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Message type.
|
* Message type.
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\Model\Message;
|
namespace phpOMS\Model\Message;
|
||||||
|
|
||||||
use phpOMS\Contract\ArrayableInterface;
|
use phpOMS\Contract\SerializableInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reload class.
|
* Reload class.
|
||||||
|
|
@ -24,7 +24,7 @@ use phpOMS\Contract\ArrayableInterface;
|
||||||
* @link https://karaka.app
|
* @link https://karaka.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
final class Reload implements \JsonSerializable, \Serializable, ArrayableInterface
|
final class Reload implements \JsonSerializable, SerializableInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Message type.
|
* Message type.
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\Stdlib\Base;
|
namespace phpOMS\Stdlib\Base;
|
||||||
|
|
||||||
|
use phpOMS\Contract\SerializableInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FloatInt class.
|
* FloatInt class.
|
||||||
*
|
*
|
||||||
|
|
@ -22,7 +24,7 @@ namespace phpOMS\Stdlib\Base;
|
||||||
* @link https://karaka.app
|
* @link https://karaka.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
class FloatInt implements \Serializable
|
class FloatInt implements SerializableInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Max amount of decimals.
|
* Max amount of decimals.
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\Stdlib\Base;
|
namespace phpOMS\Stdlib\Base;
|
||||||
|
|
||||||
|
use phpOMS\Contract\SerializableInterface;
|
||||||
use phpOMS\Validation\Finance\IbanEnum;
|
use phpOMS\Validation\Finance\IbanEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -24,7 +25,7 @@ use phpOMS\Validation\Finance\IbanEnum;
|
||||||
* @link https://karaka.app
|
* @link https://karaka.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
class Iban implements \Serializable
|
class Iban implements SerializableInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Iban.
|
* Iban.
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\Stdlib\Base;
|
namespace phpOMS\Stdlib\Base;
|
||||||
|
|
||||||
|
use phpOMS\Contract\SerializableInterface;
|
||||||
use phpOMS\Localization\ISO3166TwoEnum;
|
use phpOMS\Localization\ISO3166TwoEnum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -24,7 +25,7 @@ use phpOMS\Localization\ISO3166TwoEnum;
|
||||||
* @link https://karaka.app
|
* @link https://karaka.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
class Location implements \JsonSerializable, \Serializable
|
class Location implements \JsonSerializable, SerializableInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Location id
|
* Location id
|
||||||
|
|
@ -56,7 +57,7 @@ class Location implements \JsonSerializable, \Serializable
|
||||||
* @var string
|
* @var string
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
protected string $country = ISO3166TwoEnum::_USA;
|
protected string $country = ISO3166TwoEnum::_XXX;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Street & district.
|
* Street & district.
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\Stdlib\Queue;
|
namespace phpOMS\Stdlib\Queue;
|
||||||
|
|
||||||
|
use phpOMS\Contract\SerializableInterface;
|
||||||
use phpOMS\Stdlib\Base\Exception\InvalidEnumValue;
|
use phpOMS\Stdlib\Base\Exception\InvalidEnumValue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -24,7 +25,7 @@ use phpOMS\Stdlib\Base\Exception\InvalidEnumValue;
|
||||||
* @link https://karaka.app
|
* @link https://karaka.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
class PriorityQueue implements \Countable, \Serializable
|
class PriorityQueue implements \Countable, SerializableInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Queue type.
|
* Queue type.
|
||||||
|
|
|
||||||
|
|
@ -53,4 +53,6 @@ abstract class ExtensionType extends Enum
|
||||||
public const DIRECTORY = 2048;
|
public const DIRECTORY = 2048;
|
||||||
|
|
||||||
public const WORD = 4096;
|
public const WORD = 4096;
|
||||||
|
|
||||||
|
public const REFERENCE = 8192;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,8 @@ final class FileUtils
|
||||||
|
|
||||||
public const SYSTEM_EXTENSION = ['bak', 'dll', 'sys', 'tmp', 'msi', 'so', 'exe', 'bin', 'iso'];
|
public const SYSTEM_EXTENSION = ['bak', 'dll', 'sys', 'tmp', 'msi', 'so', 'exe', 'bin', 'iso'];
|
||||||
|
|
||||||
|
public const REFERENCE = ['reference'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
|
|
@ -93,6 +95,8 @@ final class FileUtils
|
||||||
return ExtensionType::SPREADSHEET;
|
return ExtensionType::SPREADSHEET;
|
||||||
} elseif (\in_array($extension, self::DIRECTORY)) {
|
} elseif (\in_array($extension, self::DIRECTORY)) {
|
||||||
return ExtensionType::DIRECTORY;
|
return ExtensionType::DIRECTORY;
|
||||||
|
} elseif (\in_array($extension, self::REFERENCE)) {
|
||||||
|
return ExtensionType::REFERENCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ExtensionType::UNKNOWN;
|
return ExtensionType::UNKNOWN;
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\Utils\Parser\Php;
|
namespace phpOMS\Utils\Parser\Php;
|
||||||
|
|
||||||
|
use phpOMS\Contract\SerializableInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Array parser class.
|
* Array parser class.
|
||||||
*
|
*
|
||||||
|
|
@ -77,7 +79,7 @@ class ArrayParser
|
||||||
return \rtrim(\rtrim(\number_format($value, 5, '.', ''), '0'), '.');
|
return \rtrim(\rtrim(\number_format($value, 5, '.', ''), '0'), '.');
|
||||||
} elseif (\is_scalar($value)) {
|
} elseif (\is_scalar($value)) {
|
||||||
return (string) $value;
|
return (string) $value;
|
||||||
} elseif ($value instanceof \Serializable) {
|
} elseif ($value instanceof SerializableInterface) {
|
||||||
return self::parseVariable($value->serialize());
|
return self::parseVariable($value->serialize());
|
||||||
} elseif ($value instanceof \JsonSerializable) {
|
} elseif ($value instanceof \JsonSerializable) {
|
||||||
return self::parseVariable($value->jsonSerialize());
|
return self::parseVariable($value->jsonSerialize());
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
||||||
namespace phpOMS\Utils;
|
namespace phpOMS\Utils;
|
||||||
|
|
||||||
use phpOMS\Contract\RenderableInterface;
|
use phpOMS\Contract\RenderableInterface;
|
||||||
|
use phpOMS\Contract\SerializableInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String utils class.
|
* String utils class.
|
||||||
|
|
@ -200,7 +201,7 @@ final class StringUtils
|
||||||
$encoded = \json_encode($element, $option !== null ? $option : 0);
|
$encoded = \json_encode($element, $option !== null ? $option : 0);
|
||||||
|
|
||||||
return $encoded ? $encoded : null;
|
return $encoded ? $encoded : null;
|
||||||
} elseif ($element instanceof \Serializable) {
|
} elseif ($element instanceof SerializableInterface) {
|
||||||
return $element->serialize();
|
return $element->serialize();
|
||||||
} elseif (\is_string($element)) {
|
} elseif (\is_string($element)) {
|
||||||
return $element;
|
return $element;
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\Utils\TaskSchedule;
|
namespace phpOMS\Utils\TaskSchedule;
|
||||||
|
|
||||||
|
use phpOMS\Contract\SerializableInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interval class for tasks.
|
* Interval class for tasks.
|
||||||
*
|
*
|
||||||
|
|
@ -22,7 +24,7 @@ namespace phpOMS\Utils\TaskSchedule;
|
||||||
* @link https://karaka.app
|
* @link https://karaka.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
class Interval implements \Serializable
|
class Interval implements SerializableInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Start of the task.
|
* Start of the task.
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,13 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\tests\DataStorage\Cache\Connection;
|
namespace phpOMS\tests\DataStorage\Cache\Connection;
|
||||||
|
|
||||||
class FileCacheSerializable implements \Serializable
|
use phpOMS\Contract\SerializableInterface;
|
||||||
|
|
||||||
|
class FileCacheSerializable implements SerializableInterface
|
||||||
{
|
{
|
||||||
public $val = 'asdf';
|
public $val = 'asdf';
|
||||||
|
|
||||||
public function serialize()
|
public function serialize() : string
|
||||||
{
|
{
|
||||||
return 'abc';
|
return 'abc';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\tests\DataStorage\Database\TestModel;
|
namespace phpOMS\tests\DataStorage\Database\TestModel;
|
||||||
|
|
||||||
|
use phpOMS\Contract\SerializableInterface;
|
||||||
|
|
||||||
class BaseModel
|
class BaseModel
|
||||||
{
|
{
|
||||||
protected int $id = 0;
|
protected int $id = 0;
|
||||||
|
|
@ -65,10 +67,10 @@ class BaseModel
|
||||||
$this->ownsOneSelf = new OwnsOneModel();
|
$this->ownsOneSelf = new OwnsOneModel();
|
||||||
$this->belongsToOne = new BelongsToModel();
|
$this->belongsToOne = new BelongsToModel();
|
||||||
|
|
||||||
$this->serializable = new class() implements \Serializable {
|
$this->serializable = new class() implements SerializableInterface {
|
||||||
public $value = '';
|
public $value = '';
|
||||||
|
|
||||||
public function serialize()
|
public function serialize() : string
|
||||||
{
|
{
|
||||||
return '123';
|
return '123';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ final class MoneyTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testMoneySerialization() : void
|
public function testMoneySerialization() : void
|
||||||
{
|
{
|
||||||
$money = new Money('999.23');
|
$money = new Money('999.23');
|
||||||
self::assertEquals(9992300, $money->__serialize());
|
self::assertEquals(9992300, $money->serialize());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -112,7 +112,7 @@ final class MoneyTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testMoneyUnserialization() : void
|
public function testMoneyUnserialization() : void
|
||||||
{
|
{
|
||||||
$money = new Money('999.23');
|
$money = new Money('999.23');
|
||||||
$money->__unserialize(3331234);
|
$money->unserialize(3331234);
|
||||||
self::assertEquals('333.12', $money->getAmount());
|
self::assertEquals('333.12', $money->getAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ final class DomTest extends \PHPUnit\Framework\TestCase
|
||||||
'selector' => '#sel',
|
'selector' => '#sel',
|
||||||
'action' => DomAction::SHOW,
|
'action' => DomAction::SHOW,
|
||||||
'content' => 'msg',
|
'content' => 'msg',
|
||||||
]), $obj->__serialize());
|
]), $obj->serialize());
|
||||||
|
|
||||||
self::assertEquals([
|
self::assertEquals([
|
||||||
'type' => 'dom',
|
'type' => 'dom',
|
||||||
|
|
@ -90,7 +90,7 @@ final class DomTest extends \PHPUnit\Framework\TestCase
|
||||||
], $obj->jsonSerialize());
|
], $obj->jsonSerialize());
|
||||||
|
|
||||||
$obj2 = new Dom();
|
$obj2 = new Dom();
|
||||||
$obj2->__unserialize($obj->__serialize());
|
$obj2->unserialize($obj->serialize());
|
||||||
self::assertEquals($obj, $obj2);
|
self::assertEquals($obj, $obj2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,11 +56,11 @@ final class FormValidationTest extends \PHPUnit\Framework\TestCase
|
||||||
$obj = new FormValidation($arr);
|
$obj = new FormValidation($arr);
|
||||||
|
|
||||||
self::assertEquals(['type' => 'validation', 'validation' => $arr], $obj->toArray());
|
self::assertEquals(['type' => 'validation', 'validation' => $arr], $obj->toArray());
|
||||||
self::assertEquals(\json_encode(['type' => 'validation', 'validation' => $arr]), $obj->__serialize());
|
self::assertEquals(\json_encode(['type' => 'validation', 'validation' => $arr]), $obj->serialize());
|
||||||
self::assertEquals(['type' => 'validation', 'validation' => $arr], $obj->jsonSerialize());
|
self::assertEquals(['type' => 'validation', 'validation' => $arr], $obj->jsonSerialize());
|
||||||
|
|
||||||
$obj2 = new FormValidation();
|
$obj2 = new FormValidation();
|
||||||
$obj2->__unserialize($obj->__serialize());
|
$obj2->unserialize($obj->serialize());
|
||||||
self::assertEquals($obj, $obj2);
|
self::assertEquals($obj, $obj2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ final class NotifyTest extends \PHPUnit\Framework\TestCase
|
||||||
'msg' => 'msg',
|
'msg' => 'msg',
|
||||||
'title' => 'title',
|
'title' => 'title',
|
||||||
'level' => NotifyType::ERROR,
|
'level' => NotifyType::ERROR,
|
||||||
]), $obj->__serialize());
|
]), $obj->serialize());
|
||||||
|
|
||||||
self::assertEquals([
|
self::assertEquals([
|
||||||
'type' => 'notify',
|
'type' => 'notify',
|
||||||
|
|
@ -96,7 +96,7 @@ final class NotifyTest extends \PHPUnit\Framework\TestCase
|
||||||
], $obj->jsonSerialize());
|
], $obj->jsonSerialize());
|
||||||
|
|
||||||
$obj2 = new Notify();
|
$obj2 = new Notify();
|
||||||
$obj2->__unserialize($obj->__serialize());
|
$obj2->unserialize($obj->serialize());
|
||||||
self::assertEquals($obj, $obj2);
|
self::assertEquals($obj, $obj2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ final class RedirectTest extends \PHPUnit\Framework\TestCase
|
||||||
$obj = new Redirect('url', true);
|
$obj = new Redirect('url', true);
|
||||||
|
|
||||||
self::assertEquals(['type' => 'redirect', 'time' => 0, 'uri' => 'url', 'new' => true], $obj->toArray());
|
self::assertEquals(['type' => 'redirect', 'time' => 0, 'uri' => 'url', 'new' => true], $obj->toArray());
|
||||||
self::assertEquals(\json_encode(['type' => 'redirect', 'time' => 0, 'uri' => 'url', 'new' => true]), $obj->__serialize());
|
self::assertEquals(\json_encode(['type' => 'redirect', 'time' => 0, 'uri' => 'url', 'new' => true]), $obj->serialize());
|
||||||
self::assertEquals(['type' => 'redirect', 'time' => 0, 'uri' => 'url', 'new' => true], $obj->jsonSerialize());
|
self::assertEquals(['type' => 'redirect', 'time' => 0, 'uri' => 'url', 'new' => true], $obj->jsonSerialize());
|
||||||
|
|
||||||
$obj->setDelay(6);
|
$obj->setDelay(6);
|
||||||
|
|
@ -67,7 +67,7 @@ final class RedirectTest extends \PHPUnit\Framework\TestCase
|
||||||
self::assertEquals(['type' => 'redirect', 'time' => 6, 'uri' => 'test', 'new' => true], $obj->toArray());
|
self::assertEquals(['type' => 'redirect', 'time' => 6, 'uri' => 'test', 'new' => true], $obj->toArray());
|
||||||
|
|
||||||
$obj2 = new Redirect();
|
$obj2 = new Redirect();
|
||||||
$obj2->__unserialize($obj->__serialize());
|
$obj2->unserialize($obj->serialize());
|
||||||
self::assertEquals($obj, $obj2);
|
self::assertEquals($obj, $obj2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,14 +55,14 @@ final class ReloadTest extends \PHPUnit\Framework\TestCase
|
||||||
$obj = new Reload(5);
|
$obj = new Reload(5);
|
||||||
|
|
||||||
self::assertEquals(['type' => 'reload', 'time' => 5], $obj->toArray());
|
self::assertEquals(['type' => 'reload', 'time' => 5], $obj->toArray());
|
||||||
self::assertEquals(\json_encode(['type' => 'reload', 'time' => 5]), $obj->__serialize());
|
self::assertEquals(\json_encode(['type' => 'reload', 'time' => 5]), $obj->serialize());
|
||||||
self::assertEquals(['type' => 'reload', 'time' => 5], $obj->jsonSerialize());
|
self::assertEquals(['type' => 'reload', 'time' => 5], $obj->jsonSerialize());
|
||||||
|
|
||||||
$obj->setDelay(6);
|
$obj->setDelay(6);
|
||||||
self::assertEquals(['type' => 'reload', 'time' => 6], $obj->toArray());
|
self::assertEquals(['type' => 'reload', 'time' => 6], $obj->toArray());
|
||||||
|
|
||||||
$obj2 = new Reload();
|
$obj2 = new Reload();
|
||||||
$obj2->__unserialize($obj->__serialize());
|
$obj2->unserialize($obj->serialize());
|
||||||
self::assertEquals($obj, $obj2);
|
self::assertEquals($obj, $obj2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,10 @@ final class IbanTest extends \PHPUnit\Framework\TestCase
|
||||||
$iban = new Iban($strRepresentation);
|
$iban = new Iban($strRepresentation);
|
||||||
|
|
||||||
self::assertEquals($strRepresentation, $iban->prettyPrint());
|
self::assertEquals($strRepresentation, $iban->prettyPrint());
|
||||||
self::assertEquals($strRepresentation, $iban->__serialize());
|
self::assertEquals($strRepresentation, $iban->serialize());
|
||||||
|
|
||||||
$iban->__unserialize('dE226008000009600280 00');
|
$iban->unserialize('dE226008000009600280 00');
|
||||||
self::assertEquals('DE22 6008 0000 0960 0280 00', $iban->__serialize());
|
self::assertEquals('DE22 6008 0000 0960 0280 00', $iban->serialize());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -215,7 +215,7 @@ final class LocationTest extends \PHPUnit\Framework\TestCase
|
||||||
$this->location->setGeo(['lat' => 12.1, 'long' => 11.2,]);
|
$this->location->setGeo(['lat' => 12.1, 'long' => 11.2,]);
|
||||||
|
|
||||||
self::assertEquals($expected, $this->location->jsonSerialize());
|
self::assertEquals($expected, $this->location->jsonSerialize());
|
||||||
self::assertEquals(\json_encode($this->location->jsonSerialize()), $this->location->__serialize());
|
self::assertEquals(\json_encode($this->location->jsonSerialize()), $this->location->serialize());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -237,7 +237,7 @@ final class LocationTest extends \PHPUnit\Framework\TestCase
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
$this->location->__unserialize(\json_encode($expected));
|
$this->location->unserialize(\json_encode($expected));
|
||||||
self::assertEquals(\json_encode($expected), $this->location->__serialize());
|
self::assertEquals(\json_encode($expected), $this->location->serialize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -187,9 +187,9 @@ final class PriorityQueueTest extends \PHPUnit\Framework\TestCase
|
||||||
$queue->insert('c', -1);
|
$queue->insert('c', -1);
|
||||||
|
|
||||||
$queue2 = new PriorityQueue();
|
$queue2 = new PriorityQueue();
|
||||||
$queue2->__unserialize($queue->__serialize());
|
$queue2->unserialize($queue->serialize());
|
||||||
|
|
||||||
self::assertEquals($queue->__serialize(), $queue2->__serialize());
|
self::assertEquals($queue->serialize(), $queue2->serialize());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace phpOMS\tests\Utils\Parser\Php;
|
namespace phpOMS\tests\Utils\Parser\Php;
|
||||||
|
|
||||||
|
use phpOMS\Contract\SerializableInterface;
|
||||||
use phpOMS\Utils\Parser\Php\ArrayParser;
|
use phpOMS\Utils\Parser\Php\ArrayParser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -30,8 +31,8 @@ final class ArrayParserTest extends \PHPUnit\Framework\TestCase
|
||||||
*/
|
*/
|
||||||
public function testParser() : void
|
public function testParser() : void
|
||||||
{
|
{
|
||||||
$serializable = new class() implements \Serializable {
|
$serializable = new class() implements SerializableInterface {
|
||||||
public function serialize() { return 2; }
|
public function serialize() : string { return '2'; }
|
||||||
|
|
||||||
public function unserialize($raw) : void {}
|
public function unserialize($raw) : void {}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
||||||
namespace phpOMS\tests\Utils;
|
namespace phpOMS\tests\Utils;
|
||||||
|
|
||||||
use phpOMS\Contract\RenderableInterface;
|
use phpOMS\Contract\RenderableInterface;
|
||||||
|
use phpOMS\Contract\SerializableInterface;
|
||||||
use phpOMS\Utils\StringUtils;
|
use phpOMS\Utils\StringUtils;
|
||||||
|
|
||||||
require_once __DIR__ . '/../Autoloader.php';
|
require_once __DIR__ . '/../Autoloader.php';
|
||||||
|
|
@ -130,8 +131,8 @@ final class StringUtilsTest extends \PHPUnit\Framework\TestCase
|
||||||
|
|
||||||
self::assertEquals('["abc"]', StringUtils::stringify(['abc']));
|
self::assertEquals('["abc"]', StringUtils::stringify(['abc']));
|
||||||
|
|
||||||
self::assertEquals('abc', StringUtils::stringify(new class() implements \Serializable {
|
self::assertEquals('abc', StringUtils::stringify(new class() implements SerializableInterface {
|
||||||
public function serialize()
|
public function serialize() : string
|
||||||
{
|
{
|
||||||
return 'abc';
|
return 'abc';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ final class IntervalTest extends \PHPUnit\Framework\TestCase
|
||||||
'dayOfMonth' => [],
|
'dayOfMonth' => [],
|
||||||
'dayOfWeek' => [],
|
'dayOfWeek' => [],
|
||||||
'year' => [],
|
'year' => [],
|
||||||
]), $interval->__serialize()
|
]), $interval->serialize()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -307,7 +307,7 @@ final class IntervalTest extends \PHPUnit\Framework\TestCase
|
||||||
'dayOfMonth' => [['start' => 1, 'end' => 3, 'step' => 2]],
|
'dayOfMonth' => [['start' => 1, 'end' => 3, 'step' => 2]],
|
||||||
'dayOfWeek' => [['start' => 1, 'end' => 3, 'step' => 2]],
|
'dayOfWeek' => [['start' => 1, 'end' => 3, 'step' => 2]],
|
||||||
'year' => [['start' => 1, 'end' => 3, 'step' => 2]],
|
'year' => [['start' => 1, 'end' => 3, 'step' => 2]],
|
||||||
]), $interval->__serialize());
|
]), $interval->serialize());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -327,7 +327,7 @@ final class IntervalTest extends \PHPUnit\Framework\TestCase
|
||||||
$interval->addDayOfMonth(1, 3, 2);
|
$interval->addDayOfMonth(1, 3, 2);
|
||||||
$interval->addDayOfWeek(1, 3, 2);
|
$interval->addDayOfWeek(1, 3, 2);
|
||||||
|
|
||||||
$interval2 = new Interval(null, $interval->__serialize());
|
$interval2 = new Interval(null, $interval->serialize());
|
||||||
|
|
||||||
self::assertEquals('2015-08-14', $interval2->getStart()->format('Y-m-d'));
|
self::assertEquals('2015-08-14', $interval2->getStart()->format('Y-m-d'));
|
||||||
self::assertEquals('2018-10-30', $interval2->getEnd()->format('Y-m-d'));
|
self::assertEquals('2018-10-30', $interval2->getEnd()->format('Y-m-d'));
|
||||||
|
|
|
||||||
|
|
@ -410,10 +410,10 @@ final class ViewTest extends \PHPUnit\Framework\TestCase
|
||||||
public function testSerialize() : void
|
public function testSerialize() : void
|
||||||
{
|
{
|
||||||
$view = new View();
|
$view = new View();
|
||||||
self::assertEquals('[]', $view->__serialize());
|
self::assertEquals('[]', $view->serialize());
|
||||||
|
|
||||||
$view->setTemplate('/phpOMS/tests/Views/testTemplate');
|
$view->setTemplate('/phpOMS/tests/Views/testTemplate');
|
||||||
self::assertEquals('<strong>Test</strong>', $view->__serialize());
|
self::assertEquals('<strong>Test</strong>', $view->serialize());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -476,7 +476,7 @@ final class ViewTest extends \PHPUnit\Framework\TestCase
|
||||||
$view = new View($this->app->l11nManager);
|
$view = new View($this->app->l11nManager);
|
||||||
$view->setTemplate('something.txt');
|
$view->setTemplate('something.txt');
|
||||||
|
|
||||||
self::assertEquals('', $view->__serialize());
|
self::assertEquals('', $view->serialize());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user