-
-
Notifications
You must be signed in to change notification settings - Fork 0
Wiki Data
final class \FireHub\Core\Support\LowLevel\Data()
Important
This class is marked as final.
Class contains variable handling methods.
This class was created by Danijel Galić <danijel.galic@outlook.com>
Copyright: 2024 FireHub Web Application Framework
License: <https://opensource.org/licenses/OSL-3.0> OSL Open Source License version 3
Version: GIT: $Id$ Blob checksum.
Fully Qualified Class Name: \FireHub\Core\Support\LowLevel\Data
Source code: view source code
Blame: view blame
History: view history
Type | Name | Title |
---|---|---|
public static | getType | ### Gets data type |
public static | setType | ### Sets data type |
public static | serializeValue | ### Generates storable representation of data |
public static | unserializeValue | ### Creates a PHP value from a stored representation |
public static Data::getType(mixed $value):\FireHub\Core\Support\Enums\Data\Type
Source code: view source code
Blame: view blame
- mixed $value - The variable being type checked.
- \Error - If a type of value is unknown.
- \FireHub\Core\Support\Enums\Data\Type - Type of data.
public static Data::setType(mixed $value, \FireHub\Core\Support\Enums\Data\Type $type):mixed
Source code: view source code
Blame: view blame
- mixed $value - The variable being converted to type.
- \FireHub\Core\Support\Enums\Data\Type $type - Type to convert variable to.
- \Error - If a type cannot be set to resource or failed to set a type for value.
- mixed - Converted value.
public static Data::serializeValue(string|int|float|bool|array|object|null $value):string
Warning
When serialize() serializes objects, the leading backslash is not included in the class name of namespaced classes for maximum compatibility.> [!NOTE] This is a binary string that may include null bytes and needs to be stored and handled as such. For example, serialize() output should generally be stored in a BLOB field in a database, rather than a CHAR or TEXT field.
Generates a storable representation of a value. This is useful for storing or passing PHP values around without losing their type and structure. To make the serialized string into a PHP value again, use unserialize().
Source code: view source code
Blame: view blame
- string or int or float or bool or array or object or null $value -
scalar|array<array-key, mixed>|object|null
The value to be serialized.
- \Error - If try to serialize anonymous class, function or resource.
- string - String containing a byte-stream representation of value that can be stored anywhere.
public static Data::unserializeValue(string $data, bool|array $allowed_classes = false, int $max_depth = 4096):mixed
Source code: view source code
Blame: view blame
- string $data -
non-empty-string
The serialized string. - bool or array $allowed_classes = false - [optional]
bool|array
Either an array of class names which should be accepted, false to accept no classes, or true to accept all classes. - int $max_depth = 4096 - [optional] The maximum depth of structures permitted during unserialization, and is intended to prevent stack overflows.
- \Error - $data is already false already or $data is NULL, or could not unserialize data.
- mixed - The converted value is returned.
Build with phpDocumentor using template FireHub phpDocumentor Wiki Template.