mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-06 03:50:04 +02:00
Update comments
This commit is contained in:
parent
91ac7ba018
commit
d7965a01b8
302 changed files with 56587 additions and 763 deletions
21
vendor/thecodingmachine/safe/LICENSE
vendored
Normal file
21
vendor/thecodingmachine/safe/LICENSE
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2018 TheCodingMachine
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
176
vendor/thecodingmachine/safe/README.md
vendored
Normal file
176
vendor/thecodingmachine/safe/README.md
vendored
Normal file
|
@ -0,0 +1,176 @@
|
|||
[](https://packagist.org/packages/thecodingmachine/safe)
|
||||
[](https://packagist.org/packages/thecodingmachine/safe)
|
||||
[](https://packagist.org/packages/thecodingmachine/safe)
|
||||
[](https://packagist.org/packages/thecodingmachine/safe)
|
||||
[](https://travis-ci.org/thecodingmachine/safe)
|
||||
[](https://github.com/thecodingmachine/safe/actions)
|
||||
[](https://codecov.io/gh/thecodingmachine/safe)
|
||||
|
||||
Safe PHP
|
||||
========
|
||||
|
||||
A set of core PHP functions rewritten to throw exceptions instead of returning `false` when an error is encountered.
|
||||
|
||||
## The problem
|
||||
|
||||
Most PHP core functions were written before exception handling was added to the language. Therefore, most PHP functions
|
||||
do not throw exceptions. Instead, they return `false` in case of error.
|
||||
|
||||
But most of us are too lazy to check explicitly for every single return of every core PHP function.
|
||||
|
||||
```php
|
||||
// This code is incorrect. Twice.
|
||||
// "file_get_contents" can return false if the file does not exist
|
||||
// "json_decode" can return false if the file content is not valid JSON
|
||||
$content = file_get_contents('foobar.json');
|
||||
$foobar = json_decode($content);
|
||||
```
|
||||
|
||||
The correct version of this code would be:
|
||||
|
||||
```php
|
||||
$content = file_get_contents('foobar.json');
|
||||
if ($content === false) {
|
||||
throw new FileLoadingException('Could not load file foobar.json');
|
||||
}
|
||||
$foobar = json_decode($content);
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
throw new FileLoadingException('foobar.json does not contain valid JSON: '.json_last_error_msg());
|
||||
}
|
||||
```
|
||||
|
||||
Obviously, while this snippet is correct, it is less easy to read.
|
||||
|
||||
## The solution
|
||||
|
||||
Enter *thecodingmachine/safe* aka Safe-PHP.
|
||||
|
||||
Safe-PHP redeclares all core PHP functions. The new PHP functions act exactly as the old ones, except they
|
||||
throw exceptions properly when an error is encountered. The "safe" functions have the same name as the core PHP
|
||||
functions, except they are in the `Safe` namespace.
|
||||
|
||||
```php
|
||||
use function Safe\file_get_contents;
|
||||
use function Safe\json_decode;
|
||||
|
||||
// This code is both safe and simple!
|
||||
$content = file_get_contents('foobar.json');
|
||||
$foobar = json_decode($content);
|
||||
```
|
||||
|
||||
All PHP functions that can return `false` on error are part of Safe.
|
||||
In addition, Safe also provide 2 'Safe' classes: `Safe\DateTime` and `Safe\DateTimeImmutable` whose methods will throw exceptions instead of returning false.
|
||||
|
||||
## PHPStan integration
|
||||
|
||||
> Yeah... but I must explicitly think about importing the "safe" variant of the function, for each and every file of my application.
|
||||
> I'm sure I will forget some "use function" statements!
|
||||
|
||||
Fear not! thecodingmachine/safe comes with a PHPStan rule.
|
||||
|
||||
Never heard of [PHPStan](https://github.com/phpstan/phpstan) before?
|
||||
Check it out, it's an amazing code analyzer for PHP.
|
||||
|
||||
Simply install the Safe rule in your PHPStan setup (explained in the "Installation" section) and PHPStan will let you know each time you are using an "unsafe" function.
|
||||
|
||||
The code below will trigger this warning:
|
||||
|
||||
```php
|
||||
$content = file_get_contents('foobar.json');
|
||||
```
|
||||
|
||||
> Function file_get_contents is unsafe to use. It can return FALSE instead of throwing an exception. Please add 'use function Safe\\file_get_contents;' at the beginning of the file to use the variant provided by the 'thecodingmachine/safe' library.
|
||||
|
||||
## Installation
|
||||
|
||||
Use composer to install Safe-PHP:
|
||||
|
||||
```bash
|
||||
$ composer require thecodingmachine/safe
|
||||
```
|
||||
|
||||
*Highly recommended*: install PHPStan and PHPStan extension:
|
||||
|
||||
```bash
|
||||
$ composer require --dev thecodingmachine/phpstan-safe-rule
|
||||
```
|
||||
|
||||
Now, edit your `phpstan.neon` file and add these rules:
|
||||
|
||||
```yml
|
||||
includes:
|
||||
- vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon
|
||||
```
|
||||
|
||||
## Automated refactoring
|
||||
|
||||
You have a large legacy codebase and want to use "Safe-PHP" functions throughout your project? PHPStan will help you
|
||||
find these functions but changing the namespace of the functions one function at a time might be a tedious task.
|
||||
|
||||
Fortunately, Safe comes bundled with a "Rector" configuration file. [Rector](https://github.com/rectorphp/rector) is a command-line
|
||||
tool that performs instant refactoring of your application.
|
||||
|
||||
Run
|
||||
|
||||
```bash
|
||||
$ composer require --dev rector/rector
|
||||
```
|
||||
|
||||
to install `rector/rector`.
|
||||
|
||||
Run
|
||||
|
||||
```bash
|
||||
vendor/bin/rector process src/ --config vendor/thecodingmachine/safe/rector-migrate.php
|
||||
```
|
||||
|
||||
to run `rector/rector`.
|
||||
|
||||
*Note:* do not forget to replace "src/" with the path to your source directory.
|
||||
|
||||
**Important:** the refactoring only performs a "dumb" replacement of functions. It will not modify the way
|
||||
"false" return values are handled. So if your code was already performing error handling, you will have to deal
|
||||
with it manually.
|
||||
|
||||
Especially, you should look for error handling that was already performed, like:
|
||||
|
||||
```php
|
||||
if (!mkdir($dirPath)) {
|
||||
// Do something on error
|
||||
}
|
||||
```
|
||||
|
||||
This code will be refactored by Rector to:
|
||||
|
||||
```php
|
||||
if (!\Safe\mkdir($dirPath)) {
|
||||
// Do something on error
|
||||
}
|
||||
```
|
||||
|
||||
You should then (manually) refactor it to:
|
||||
|
||||
```php
|
||||
try {
|
||||
\Safe\mkdir($dirPath));
|
||||
} catch (\Safe\FilesystemException $e) {
|
||||
// Do something on error
|
||||
}
|
||||
```
|
||||
|
||||
## Performance impact
|
||||
|
||||
Safe is loading 1000+ functions from ~85 files on each request. Yet, the performance impact of this loading is quite low.
|
||||
|
||||
In case you worry, using Safe will "cost" you ~700µs on each request. The [performance section](performance/README.md)
|
||||
contains more information regarding the way we tested the performance impact of Safe.
|
||||
|
||||
## Learn more
|
||||
|
||||
Read [the release article on TheCodingMachine's blog](https://thecodingmachine.io/introducing-safe-php) if you want to
|
||||
learn more about what triggered the development of Safe-PHP.
|
||||
|
||||
## Contributing
|
||||
|
||||
The files that contain all the functions are auto-generated from the PHP doc.
|
||||
Read the [CONTRIBUTING.md](CONTRIBUTING.md) file to learn how to regenerate these files and to contribute to this library.
|
123
vendor/thecodingmachine/safe/composer.json
vendored
Normal file
123
vendor/thecodingmachine/safe/composer.json
vendored
Normal file
|
@ -0,0 +1,123 @@
|
|||
{
|
||||
"name": "thecodingmachine/safe",
|
||||
"description": "PHP core functions that throw exceptions instead of returning FALSE on error",
|
||||
"license": "MIT",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"lib/DateTime.php",
|
||||
"lib/DateTimeImmutable.php",
|
||||
"lib/Exceptions/",
|
||||
"deprecated/Exceptions/",
|
||||
"generated/Exceptions/"
|
||||
],
|
||||
"files": [
|
||||
"deprecated/apc.php",
|
||||
"deprecated/array.php",
|
||||
"deprecated/datetime.php",
|
||||
"deprecated/libevent.php",
|
||||
"deprecated/misc.php",
|
||||
"deprecated/password.php",
|
||||
"deprecated/mssql.php",
|
||||
"deprecated/stats.php",
|
||||
"deprecated/strings.php",
|
||||
"lib/special_cases.php",
|
||||
"deprecated/mysqli.php",
|
||||
"generated/apache.php",
|
||||
"generated/apcu.php",
|
||||
"generated/array.php",
|
||||
"generated/bzip2.php",
|
||||
"generated/calendar.php",
|
||||
"generated/classobj.php",
|
||||
"generated/com.php",
|
||||
"generated/cubrid.php",
|
||||
"generated/curl.php",
|
||||
"generated/datetime.php",
|
||||
"generated/dir.php",
|
||||
"generated/eio.php",
|
||||
"generated/errorfunc.php",
|
||||
"generated/exec.php",
|
||||
"generated/fileinfo.php",
|
||||
"generated/filesystem.php",
|
||||
"generated/filter.php",
|
||||
"generated/fpm.php",
|
||||
"generated/ftp.php",
|
||||
"generated/funchand.php",
|
||||
"generated/gettext.php",
|
||||
"generated/gmp.php",
|
||||
"generated/gnupg.php",
|
||||
"generated/hash.php",
|
||||
"generated/ibase.php",
|
||||
"generated/ibmDb2.php",
|
||||
"generated/iconv.php",
|
||||
"generated/image.php",
|
||||
"generated/imap.php",
|
||||
"generated/info.php",
|
||||
"generated/inotify.php",
|
||||
"generated/json.php",
|
||||
"generated/ldap.php",
|
||||
"generated/libxml.php",
|
||||
"generated/lzf.php",
|
||||
"generated/mailparse.php",
|
||||
"generated/mbstring.php",
|
||||
"generated/misc.php",
|
||||
"generated/mysql.php",
|
||||
"generated/network.php",
|
||||
"generated/oci8.php",
|
||||
"generated/opcache.php",
|
||||
"generated/openssl.php",
|
||||
"generated/outcontrol.php",
|
||||
"generated/pcntl.php",
|
||||
"generated/pcre.php",
|
||||
"generated/pgsql.php",
|
||||
"generated/posix.php",
|
||||
"generated/ps.php",
|
||||
"generated/pspell.php",
|
||||
"generated/readline.php",
|
||||
"generated/rpminfo.php",
|
||||
"generated/rrd.php",
|
||||
"generated/sem.php",
|
||||
"generated/session.php",
|
||||
"generated/shmop.php",
|
||||
"generated/sockets.php",
|
||||
"generated/sodium.php",
|
||||
"generated/solr.php",
|
||||
"generated/spl.php",
|
||||
"generated/sqlsrv.php",
|
||||
"generated/ssdeep.php",
|
||||
"generated/ssh2.php",
|
||||
"generated/stream.php",
|
||||
"generated/strings.php",
|
||||
"generated/swoole.php",
|
||||
"generated/uodbc.php",
|
||||
"generated/uopz.php",
|
||||
"generated/url.php",
|
||||
"generated/var.php",
|
||||
"generated/xdiff.php",
|
||||
"generated/xml.php",
|
||||
"generated/xmlrpc.php",
|
||||
"generated/yaml.php",
|
||||
"generated/yaz.php",
|
||||
"generated/zip.php",
|
||||
"generated/zlib.php"
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": "^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "^1.5",
|
||||
"thecodingmachine/phpstan-strict-rules": "^1.0",
|
||||
"squizlabs/php_codesniffer": "^3.2",
|
||||
"phpunit/phpunit": "^9.5"
|
||||
},
|
||||
"scripts": {
|
||||
"phpstan": "phpstan analyse lib -c phpstan.neon --level=max --no-progress -vvv",
|
||||
"cs-fix": "phpcbf",
|
||||
"cs-check": "phpcs"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "2.2.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/deprecated/Exceptions/ApcException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/deprecated/Exceptions/ApcException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ApcException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/deprecated/Exceptions/LibeventException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/deprecated/Exceptions/LibeventException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class LibeventException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/deprecated/Exceptions/MssqlException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/deprecated/Exceptions/MssqlException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class MssqlException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/deprecated/Exceptions/MysqliException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/deprecated/Exceptions/MysqliException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class MysqliException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
15
vendor/thecodingmachine/safe/deprecated/Exceptions/PasswordException.php
vendored
Normal file
15
vendor/thecodingmachine/safe/deprecated/Exceptions/PasswordException.php
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
/**
|
||||
* @deprecated This exception is deprecated
|
||||
*/
|
||||
class PasswordException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/deprecated/Exceptions/StatsException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/deprecated/Exceptions/StatsException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class StatsException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
238
vendor/thecodingmachine/safe/deprecated/apc.php
vendored
Normal file
238
vendor/thecodingmachine/safe/deprecated/apc.php
vendored
Normal file
|
@ -0,0 +1,238 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\ApcException;
|
||||
|
||||
/**
|
||||
* Retrieves cached information and meta-data from APC's data store.
|
||||
*
|
||||
* @param string $cache_type If cache_type is "user",
|
||||
* information about the user cache will be returned.
|
||||
*
|
||||
* If cache_type is "filehits",
|
||||
* information about which files have been served from the bytecode cache
|
||||
* for the current request will be returned. This feature must be enabled at
|
||||
* compile time using --enable-filehits.
|
||||
*
|
||||
* If an invalid or no cache_type is specified, information about
|
||||
* the system cache (cached files) will be returned.
|
||||
* @param bool $limited If limited is TRUE, the
|
||||
* return value will exclude the individual list of cache entries. This
|
||||
* is useful when trying to optimize calls for statistics gathering.
|
||||
* @return array Array of cached data (and meta-data)
|
||||
* @throws ApcException
|
||||
*
|
||||
*/
|
||||
function apc_cache_info(string $cache_type = '', bool $limited = false): array
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \apc_cache_info($cache_type, $limited);
|
||||
if ($result === false) {
|
||||
throw ApcException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* apc_cas updates an already existing integer value if the
|
||||
* old parameter matches the currently stored value
|
||||
* with the value of the new parameter.
|
||||
*
|
||||
* @param string $key The key of the value being updated.
|
||||
* @param int $old The old value (the value currently stored).
|
||||
* @param int $new The new value to update to.
|
||||
* @throws ApcException
|
||||
*
|
||||
*/
|
||||
function apc_cas(string $key, int $old, int $new): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \apc_cas($key, $old, $new);
|
||||
if ($result === false) {
|
||||
throw ApcException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Stores a file in the bytecode cache, bypassing all filters.
|
||||
*
|
||||
* @param string $filename Full or relative path to a PHP file that will be compiled and stored in
|
||||
* the bytecode cache.
|
||||
* @param bool $atomic
|
||||
* @return mixed Returns TRUE on success.
|
||||
* @throws ApcException
|
||||
*
|
||||
*/
|
||||
function apc_compile_file(string $filename, bool $atomic = true)
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \apc_compile_file($filename, $atomic);
|
||||
if ($result === false) {
|
||||
throw ApcException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decreases a stored integer value.
|
||||
*
|
||||
* @param string $key The key of the value being decreased.
|
||||
* @param int $step The step, or value to decrease.
|
||||
* @param bool|null $success Optionally pass the success or fail boolean value to
|
||||
* this referenced variable.
|
||||
* @return int Returns the current value of key's value on success
|
||||
* @throws ApcException
|
||||
*
|
||||
*/
|
||||
function apc_dec(string $key, int $step = 1, ?bool &$success = null): int
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \apc_dec($key, $step, $success);
|
||||
if ($result === false) {
|
||||
throw ApcException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* define is notoriously slow. Since the main benefit of
|
||||
* APC is to increase the performance of scripts/applications, this mechanism
|
||||
* is provided to streamline the process of mass constant definition. However,
|
||||
* this function does not perform as well as anticipated.
|
||||
*
|
||||
* For a better-performing solution, try the
|
||||
* hidef extension from PECL.
|
||||
*
|
||||
* @param string $key The key serves as the name of the constant set
|
||||
* being stored. This key is used to retrieve the
|
||||
* stored constants in apc_load_constants.
|
||||
* @param array $constants An associative array of constant_name => value
|
||||
* pairs. The constant_name must follow the normal
|
||||
* constant naming rules.
|
||||
* value must evaluate to a scalar value.
|
||||
* @param bool $case_sensitive The default behaviour for constants is to be declared case-sensitive;
|
||||
* i.e. CONSTANT and Constant
|
||||
* represent different values. If this parameter evaluates to FALSE the
|
||||
* constants will be declared as case-insensitive symbols.
|
||||
* @throws ApcException
|
||||
*
|
||||
*/
|
||||
function apc_define_constants(string $key, array $constants, bool $case_sensitive = true): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \apc_define_constants($key, $constants, $case_sensitive);
|
||||
if ($result === false) {
|
||||
throw ApcException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Deletes the given files from the opcode cache.
|
||||
*
|
||||
* @param mixed $keys The files to be deleted. Accepts a string,
|
||||
* array of strings, or an APCIterator
|
||||
* object.
|
||||
* @return mixed Returns TRUE on success.
|
||||
* Or if keys is an array, then
|
||||
* an empty array is returned on success, or an array of failed files
|
||||
* is returned.
|
||||
* @throws ApcException
|
||||
*
|
||||
*/
|
||||
function apc_delete_file($keys)
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \apc_delete_file($keys);
|
||||
if ($result === false) {
|
||||
throw ApcException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes a stored variable from the cache.
|
||||
*
|
||||
* @param string|string[]|\APCIterator $key The key used to store the value (with
|
||||
* apc_store).
|
||||
* @throws ApcException
|
||||
*
|
||||
*/
|
||||
function apc_delete($key): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \apc_delete($key);
|
||||
if ($result === false) {
|
||||
throw ApcException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Increases a stored number.
|
||||
*
|
||||
* @param string $key The key of the value being increased.
|
||||
* @param int $step The step, or value to increase.
|
||||
* @param bool|null $success Optionally pass the success or fail boolean value to
|
||||
* this referenced variable.
|
||||
* @return int Returns the current value of key's value on success
|
||||
* @throws ApcException
|
||||
*
|
||||
*/
|
||||
function apc_inc(string $key, int $step = 1, ?bool &$success = null): int
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \apc_inc($key, $step, $success);
|
||||
if ($result === false) {
|
||||
throw ApcException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Loads a set of constants from the cache.
|
||||
*
|
||||
* @param string $key The name of the constant set (that was stored with
|
||||
* apc_define_constants) to be retrieved.
|
||||
* @param bool $case_sensitive The default behaviour for constants is to be declared case-sensitive;
|
||||
* i.e. CONSTANT and Constant
|
||||
* represent different values. If this parameter evaluates to FALSE the
|
||||
* constants will be declared as case-insensitive symbols.
|
||||
* @throws ApcException
|
||||
*
|
||||
*/
|
||||
function apc_load_constants(string $key, bool $case_sensitive = true): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \apc_load_constants($key, $case_sensitive);
|
||||
if ($result === false) {
|
||||
throw ApcException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves APC's Shared Memory Allocation information.
|
||||
*
|
||||
* @param bool $limited When set to FALSE (default) apc_sma_info will
|
||||
* return a detailed information about each segment.
|
||||
* @return array Array of Shared Memory Allocation data; FALSE on failure.
|
||||
* @throws ApcException
|
||||
*
|
||||
*/
|
||||
function apc_sma_info(bool $limited = false): array
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \apc_sma_info($limited);
|
||||
if ($result === false) {
|
||||
throw ApcException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
301
vendor/thecodingmachine/safe/deprecated/array.php
vendored
Normal file
301
vendor/thecodingmachine/safe/deprecated/array.php
vendored
Normal file
|
@ -0,0 +1,301 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\ArrayException;
|
||||
|
||||
/**
|
||||
* array_replace_recursive replaces the values of
|
||||
* array with the same values from all the following
|
||||
* arrays. If a key from the first array exists in the second array, its value
|
||||
* will be replaced by the value from the second array. If the key exists in the
|
||||
* second array, and not the first, it will be created in the first array.
|
||||
* If a key only exists in the first array, it will be left as is.
|
||||
* If several arrays are passed for replacement, they will be processed
|
||||
* in order, the later array overwriting the previous values.
|
||||
*
|
||||
* array_replace_recursive is recursive : it will recurse into
|
||||
* arrays and apply the same process to the inner value.
|
||||
*
|
||||
* When the value in the first array is scalar, it will be replaced
|
||||
* by the value in the second array, may it be scalar or array.
|
||||
* When the value in the first array and the second array
|
||||
* are both arrays, array_replace_recursive will replace
|
||||
* their respective value recursively.
|
||||
*
|
||||
* @param array $array The array in which elements are replaced.
|
||||
* @param array $replacements Arrays from which elements will be extracted.
|
||||
* @return array Returns an array.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function array_replace_recursive(array $array, array ...$replacements): array
|
||||
{
|
||||
error_clear_last();
|
||||
if ($replacements !== []) {
|
||||
$result = \array_replace_recursive($array, ...$replacements);
|
||||
} else {
|
||||
$result = \array_replace_recursive($array);
|
||||
}
|
||||
if ($result === null) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* array_replace replaces the values of
|
||||
* array with values having the same keys in each of the following
|
||||
* arrays. If a key from the first array exists in the second array, its value
|
||||
* will be replaced by the value from the second array. If the key exists in the
|
||||
* second array, and not the first, it will be created in the first array.
|
||||
* If a key only exists in the first array, it will be left as is.
|
||||
* If several arrays are passed for replacement, they will be processed
|
||||
* in order, the later arrays overwriting the previous values.
|
||||
*
|
||||
* array_replace is not recursive : it will replace
|
||||
* values in the first array by whatever type is in the second array.
|
||||
*
|
||||
* @param array $array The array in which elements are replaced.
|
||||
* @param array $replacements Arrays from which elements will be extracted.
|
||||
* Values from later arrays overwrite the previous values.
|
||||
* @return array Returns an array.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function array_replace(array $array, array ...$replacements): array
|
||||
{
|
||||
error_clear_last();
|
||||
if ($replacements !== []) {
|
||||
$result = \array_replace($array, ...$replacements);
|
||||
} else {
|
||||
$result = \array_replace($array);
|
||||
}
|
||||
if ($result === null) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* array_flip returns an array in flip
|
||||
* order, i.e. keys from array become values and values
|
||||
* from array become keys.
|
||||
*
|
||||
* Note that the values of array need to be valid
|
||||
* keys, i.e. they need to be either integer or
|
||||
* string. A warning will be emitted if a value has the wrong
|
||||
* type, and the key/value pair in question will not be included
|
||||
* in the result.
|
||||
*
|
||||
* If a value has several occurrences, the latest key will be
|
||||
* used as its value, and all others will be lost.
|
||||
*
|
||||
* @param array $array An array of key/value pairs to be flipped.
|
||||
* @return array Returns the flipped array on success.
|
||||
* @throws ArrayException
|
||||
* @deprecated The Safe version of this function is no longer needed in PHP 8.0+
|
||||
*
|
||||
*/
|
||||
function array_flip(array $array): array
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \array_flip($array);
|
||||
if ($result === null) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function sorts an array such that array indices maintain their
|
||||
* correlation with the array elements they are associated with.
|
||||
*
|
||||
* This is used mainly when sorting associative arrays where the actual
|
||||
* element order is significant.
|
||||
*
|
||||
* @param array $array The input array.
|
||||
* @param int $sort_flags You may modify the behavior of the sort using the optional parameter
|
||||
* sort_flags, for details see
|
||||
* sort.
|
||||
* @throws ArrayException
|
||||
* @deprecated The Safe version of this function is no longer needed in PHP 8.0+
|
||||
*
|
||||
*/
|
||||
function arsort(array &$array, int $sort_flags = SORT_REGULAR): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \arsort($array, $sort_flags);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function sorts an array such that array indices maintain
|
||||
* their correlation with the array elements they are associated
|
||||
* with. This is used mainly when sorting associative arrays where
|
||||
* the actual element order is significant.
|
||||
*
|
||||
* @param array $array The input array.
|
||||
* @param int $sort_flags You may modify the behavior of the sort using the optional
|
||||
* parameter sort_flags, for details
|
||||
* see sort.
|
||||
* @throws ArrayException
|
||||
* @deprecated The Safe version of this function is no longer needed in PHP 8.0+
|
||||
*/
|
||||
function asort(array &$array, int $sort_flags = SORT_REGULAR): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \asort($array, $sort_flags);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts an array by key in reverse order, maintaining key to data
|
||||
* correlations. This is useful mainly for associative arrays.
|
||||
*
|
||||
* @param array $array The input array.
|
||||
* @param int $sort_flags You may modify the behavior of the sort using the optional parameter
|
||||
* sort_flags, for details see
|
||||
* sort.
|
||||
* @throws ArrayException
|
||||
* @deprecated The Safe version of this function is no longer needed in PHP 8.0+
|
||||
*
|
||||
*/
|
||||
function krsort(array &$array, int $sort_flags = SORT_REGULAR): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \krsort($array, $sort_flags);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts an array by key, maintaining key to data correlations. This is
|
||||
* useful mainly for associative arrays.
|
||||
*
|
||||
* @param array $array The input array.
|
||||
* @param int $sort_flags You may modify the behavior of the sort using the optional
|
||||
* parameter sort_flags, for details
|
||||
* see sort.
|
||||
* @throws ArrayException
|
||||
* @deprecated The Safe version of this function is no longer needed in PHP 8.0+
|
||||
*
|
||||
*/
|
||||
function ksort(array &$array, int $sort_flags = SORT_REGULAR): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ksort($array, $sort_flags);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function sorts an array. Elements will be arranged from
|
||||
* lowest to highest when this function has completed.
|
||||
*
|
||||
* @param array $array The input array.
|
||||
* @param int $sort_flags The optional second parameter sort_flags
|
||||
* may be used to modify the sorting behavior using these values:
|
||||
*
|
||||
* Sorting type flags:
|
||||
*
|
||||
*
|
||||
* SORT_REGULAR - compare items normally;
|
||||
* the details are described in the comparison operators section
|
||||
*
|
||||
*
|
||||
* SORT_NUMERIC - compare items numerically
|
||||
*
|
||||
*
|
||||
* SORT_STRING - compare items as strings
|
||||
*
|
||||
*
|
||||
*
|
||||
* SORT_LOCALE_STRING - compare items as
|
||||
* strings, based on the current locale. It uses the locale,
|
||||
* which can be changed using setlocale
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* SORT_NATURAL - compare items as strings
|
||||
* using "natural ordering" like natsort
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* SORT_FLAG_CASE - can be combined
|
||||
* (bitwise OR) with
|
||||
* SORT_STRING or
|
||||
* SORT_NATURAL to sort strings case-insensitively
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ArrayException
|
||||
* @deprecated The Safe version of this function is no longer needed in PHP 8.0+
|
||||
*/
|
||||
function sort(array &$array, int $sort_flags = SORT_REGULAR): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \sort($array, $sort_flags);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will sort an array by its values using a user-supplied
|
||||
* comparison function. If the array you wish to sort needs to be sorted by
|
||||
* some non-trivial criteria, you should use this function.
|
||||
*
|
||||
* @param array $array The input array.
|
||||
* @param callable $value_compare_func The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
|
||||
* Note that before PHP 7.0.0 this integer had to be in the range from -2147483648 to 2147483647.
|
||||
*
|
||||
* Returning non-integer values from the comparison
|
||||
* function, such as float, will result in an internal cast to
|
||||
* integer of the callback's return value. So values such as
|
||||
* 0.99 and 0.1 will both be cast to an integer value of 0, which will
|
||||
* compare such values as equal.
|
||||
* @throws ArrayException
|
||||
* @deprecated The Safe version of this function is no longer needed in PHP 8.0+
|
||||
*
|
||||
*/
|
||||
function usort(array &$array, callable $value_compare_func): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \usort($array, $value_compare_func);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an array by using the values from the
|
||||
* keys array as keys and the values from the
|
||||
* values array as the corresponding values.
|
||||
*
|
||||
* @param array $keys Array of keys to be used. Illegal values for key will be
|
||||
* converted to string.
|
||||
* @param array $values Array of values to be used
|
||||
* @return array Returns the combined array, FALSE if the number of elements
|
||||
* for each array isn't equal.
|
||||
* @throws ArrayException
|
||||
* @deprecated
|
||||
*
|
||||
*/
|
||||
function array_combine(array $keys, array $values): array
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \array_combine($keys, $values);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
98
vendor/thecodingmachine/safe/deprecated/datetime.php
vendored
Normal file
98
vendor/thecodingmachine/safe/deprecated/datetime.php
vendored
Normal file
|
@ -0,0 +1,98 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\DatetimeException;
|
||||
|
||||
/**
|
||||
* Identical to the date function except that
|
||||
* the time returned is Greenwich Mean Time (GMT).
|
||||
*
|
||||
* @param string $format The format of the outputted date string. See the formatting
|
||||
* options for the date function.
|
||||
* @param int $timestamp The optional timestamp parameter is an
|
||||
* integer Unix timestamp that defaults to the current
|
||||
* local time if a timestamp is not given. In other
|
||||
* words, it defaults to the value of time.
|
||||
* @return string Returns a formatted date string. If a non-numeric value is used for
|
||||
* timestamp, FALSE is returned and an
|
||||
* E_WARNING level error is emitted.
|
||||
* @throws DatetimeException
|
||||
* @deprecated The Safe version of this function is no longer needed in PHP 8.0+
|
||||
*
|
||||
*/
|
||||
function gmdate(string $format, int $timestamp = null): string
|
||||
{
|
||||
error_clear_last();
|
||||
if ($timestamp !== null) {
|
||||
$result = \gmdate($format, $timestamp);
|
||||
} else {
|
||||
$result = \gmdate($format);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw DatetimeException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Unix timestamp corresponding to the arguments
|
||||
* given. This timestamp is a long integer containing the number of
|
||||
* seconds between the Unix Epoch (January 1 1970 00:00:00 GMT) and the time
|
||||
* specified.
|
||||
*
|
||||
* Arguments may be left out in order from right to left; any
|
||||
* arguments thus omitted will be set to the current value according
|
||||
* to the local date and time.
|
||||
*
|
||||
* @param int $hour The number of the hour relative to the start of the day determined by
|
||||
* month, day and year.
|
||||
* Negative values reference the hour before midnight of the day in question.
|
||||
* Values greater than 23 reference the appropriate hour in the following day(s).
|
||||
* @param int $minute The number of the minute relative to the start of the hour.
|
||||
* Negative values reference the minute in the previous hour.
|
||||
* Values greater than 59 reference the appropriate minute in the following hour(s).
|
||||
* @param int $second The number of seconds relative to the start of the minute.
|
||||
* Negative values reference the second in the previous minute.
|
||||
* Values greater than 59 reference the appropriate second in the following minute(s).
|
||||
* @param int $month The number of the month relative to the end of the previous year.
|
||||
* Values 1 to 12 reference the normal calendar months of the year in question.
|
||||
* Values less than 1 (including negative values) reference the months in the previous year in reverse order, so 0 is December, -1 is November, etc.
|
||||
* Values greater than 12 reference the appropriate month in the following year(s).
|
||||
* @param int $day The number of the day relative to the end of the previous month.
|
||||
* Values 1 to 28, 29, 30 or 31 (depending upon the month) reference the normal days in the relevant month.
|
||||
* Values less than 1 (including negative values) reference the days in the previous month, so 0 is the last day of the previous month, -1 is the day before that, etc.
|
||||
* Values greater than the number of days in the relevant month reference the appropriate day in the following month(s).
|
||||
* @param int $year The number of the year, may be a two or four digit value,
|
||||
* with values between 0-69 mapping to 2000-2069 and 70-100 to
|
||||
* 1970-2000. On systems where time_t is a 32bit signed integer, as
|
||||
* most common today, the valid range for year
|
||||
* is somewhere between 1901 and 2038.
|
||||
* @return int mktime returns the Unix timestamp of the arguments
|
||||
* given.
|
||||
* If the arguments are invalid, the function returns FALSE.
|
||||
* @throws DatetimeException
|
||||
* @deprecated The Safe version of this function is no longer needed in PHP 8.0+
|
||||
*
|
||||
*/
|
||||
function mktime(int $hour, int $minute = null, int $second = null, int $month = null, int $day = null, int $year = null): int
|
||||
{
|
||||
error_clear_last();
|
||||
if ($year !== null) {
|
||||
$safeResult = \mktime($hour, $minute, $second, $month, $day, $year);
|
||||
} elseif ($day !== null) {
|
||||
$safeResult = \mktime($hour, $minute, $second, $month, $day);
|
||||
} elseif ($month !== null) {
|
||||
$safeResult = \mktime($hour, $minute, $second, $month);
|
||||
} elseif ($second !== null) {
|
||||
$safeResult = \mktime($hour, $minute, $second);
|
||||
} elseif ($minute !== null) {
|
||||
$safeResult = \mktime($hour, $minute);
|
||||
} else {
|
||||
$safeResult = \mktime($hour);
|
||||
}
|
||||
if ($safeResult === false) {
|
||||
throw DatetimeException::createFromPhpError();
|
||||
}
|
||||
return $safeResult;
|
||||
}
|
73
vendor/thecodingmachine/safe/deprecated/functionsList.php
vendored
Normal file
73
vendor/thecodingmachine/safe/deprecated/functionsList.php
vendored
Normal file
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'apc_cache_info',
|
||||
'apc_cas',
|
||||
'apc_compile_file',
|
||||
'apc_dec',
|
||||
'apc_define_constants',
|
||||
'apc_delete',
|
||||
'apc_delete_file',
|
||||
'apc_inc',
|
||||
'apc_load_constants',
|
||||
'apc_sma_info',
|
||||
'arsort',
|
||||
'array_replace',
|
||||
'array_replace_recursive',
|
||||
'array_combine',
|
||||
'array_flip',
|
||||
'asort',
|
||||
'event_add',
|
||||
'event_base_loopbreak',
|
||||
'event_base_loopexit',
|
||||
'event_base_new',
|
||||
'event_base_priority_init',
|
||||
'event_base_reinit',
|
||||
'event_base_set',
|
||||
'event_buffer_base_set',
|
||||
'event_buffer_disable',
|
||||
'event_buffer_enable',
|
||||
'event_buffer_new',
|
||||
'event_buffer_priority_set',
|
||||
'event_buffer_set_callback',
|
||||
'event_buffer_write',
|
||||
'event_del',
|
||||
'event_new',
|
||||
'event_priority_set',
|
||||
'event_set',
|
||||
'event_timer_set',
|
||||
'gmdate',
|
||||
'imagepsencodefont',
|
||||
'imagepsextendfont',
|
||||
'imagepsfreefont',
|
||||
'imagepsslantfont',
|
||||
'krsort',
|
||||
'ksort',
|
||||
'mktime',
|
||||
'mssql_bind',
|
||||
'mssql_close',
|
||||
'mssql_connect',
|
||||
'mssql_data_seek',
|
||||
'mssql_field_length',
|
||||
'mssql_field_name',
|
||||
'mssql_field_seek',
|
||||
'mssql_field_type',
|
||||
'mssql_free_result',
|
||||
'mssql_free_statement',
|
||||
'mssql_init',
|
||||
'mssql_pconnect',
|
||||
'mssql_query',
|
||||
'mssql_select_db',
|
||||
'mysqli_get_client_stats',
|
||||
'password_hash',
|
||||
'sort',
|
||||
'stats_covariance',
|
||||
'stats_standard_deviation',
|
||||
'stats_stat_correlation',
|
||||
'stats_stat_innerproduct',
|
||||
'stats_variance',
|
||||
'sleep',
|
||||
'substr',
|
||||
'usort',
|
||||
'vsprintf',
|
||||
];
|
496
vendor/thecodingmachine/safe/deprecated/libevent.php
vendored
Normal file
496
vendor/thecodingmachine/safe/deprecated/libevent.php
vendored
Normal file
|
@ -0,0 +1,496 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\LibeventException;
|
||||
|
||||
/**
|
||||
* event_add schedules the execution of the event
|
||||
* when the event specified in event_set occurs or in at least the time
|
||||
* specified by the timeout argument. If
|
||||
* timeout was not specified, not timeout is set. The
|
||||
* event must be already initalized by event_set
|
||||
* and event_base_set functions. If the
|
||||
* event already has a timeout set, it is replaced by
|
||||
* the new one.
|
||||
*
|
||||
* @param resource $event Valid event resource.
|
||||
* @param int $timeout Optional timeout (in microseconds).
|
||||
* @throws LibeventException
|
||||
*
|
||||
*/
|
||||
function event_add($event, int $timeout = -1): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \event_add($event, $timeout);
|
||||
if ($result === false) {
|
||||
throw LibeventException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Abort the active event loop immediately. The behaviour is similar to
|
||||
* break statement.
|
||||
*
|
||||
* @param resource $event_base Valid event base resource.
|
||||
* @throws LibeventException
|
||||
*
|
||||
*/
|
||||
function event_base_loopbreak($event_base): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \event_base_loopbreak($event_base);
|
||||
if ($result === false) {
|
||||
throw LibeventException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The next event loop iteration after the given timer expires will complete
|
||||
* normally, then exit without blocking for events again.
|
||||
*
|
||||
* @param resource $event_base Valid event base resource.
|
||||
* @param int $timeout Optional timeout parameter (in microseconds).
|
||||
* @throws LibeventException
|
||||
*
|
||||
*/
|
||||
function event_base_loopexit($event_base, int $timeout = -1): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \event_base_loopexit($event_base, $timeout);
|
||||
if ($result === false) {
|
||||
throw LibeventException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns new event base, which can be used later in event_base_set,
|
||||
* event_base_loop and other functions.
|
||||
*
|
||||
* @return resource event_base_new returns valid event base resource on
|
||||
* success.
|
||||
* @throws LibeventException
|
||||
*
|
||||
*/
|
||||
function event_base_new()
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \event_base_new();
|
||||
if ($result === false) {
|
||||
throw LibeventException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the number of different event priority levels.
|
||||
*
|
||||
* By default all events are scheduled with the same priority
|
||||
* (npriorities/2).
|
||||
* Using event_base_priority_init you can change the number
|
||||
* of event priority levels and then set a desired priority for each event.
|
||||
*
|
||||
* @param resource $event_base Valid event base resource.
|
||||
* @param int $npriorities The number of event priority levels.
|
||||
* @throws LibeventException
|
||||
*
|
||||
*/
|
||||
function event_base_priority_init($event_base, int $npriorities): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \event_base_priority_init($event_base, $npriorities);
|
||||
if ($result === false) {
|
||||
throw LibeventException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Some event mechanisms do not survive across fork. The
|
||||
* event_base needs to be reinitialized with this
|
||||
* function.
|
||||
*
|
||||
* @param resource $event_base Valid event base resource that needs to be re-initialized.
|
||||
* @throws LibeventException
|
||||
*
|
||||
*/
|
||||
function event_base_reinit($event_base): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \event_base_reinit($event_base);
|
||||
if ($result === false) {
|
||||
throw LibeventException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associates the event_base with the
|
||||
* event.
|
||||
*
|
||||
* @param resource $event Valid event resource.
|
||||
* @param resource $event_base Valid event base resource.
|
||||
* @throws LibeventException
|
||||
*
|
||||
*/
|
||||
function event_base_set($event, $event_base): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \event_base_set($event, $event_base);
|
||||
if ($result === false) {
|
||||
throw LibeventException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Assign the specified bevent to the
|
||||
* event_base.
|
||||
*
|
||||
* @param resource $bevent Valid buffered event resource.
|
||||
* @param resource $event_base Valid event base resource.
|
||||
* @throws LibeventException
|
||||
*
|
||||
*/
|
||||
function event_buffer_base_set($bevent, $event_base): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \event_buffer_base_set($bevent, $event_base);
|
||||
if ($result === false) {
|
||||
throw LibeventException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Disables the specified buffered event.
|
||||
*
|
||||
* @param resource $bevent Valid buffered event resource.
|
||||
* @param int $events Any combination of EV_READ and
|
||||
* EV_WRITE.
|
||||
* @throws LibeventException
|
||||
*
|
||||
*/
|
||||
function event_buffer_disable($bevent, int $events): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \event_buffer_disable($bevent, $events);
|
||||
if ($result === false) {
|
||||
throw LibeventException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Enables the specified buffered event.
|
||||
*
|
||||
* @param resource $bevent Valid buffered event resource.
|
||||
* @param int $events Any combination of EV_READ and
|
||||
* EV_WRITE.
|
||||
* @throws LibeventException
|
||||
*
|
||||
*/
|
||||
function event_buffer_enable($bevent, int $events): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \event_buffer_enable($bevent, $events);
|
||||
if ($result === false) {
|
||||
throw LibeventException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Libevent provides an abstraction layer on top of the regular event API.
|
||||
* Using buffered event you don't need to deal with the I/O manually, instead
|
||||
* it provides input and output buffers that get filled and drained
|
||||
* automatically.
|
||||
*
|
||||
* @param resource $stream Valid PHP stream resource. Must be castable to file descriptor.
|
||||
* @param mixed $readcb Callback to invoke where there is data to read, or NULL if
|
||||
* no callback is desired.
|
||||
* @param mixed $writecb Callback to invoke where the descriptor is ready for writing,
|
||||
* or NULL if no callback is desired.
|
||||
* @param mixed $errorcb Callback to invoke where there is an error on the descriptor, cannot be
|
||||
* NULL.
|
||||
* @param mixed $arg An argument that will be passed to each of the callbacks (optional).
|
||||
* @return resource event_buffer_new returns new buffered event resource
|
||||
* on success.
|
||||
* @throws LibeventException
|
||||
*
|
||||
*/
|
||||
function event_buffer_new($stream, $readcb, $writecb, $errorcb, $arg = null)
|
||||
{
|
||||
error_clear_last();
|
||||
if ($arg !== null) {
|
||||
$result = \event_buffer_new($stream, $readcb, $writecb, $errorcb, $arg);
|
||||
} else {
|
||||
$result = \event_buffer_new($stream, $readcb, $writecb, $errorcb);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw LibeventException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Assign a priority to the bevent.
|
||||
*
|
||||
* @param resource $bevent Valid buffered event resource.
|
||||
* @param int $priority Priority level. Cannot be less than zero and cannot exceed maximum
|
||||
* priority level of the event base (see event_base_priority_init).
|
||||
* @throws LibeventException
|
||||
*
|
||||
*/
|
||||
function event_buffer_priority_set($bevent, int $priority): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \event_buffer_priority_set($bevent, $priority);
|
||||
if ($result === false) {
|
||||
throw LibeventException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets or changes existing callbacks for the buffered event.
|
||||
*
|
||||
* @param resource $event Valid buffered event resource.
|
||||
* @param mixed $readcb Callback to invoke where there is data to read, or NULL if
|
||||
* no callback is desired.
|
||||
* @param mixed $writecb Callback to invoke where the descriptor is ready for writing,
|
||||
* or NULL if no callback is desired.
|
||||
* @param mixed $errorcb Callback to invoke where there is an error on the descriptor, cannot be
|
||||
* NULL.
|
||||
* @param mixed $arg An argument that will be passed to each of the callbacks (optional).
|
||||
* @throws LibeventException
|
||||
*
|
||||
*/
|
||||
function event_buffer_set_callback($event, $readcb, $writecb, $errorcb, $arg = null): void
|
||||
{
|
||||
error_clear_last();
|
||||
if ($arg !== null) {
|
||||
$result = \event_buffer_set_callback($event, $readcb, $writecb, $errorcb, $arg);
|
||||
} else {
|
||||
$result = \event_buffer_set_callback($event, $readcb, $writecb, $errorcb);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw LibeventException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Writes data to the specified buffered event. The data is appended to the
|
||||
* output buffer and written to the descriptor when it becomes available for
|
||||
* writing.
|
||||
*
|
||||
* @param resource $bevent Valid buffered event resource.
|
||||
* @param string $data The data to be written.
|
||||
* @param int $data_size Optional size parameter. event_buffer_write writes
|
||||
* all the data by default.
|
||||
* @throws LibeventException
|
||||
*
|
||||
*/
|
||||
function event_buffer_write($bevent, string $data, int $data_size = -1): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \event_buffer_write($bevent, $data, $data_size);
|
||||
if ($result === false) {
|
||||
throw LibeventException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cancels the event.
|
||||
*
|
||||
* @param resource $event Valid event resource.
|
||||
* @throws LibeventException
|
||||
*
|
||||
*/
|
||||
function event_del($event): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \event_del($event);
|
||||
if ($result === false) {
|
||||
throw LibeventException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates and returns a new event resource.
|
||||
*
|
||||
* @return resource event_new returns a new event resource on success.
|
||||
* @throws LibeventException
|
||||
*
|
||||
*/
|
||||
function event_new()
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \event_new();
|
||||
if ($result === false) {
|
||||
throw LibeventException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Assign a priority to the event.
|
||||
*
|
||||
* @param resource $event Valid event resource.
|
||||
* @param int $priority Priority level. Cannot be less than zero and cannot exceed maximum
|
||||
* priority level of the event base (see
|
||||
* event_base_priority_init).
|
||||
* @throws LibeventException
|
||||
*
|
||||
*/
|
||||
function event_priority_set($event, int $priority): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \event_priority_set($event, $priority);
|
||||
if ($result === false) {
|
||||
throw LibeventException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prepares the event to be used in event_add. The event
|
||||
* is prepared to call the function specified by the callback
|
||||
* on the events specified in parameter events, which
|
||||
* is a set of the following flags: EV_TIMEOUT,
|
||||
* EV_SIGNAL, EV_READ,
|
||||
* EV_WRITE and EV_PERSIST.
|
||||
*
|
||||
* If EV_SIGNAL bit is set in parameter events,
|
||||
* the fd is interpreted as signal number.
|
||||
*
|
||||
* After initializing the event, use event_base_set to
|
||||
* associate the event with its event base.
|
||||
*
|
||||
* In case of matching event, these three arguments are passed to the
|
||||
* callback function:
|
||||
*
|
||||
*
|
||||
* fd
|
||||
*
|
||||
*
|
||||
* Signal number or resource indicating the stream.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* events
|
||||
*
|
||||
*
|
||||
* A flag indicating the event. Consists of the following flags:
|
||||
* EV_TIMEOUT, EV_SIGNAL,
|
||||
* EV_READ, EV_WRITE
|
||||
* and EV_PERSIST.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* arg
|
||||
*
|
||||
*
|
||||
* Optional parameter, previously passed to event_set
|
||||
* as arg.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param resource $event Valid event resource.
|
||||
* @param mixed $fd Valid PHP stream resource. The stream must be castable to file
|
||||
* descriptor, so you most likely won't be able to use any of filtered
|
||||
* streams.
|
||||
* @param int $events A set of flags indicating the desired event, can be
|
||||
* EV_READ and/or EV_WRITE.
|
||||
* The additional flag EV_PERSIST makes the event
|
||||
* to persist until event_del is called, otherwise
|
||||
* the callback is invoked only once.
|
||||
* @param mixed $callback Callback function to be called when the matching event occurs.
|
||||
* @param mixed $arg Optional callback parameter.
|
||||
* @throws LibeventException
|
||||
*
|
||||
*/
|
||||
function event_set($event, $fd, int $events, $callback, $arg = null): void
|
||||
{
|
||||
error_clear_last();
|
||||
if ($arg !== null) {
|
||||
$result = \event_set($event, $fd, $events, $callback, $arg);
|
||||
} else {
|
||||
$result = \event_set($event, $fd, $events, $callback);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw LibeventException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Prepares the timer event to be used in event_add. The
|
||||
* event is prepared to call the function specified by the
|
||||
* callback when the event timeout elapses.
|
||||
*
|
||||
* After initializing the event, use event_base_set to
|
||||
* associate the event with its event base.
|
||||
*
|
||||
* In case of matching event, these three arguments are passed to the
|
||||
* callback function:
|
||||
*
|
||||
*
|
||||
* fd
|
||||
*
|
||||
*
|
||||
* Signal number or resource indicating the stream.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* events
|
||||
*
|
||||
*
|
||||
* A flag indicating the event. This will always be
|
||||
* EV_TIMEOUT for timer events.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* arg
|
||||
*
|
||||
*
|
||||
* Optional parameter, previously passed to
|
||||
* event_timer_set as arg.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param resource $event Valid event resource.
|
||||
* @param callable $callback Callback function to be called when the matching event occurs.
|
||||
* @param mixed $arg Optional callback parameter.
|
||||
* @throws LibeventException
|
||||
*
|
||||
*/
|
||||
function event_timer_set($event, callable $callback, $arg = null): void
|
||||
{
|
||||
error_clear_last();
|
||||
if ($arg !== null) {
|
||||
$result = \event_timer_set($event, $callback, $arg);
|
||||
} else {
|
||||
$result = \event_timer_set($event, $callback);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw LibeventException::createFromPhpError();
|
||||
}
|
||||
}
|
29
vendor/thecodingmachine/safe/deprecated/misc.php
vendored
Normal file
29
vendor/thecodingmachine/safe/deprecated/misc.php
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\MiscException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param int $seconds Halt time in seconds.
|
||||
* @return int Returns zero on success.
|
||||
*
|
||||
* If the call was interrupted by a signal, sleep returns
|
||||
* a non-zero value. On Windows, this value will always be
|
||||
* 192 (the value of the
|
||||
* WAIT_IO_COMPLETION constant within the Windows API).
|
||||
* On other platforms, the return value will be the number of seconds left to
|
||||
* sleep.
|
||||
* @throws MiscException
|
||||
* @deprecated The Safe version of this function is no longer needed in PHP 8.0+
|
||||
*/
|
||||
function sleep(int $seconds): int
|
||||
{
|
||||
error_clear_last();
|
||||
$safeResult = \sleep($seconds);
|
||||
if ($safeResult === false) {
|
||||
throw MiscException::createFromPhpError();
|
||||
}
|
||||
return $safeResult;
|
||||
}
|
426
vendor/thecodingmachine/safe/deprecated/mssql.php
vendored
Normal file
426
vendor/thecodingmachine/safe/deprecated/mssql.php
vendored
Normal file
|
@ -0,0 +1,426 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\MssqlException;
|
||||
|
||||
/**
|
||||
* Binds a parameter to a stored procedure or a remote stored procedure.
|
||||
*
|
||||
* @param resource $stmt Statement resource, obtained with mssql_init.
|
||||
* @param string $param_name The parameter name, as a string.
|
||||
*
|
||||
* You have to include the @ character, like in the
|
||||
* T-SQL syntax. See the explanation included in
|
||||
* mssql_execute.
|
||||
* @param mixed $var The PHP variable you'll bind the MSSQL parameter to. It is passed by
|
||||
* reference, to retrieve OUTPUT and RETVAL values after
|
||||
* the procedure execution.
|
||||
* @param int $type One of: SQLTEXT,
|
||||
* SQLVARCHAR, SQLCHAR,
|
||||
* SQLINT1, SQLINT2,
|
||||
* SQLINT4, SQLBIT,
|
||||
* SQLFLT4, SQLFLT8,
|
||||
* SQLFLTN.
|
||||
* @param bool $is_output Whether the value is an OUTPUT parameter or not. If it's an OUTPUT
|
||||
* parameter and you don't mention it, it will be treated as a normal
|
||||
* input parameter and no error will be thrown.
|
||||
* @param bool $is_null Whether the parameter is NULL or not. Passing the NULL value as
|
||||
* var will not do the job.
|
||||
* @param int $maxlen Used with char/varchar values. You have to indicate the length of the
|
||||
* data so if the parameter is a varchar(50), the type must be
|
||||
* SQLVARCHAR and this value 50.
|
||||
* @throws MssqlException
|
||||
*
|
||||
*/
|
||||
function mssql_bind($stmt, string $param_name, &$var, int $type, bool $is_output = false, bool $is_null = false, int $maxlen = -1): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \mssql_bind($stmt, $param_name, $var, $type, $is_output, $is_null, $maxlen);
|
||||
if ($result === false) {
|
||||
throw MssqlException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Closes the link to a MS SQL Server database that's associated with the
|
||||
* specified link identifier. If the link identifier isn't specified, the
|
||||
* last opened link is assumed.
|
||||
*
|
||||
* Note that this isn't usually necessary, as non-persistent open
|
||||
* links are automatically closed at the end of the script's
|
||||
* execution.
|
||||
*
|
||||
* @param resource $link_identifier A MS SQL link identifier, returned by
|
||||
* mssql_connect.
|
||||
*
|
||||
* This function will not close persistent links generated by
|
||||
* mssql_pconnect.
|
||||
* @throws MssqlException
|
||||
*
|
||||
*/
|
||||
function mssql_close($link_identifier = null): void
|
||||
{
|
||||
error_clear_last();
|
||||
if ($link_identifier !== null) {
|
||||
$result = \mssql_close($link_identifier);
|
||||
} else {
|
||||
$result = \mssql_close();
|
||||
}
|
||||
if ($result === false) {
|
||||
throw MssqlException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* mssql_connect establishes a connection to a
|
||||
* MS SQL server.
|
||||
*
|
||||
* The link to the server will be closed as soon as the execution of
|
||||
* the script ends, unless it's closed earlier by explicitly calling
|
||||
* mssql_close.
|
||||
*
|
||||
* @param string $servername The MS SQL server. It can also include a port number, e.g.
|
||||
* hostname:port (Linux), or
|
||||
* hostname,port (Windows).
|
||||
* @param string $username The username.
|
||||
* @param string $password The password.
|
||||
* @param bool $new_link If a second call is made to mssql_connect with the
|
||||
* same arguments, no new link will be established, but instead, the link
|
||||
* identifier of the already opened link will be returned. This parameter
|
||||
* modifies this behavior and makes mssql_connect
|
||||
* always open a new link, even if mssql_connect was
|
||||
* called before with the same parameters.
|
||||
* @return resource Returns a MS SQL link identifier on success.
|
||||
* @throws MssqlException
|
||||
*
|
||||
*/
|
||||
function mssql_connect(string $servername = null, string $username = null, string $password = null, bool $new_link = false)
|
||||
{
|
||||
error_clear_last();
|
||||
if ($new_link !== false) {
|
||||
$result = \mssql_connect($servername, $username, $password, $new_link);
|
||||
} elseif ($password !== null) {
|
||||
$result = \mssql_connect($servername, $username, $password);
|
||||
} elseif ($username !== null) {
|
||||
$result = \mssql_connect($servername, $username);
|
||||
} elseif ($servername !== null) {
|
||||
$result = \mssql_connect($servername);
|
||||
} else {
|
||||
$result = \mssql_connect();
|
||||
}
|
||||
if ($result === false) {
|
||||
throw MssqlException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* mssql_data_seek moves the internal row
|
||||
* pointer of the MS SQL result associated with the specified result
|
||||
* identifier to point to the specified row number, first row being
|
||||
* number 0. The next call to mssql_fetch_row
|
||||
* would return that row.
|
||||
*
|
||||
* @param resource $result_identifier The result resource that is being evaluated.
|
||||
* @param int $row_number The desired row number of the new result pointer.
|
||||
* @throws MssqlException
|
||||
*
|
||||
*/
|
||||
function mssql_data_seek($result_identifier, int $row_number): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \mssql_data_seek($result_identifier, $row_number);
|
||||
if ($result === false) {
|
||||
throw MssqlException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the length of field no. offset in
|
||||
* result.
|
||||
*
|
||||
* @param resource $result The result resource that is being evaluated. This result comes from a
|
||||
* call to mssql_query.
|
||||
* @param int $offset The field offset, starts at 0. If omitted, the current field is used.
|
||||
* @return int The length of the specified field index on success.
|
||||
* @throws MssqlException
|
||||
*
|
||||
*/
|
||||
function mssql_field_length($result, int $offset = -1): int
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \mssql_field_length($result, $offset);
|
||||
if ($result === false) {
|
||||
throw MssqlException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the name of field no. offset in
|
||||
* result.
|
||||
*
|
||||
* @param resource $result The result resource that is being evaluated. This result comes from a
|
||||
* call to mssql_query.
|
||||
* @param int $offset The field offset, starts at 0. If omitted, the current field is used.
|
||||
* @return string The name of the specified field index on success.
|
||||
* @throws MssqlException
|
||||
*
|
||||
*/
|
||||
function mssql_field_name($result, int $offset = -1): string
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \mssql_field_name($result, $offset);
|
||||
if ($result === false) {
|
||||
throw MssqlException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Seeks to the specified field offset. If the next call to
|
||||
* mssql_fetch_field won't include a field
|
||||
* offset, this field would be returned.
|
||||
*
|
||||
* @param resource $result The result resource that is being evaluated. This result comes from a
|
||||
* call to mssql_query.
|
||||
* @param int $field_offset The field offset, starts at 0.
|
||||
* @throws MssqlException
|
||||
*
|
||||
*/
|
||||
function mssql_field_seek($result, int $field_offset): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \mssql_field_seek($result, $field_offset);
|
||||
if ($result === false) {
|
||||
throw MssqlException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the type of field no. offset in
|
||||
* result.
|
||||
*
|
||||
* @param resource $result The result resource that is being evaluated. This result comes from a
|
||||
* call to mssql_query.
|
||||
* @param int $offset The field offset, starts at 0. If omitted, the current field is used.
|
||||
* @return string The type of the specified field index on success.
|
||||
* @throws MssqlException
|
||||
*
|
||||
*/
|
||||
function mssql_field_type($result, int $offset = -1): string
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \mssql_field_type($result, $offset);
|
||||
if ($result === false) {
|
||||
throw MssqlException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* mssql_free_result only needs to be called
|
||||
* if you are worried about using too much memory while your script
|
||||
* is running. All result memory will automatically be freed when
|
||||
* the script ends. You may call mssql_free_result
|
||||
* with the result identifier as an argument and the associated
|
||||
* result memory will be freed.
|
||||
*
|
||||
* @param resource $result The result resource that is being freed. This result comes from a
|
||||
* call to mssql_query.
|
||||
* @throws MssqlException
|
||||
*
|
||||
*/
|
||||
function mssql_free_result($result): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \mssql_free_result($result);
|
||||
if ($result === false) {
|
||||
throw MssqlException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* mssql_free_statement only needs to be called
|
||||
* if you are worried about using too much memory while your script
|
||||
* is running. All statement memory will automatically be freed when
|
||||
* the script ends. You may call mssql_free_statement
|
||||
* with the statement identifier as an argument and the associated
|
||||
* statement memory will be freed.
|
||||
*
|
||||
* @param resource $stmt Statement resource, obtained with mssql_init.
|
||||
* @throws MssqlException
|
||||
*
|
||||
*/
|
||||
function mssql_free_statement($stmt): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \mssql_free_statement($stmt);
|
||||
if ($result === false) {
|
||||
throw MssqlException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initializes a stored procedure or a remote stored procedure.
|
||||
*
|
||||
* @param string $sp_name Stored procedure name, like ownew.sp_name or
|
||||
* otherdb.owner.sp_name.
|
||||
* @param resource $link_identifier A MS SQL link identifier, returned by
|
||||
* mssql_connect.
|
||||
* @return resource Returns a resource identifier "statement", used in subsequent calls to
|
||||
* mssql_bind and mssql_executes.
|
||||
* @throws MssqlException
|
||||
*
|
||||
*/
|
||||
function mssql_init(string $sp_name, $link_identifier = null)
|
||||
{
|
||||
error_clear_last();
|
||||
if ($link_identifier !== null) {
|
||||
$result = \mssql_init($sp_name, $link_identifier);
|
||||
} else {
|
||||
$result = \mssql_init($sp_name);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw MssqlException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* mssql_pconnect acts very much like
|
||||
* mssql_connect with two major differences.
|
||||
*
|
||||
* First, when connecting, the function would first try to find a
|
||||
* (persistent) link that's already open with the same host,
|
||||
* username and password. If one is found, an identifier for it
|
||||
* will be returned instead of opening a new connection.
|
||||
*
|
||||
* Second, the connection to the SQL server will not be closed when
|
||||
* the execution of the script ends. Instead, the link will remain
|
||||
* open for future use (mssql_close will not
|
||||
* close links established by mssql_pconnect).
|
||||
*
|
||||
* This type of links is therefore called 'persistent'.
|
||||
*
|
||||
* @param string $servername The MS SQL server. It can also include a port number. e.g.
|
||||
* hostname:port.
|
||||
* @param string $username The username.
|
||||
* @param string $password The password.
|
||||
* @param bool $new_link If a second call is made to mssql_pconnect with
|
||||
* the same arguments, no new link will be established, but instead, the
|
||||
* link identifier of the already opened link will be returned. This
|
||||
* parameter modifies this behavior and makes
|
||||
* mssql_pconnect always open a new link, even if
|
||||
* mssql_pconnect was called before with the same
|
||||
* parameters.
|
||||
* @return resource Returns a positive MS SQL persistent link identifier on success.
|
||||
* @throws MssqlException
|
||||
*
|
||||
*/
|
||||
function mssql_pconnect(string $servername = null, string $username = null, string $password = null, bool $new_link = false)
|
||||
{
|
||||
error_clear_last();
|
||||
if ($new_link !== false) {
|
||||
$result = \mssql_pconnect($servername, $username, $password, $new_link);
|
||||
} elseif ($password !== null) {
|
||||
$result = \mssql_pconnect($servername, $username, $password);
|
||||
} elseif ($username !== null) {
|
||||
$result = \mssql_pconnect($servername, $username);
|
||||
} elseif ($servername !== null) {
|
||||
$result = \mssql_pconnect($servername);
|
||||
} else {
|
||||
$result = \mssql_pconnect();
|
||||
}
|
||||
if ($result === false) {
|
||||
throw MssqlException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* mssql_query sends a query to the currently active
|
||||
* database on the server that's associated with the specified link
|
||||
* identifier.
|
||||
*
|
||||
* @param string $query An SQL query.
|
||||
* @param resource $link_identifier A MS SQL link identifier, returned by
|
||||
* mssql_connect or
|
||||
* mssql_pconnect.
|
||||
*
|
||||
* If the link identifier isn't specified, the last opened link is
|
||||
* assumed. If no link is open, the function tries to establish a link
|
||||
* as if mssql_connect was called, and use it.
|
||||
* @param int $batch_size The number of records to batch in the buffer.
|
||||
* @return mixed Returns a MS SQL result resource on success, TRUE if no rows were
|
||||
* returned.
|
||||
* @throws MssqlException
|
||||
*
|
||||
*/
|
||||
function mssql_query(string $query, $link_identifier = null, int $batch_size = 0)
|
||||
{
|
||||
error_clear_last();
|
||||
if ($batch_size !== 0) {
|
||||
$result = \mssql_query($query, $link_identifier, $batch_size);
|
||||
} elseif ($link_identifier !== null) {
|
||||
$result = \mssql_query($query, $link_identifier);
|
||||
} else {
|
||||
$result = \mssql_query($query);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw MssqlException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* mssql_select_db sets the current active
|
||||
* database on the server that's associated with the specified link
|
||||
* identifier.
|
||||
*
|
||||
* Every subsequent call to mssql_query will be
|
||||
* made on the active database.
|
||||
*
|
||||
* @param string $database_name The database name.
|
||||
*
|
||||
* To escape the name of a database that contains spaces, hyphens ("-"),
|
||||
* or any other exceptional characters, the database name must be
|
||||
* enclosed in brackets, as is shown in the example, below. This
|
||||
* technique must also be applied when selecting a database name that is
|
||||
* also a reserved word (such as primary).
|
||||
* @param resource $link_identifier A MS SQL link identifier, returned by
|
||||
* mssql_connect or
|
||||
* mssql_pconnect.
|
||||
*
|
||||
* If no link identifier is specified, the last opened link is assumed.
|
||||
* If no link is open, the function will try to establish a link as if
|
||||
* mssql_connect was called, and use it.
|
||||
* @throws MssqlException
|
||||
*
|
||||
*/
|
||||
function mssql_select_db(string $database_name, $link_identifier = null): void
|
||||
{
|
||||
error_clear_last();
|
||||
if ($link_identifier !== null) {
|
||||
$result = \mssql_select_db($database_name, $link_identifier);
|
||||
} else {
|
||||
$result = \mssql_select_db($database_name);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw MssqlException::createFromPhpError();
|
||||
}
|
||||
}
|
22
vendor/thecodingmachine/safe/deprecated/mysqli.php
vendored
Normal file
22
vendor/thecodingmachine/safe/deprecated/mysqli.php
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\MysqliException;
|
||||
|
||||
/**
|
||||
* Returns client per-process statistics.
|
||||
*
|
||||
* @return array Returns an array with client stats if success, FALSE otherwise.
|
||||
* @throws MysqliException
|
||||
*
|
||||
*/
|
||||
function mysqli_get_client_stats(): array
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \mysqli_get_client_stats();
|
||||
if ($result === false) {
|
||||
throw MysqliException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
127
vendor/thecodingmachine/safe/deprecated/password.php
vendored
Normal file
127
vendor/thecodingmachine/safe/deprecated/password.php
vendored
Normal file
|
@ -0,0 +1,127 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\PasswordException;
|
||||
|
||||
/**
|
||||
* password_hash creates a new password hash using a strong one-way hashing
|
||||
* algorithm. password_hash is compatible with crypt.
|
||||
* Therefore, password hashes created by crypt can be used with
|
||||
* password_hash.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* PASSWORD_DEFAULT - Use the bcrypt algorithm (default as of PHP 5.5.0).
|
||||
* Note that this constant is designed to change over time as new and stronger algorithms are added
|
||||
* to PHP. For that reason, the length of the result from using this identifier can change over
|
||||
* time. Therefore, it is recommended to store the result in a database column that can expand
|
||||
* beyond 60 characters (255 characters would be a good choice).
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* PASSWORD_BCRYPT - Use the CRYPT_BLOWFISH algorithm to
|
||||
* create the hash. This will produce a standard crypt compatible hash using
|
||||
* the "$2y$" identifier. The result will always be a 60 character string.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* PASSWORD_ARGON2I - Use the Argon2i hashing algorithm to create the hash.
|
||||
* This algorithm is only available if PHP has been compiled with Argon2 support.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* PASSWORD_ARGON2ID - Use the Argon2id hashing algorithm to create the hash.
|
||||
* This algorithm is only available if PHP has been compiled with Argon2 support.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* salt (string) - to manually provide a salt to use when hashing the password.
|
||||
* Note that this will override and prevent a salt from being automatically generated.
|
||||
*
|
||||
*
|
||||
* If omitted, a random salt will be generated by password_hash for
|
||||
* each password hashed. This is the intended mode of operation.
|
||||
*
|
||||
*
|
||||
*
|
||||
* The salt option has been deprecated as of PHP 7.0.0. It is now
|
||||
* preferred to simply use the salt that is generated by default.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* cost (integer) - which denotes the algorithmic cost that should be used.
|
||||
* Examples of these values can be found on the crypt page.
|
||||
*
|
||||
*
|
||||
* If omitted, a default value of 10 will be used. This is a good
|
||||
* baseline cost, but you may want to consider increasing it depending on your hardware.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* memory_cost (integer) - Maximum memory (in kibibytes) that may
|
||||
* be used to compute the Argon2 hash. Defaults to PASSWORD_ARGON2_DEFAULT_MEMORY_COST.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* time_cost (integer) - Maximum amount of time it may
|
||||
* take to compute the Argon2 hash. Defaults to PASSWORD_ARGON2_DEFAULT_TIME_COST.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* threads (integer) - Number of threads to use for computing
|
||||
* the Argon2 hash. Defaults to PASSWORD_ARGON2_DEFAULT_THREADS.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param string $password The user's password.
|
||||
*
|
||||
* Using the PASSWORD_BCRYPT as the
|
||||
* algorithm, will result
|
||||
* in the password parameter being truncated to a
|
||||
* maximum length of 72 characters.
|
||||
* @param int|string|null $algo A password algorithm constant denoting the algorithm to use when hashing the password.
|
||||
* @param array $options An associative array containing options. See the password algorithm constants for documentation on the supported options for each algorithm.
|
||||
*
|
||||
* If omitted, a random salt will be created and the default cost will be
|
||||
* used.
|
||||
* @return string Returns the hashed password.
|
||||
*
|
||||
* The used algorithm, cost and salt are returned as part of the hash. Therefore,
|
||||
* all information that's needed to verify the hash is included in it. This allows
|
||||
* the password_verify function to verify the hash without
|
||||
* needing separate storage for the salt or algorithm information.
|
||||
* @throws PasswordException
|
||||
* @deprecated The Safe version of this function is no longer needed in PHP 8.0+
|
||||
*
|
||||
*/
|
||||
function password_hash(string $password, $algo, array $options = null): string
|
||||
{
|
||||
error_clear_last();
|
||||
if ($options !== null) {
|
||||
$result = \password_hash($password, $algo, $options);
|
||||
} else {
|
||||
$result = \password_hash($password, $algo);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw PasswordException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
108
vendor/thecodingmachine/safe/deprecated/stats.php
vendored
Normal file
108
vendor/thecodingmachine/safe/deprecated/stats.php
vendored
Normal file
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\StatsException;
|
||||
|
||||
/**
|
||||
* Returns the covariance of a and b.
|
||||
*
|
||||
* @param array $a The first array
|
||||
* @param array $b The second array
|
||||
* @return float Returns the covariance of a and b.
|
||||
* @throws StatsException
|
||||
*
|
||||
*/
|
||||
function stats_covariance(array $a, array $b): float
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \stats_covariance($a, $b);
|
||||
if ($result === false) {
|
||||
throw StatsException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the standard deviation of the values in a.
|
||||
*
|
||||
* @param array $a The array of data to find the standard deviation for. Note that all
|
||||
* values of the array will be cast to float.
|
||||
* @param bool $sample Indicates if a represents a sample of the
|
||||
* population; defaults to FALSE.
|
||||
* @return float Returns the standard deviation on success; FALSE on failure.
|
||||
* @throws StatsException
|
||||
*
|
||||
*/
|
||||
function stats_standard_deviation(array $a, bool $sample = false): float
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \stats_standard_deviation($a, $sample);
|
||||
if ($result === false) {
|
||||
throw StatsException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the Pearson correlation coefficient between arr1 and arr2.
|
||||
*
|
||||
* @param array $arr1 The first array
|
||||
* @param array $arr2 The second array
|
||||
* @return float Returns the Pearson correlation coefficient between arr1 and arr2.
|
||||
* @throws StatsException
|
||||
*
|
||||
*/
|
||||
function stats_stat_correlation(array $arr1, array $arr2): float
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \stats_stat_correlation($arr1, $arr2);
|
||||
if ($result === false) {
|
||||
throw StatsException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the inner product of arr1 and arr2.
|
||||
*
|
||||
* @param array $arr1 The first array
|
||||
* @param array $arr2 The second array
|
||||
* @return float Returns the inner product of arr1 and arr2.
|
||||
* @throws StatsException
|
||||
*
|
||||
*/
|
||||
function stats_stat_innerproduct(array $arr1, array $arr2): float
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \stats_stat_innerproduct($arr1, $arr2);
|
||||
if ($result === false) {
|
||||
throw StatsException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the variance of the values in a.
|
||||
*
|
||||
* @param array $a The array of data to find the standard deviation for. Note that all
|
||||
* values of the array will be cast to float.
|
||||
* @param bool $sample Indicates if a represents a sample of the
|
||||
* population; defaults to FALSE.
|
||||
* @return float Returns the variance on success; FALSE on failure.
|
||||
* @throws StatsException
|
||||
*
|
||||
*/
|
||||
function stats_variance(array $a, bool $sample = false): float
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \stats_variance($a, $sample);
|
||||
if ($result === false) {
|
||||
throw StatsException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
677
vendor/thecodingmachine/safe/deprecated/strings.php
vendored
Normal file
677
vendor/thecodingmachine/safe/deprecated/strings.php
vendored
Normal file
|
@ -0,0 +1,677 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\StringsException;
|
||||
|
||||
/**
|
||||
* Returns a string produced according to the formatting string
|
||||
* format.
|
||||
*
|
||||
* @param string $format The format string is composed of zero or more directives:
|
||||
* ordinary characters (excluding %) that are
|
||||
* copied directly to the result and conversion
|
||||
* specifications, each of which results in fetching its
|
||||
* own parameter.
|
||||
*
|
||||
* A conversion specification follows this prototype:
|
||||
* %[argnum$][flags][width][.precision]specifier.
|
||||
*
|
||||
* An integer followed by a dollar sign $,
|
||||
* to specify which number argument to treat in the conversion.
|
||||
*
|
||||
*
|
||||
* Flags
|
||||
*
|
||||
*
|
||||
*
|
||||
* Flag
|
||||
* Description
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* -
|
||||
*
|
||||
* Left-justify within the given field width;
|
||||
* Right justification is the default
|
||||
*
|
||||
*
|
||||
*
|
||||
* +
|
||||
*
|
||||
* Prefix positive numbers with a plus sign
|
||||
* +; Default only negative
|
||||
* are prefixed with a negative sign.
|
||||
*
|
||||
*
|
||||
*
|
||||
* (space)
|
||||
*
|
||||
* Pads the result with spaces.
|
||||
* This is the default.
|
||||
*
|
||||
*
|
||||
*
|
||||
* 0
|
||||
*
|
||||
* Only left-pads numbers with zeros.
|
||||
* With s specifiers this can
|
||||
* also right-pad with zeros.
|
||||
*
|
||||
*
|
||||
*
|
||||
* '(char)
|
||||
*
|
||||
* Pads the result with the character (char).
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* An integer that says how many characters (minimum)
|
||||
* this conversion should result in.
|
||||
*
|
||||
* A period . followed by an integer
|
||||
* who's meaning depends on the specifier:
|
||||
*
|
||||
*
|
||||
*
|
||||
* For e, E,
|
||||
* f and F
|
||||
* specifiers: this is the number of digits to be printed
|
||||
* after the decimal point (by default, this is 6).
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* For g and G
|
||||
* specifiers: this is the maximum number of significant
|
||||
* digits to be printed.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* For s specifier: it acts as a cutoff point,
|
||||
* setting a maximum character limit to the string.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* If the period is specified without an explicit value for precision,
|
||||
* 0 is assumed.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* Specifiers
|
||||
*
|
||||
*
|
||||
*
|
||||
* Specifier
|
||||
* Description
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* %
|
||||
*
|
||||
* A literal percent character. No argument is required.
|
||||
*
|
||||
*
|
||||
*
|
||||
* b
|
||||
*
|
||||
* The argument is treated as an integer and presented
|
||||
* as a binary number.
|
||||
*
|
||||
*
|
||||
*
|
||||
* c
|
||||
*
|
||||
* The argument is treated as an integer and presented
|
||||
* as the character with that ASCII.
|
||||
*
|
||||
*
|
||||
*
|
||||
* d
|
||||
*
|
||||
* The argument is treated as an integer and presented
|
||||
* as a (signed) decimal number.
|
||||
*
|
||||
*
|
||||
*
|
||||
* e
|
||||
*
|
||||
* The argument is treated as scientific notation (e.g. 1.2e+2).
|
||||
* The precision specifier stands for the number of digits after the
|
||||
* decimal point since PHP 5.2.1. In earlier versions, it was taken as
|
||||
* number of significant digits (one less).
|
||||
*
|
||||
*
|
||||
*
|
||||
* E
|
||||
*
|
||||
* Like the e specifier but uses
|
||||
* uppercase letter (e.g. 1.2E+2).
|
||||
*
|
||||
*
|
||||
*
|
||||
* f
|
||||
*
|
||||
* The argument is treated as a float and presented
|
||||
* as a floating-point number (locale aware).
|
||||
*
|
||||
*
|
||||
*
|
||||
* F
|
||||
*
|
||||
* The argument is treated as a float and presented
|
||||
* as a floating-point number (non-locale aware).
|
||||
* Available as of PHP 5.0.3.
|
||||
*
|
||||
*
|
||||
*
|
||||
* g
|
||||
*
|
||||
*
|
||||
* General format.
|
||||
*
|
||||
*
|
||||
* Let P equal the precision if nonzero, 6 if the precision is omitted,
|
||||
* or 1 if the precision is zero.
|
||||
* Then, if a conversion with style E would have an exponent of X:
|
||||
*
|
||||
*
|
||||
* If P > X ≥ −4, the conversion is with style f and precision P − (X + 1).
|
||||
* Otherwise, the conversion is with style e and precision P − 1.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* G
|
||||
*
|
||||
* Like the g specifier but uses
|
||||
* E and f.
|
||||
*
|
||||
*
|
||||
*
|
||||
* o
|
||||
*
|
||||
* The argument is treated as an integer and presented
|
||||
* as an octal number.
|
||||
*
|
||||
*
|
||||
*
|
||||
* s
|
||||
*
|
||||
* The argument is treated and presented as a string.
|
||||
*
|
||||
*
|
||||
*
|
||||
* u
|
||||
*
|
||||
* The argument is treated as an integer and presented
|
||||
* as an unsigned decimal number.
|
||||
*
|
||||
*
|
||||
*
|
||||
* x
|
||||
*
|
||||
* The argument is treated as an integer and presented
|
||||
* as a hexadecimal number (with lowercase letters).
|
||||
*
|
||||
*
|
||||
*
|
||||
* X
|
||||
*
|
||||
* The argument is treated as an integer and presented
|
||||
* as a hexadecimal number (with uppercase letters).
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* General format.
|
||||
*
|
||||
* Let P equal the precision if nonzero, 6 if the precision is omitted,
|
||||
* or 1 if the precision is zero.
|
||||
* Then, if a conversion with style E would have an exponent of X:
|
||||
*
|
||||
* If P > X ≥ −4, the conversion is with style f and precision P − (X + 1).
|
||||
* Otherwise, the conversion is with style e and precision P − 1.
|
||||
*
|
||||
* The c type specifier ignores padding and width
|
||||
*
|
||||
* Attempting to use a combination of the string and width specifiers with character sets that require more than one byte per character may result in unexpected results
|
||||
*
|
||||
* Variables will be co-erced to a suitable type for the specifier:
|
||||
*
|
||||
* Type Handling
|
||||
*
|
||||
*
|
||||
*
|
||||
* Type
|
||||
* Specifiers
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* string
|
||||
* s
|
||||
*
|
||||
*
|
||||
* integer
|
||||
*
|
||||
* d,
|
||||
* u,
|
||||
* c,
|
||||
* o,
|
||||
* x,
|
||||
* X,
|
||||
* b
|
||||
*
|
||||
*
|
||||
*
|
||||
* double
|
||||
*
|
||||
* g,
|
||||
* G,
|
||||
* e,
|
||||
* E,
|
||||
* f,
|
||||
* F
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param mixed $params
|
||||
* @return string Returns a string produced according to the formatting string
|
||||
* format.
|
||||
* @throws StringsException
|
||||
* @deprecated The Safe version of this function is no longer needed in PHP 8.0+
|
||||
*
|
||||
*/
|
||||
function sprintf(string $format, ...$params): string
|
||||
{
|
||||
error_clear_last();
|
||||
if ($params !== []) {
|
||||
$result = \sprintf($format, ...$params);
|
||||
} else {
|
||||
$result = \sprintf($format);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw StringsException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the portion of string specified by the
|
||||
* start and length parameters.
|
||||
*
|
||||
* @param string $string The input string.
|
||||
* @param int $start If start is non-negative, the returned string
|
||||
* will start at the start'th position in
|
||||
* string, counting from zero. For instance,
|
||||
* in the string 'abcdef', the character at
|
||||
* position 0 is 'a', the
|
||||
* character at position 2 is
|
||||
* 'c', and so forth.
|
||||
*
|
||||
* If start is negative, the returned string
|
||||
* will start at the start'th character
|
||||
* from the end of string.
|
||||
*
|
||||
* If string is less than
|
||||
* start characters long, FALSE will be returned.
|
||||
*
|
||||
*
|
||||
* Using a negative start
|
||||
*
|
||||
*
|
||||
* ]]>
|
||||
*
|
||||
*
|
||||
* @param int $length If length is given and is positive, the string
|
||||
* returned will contain at most length characters
|
||||
* beginning from start (depending on the length of
|
||||
* string).
|
||||
*
|
||||
* If length is given and is negative, then that many
|
||||
* characters will be omitted from the end of string
|
||||
* (after the start position has been calculated when a
|
||||
* start is negative). If
|
||||
* start denotes the position of this truncation or
|
||||
* beyond, FALSE will be returned.
|
||||
*
|
||||
* If length is given and is 0,
|
||||
* FALSE or NULL, an empty string will be returned.
|
||||
*
|
||||
* If length is omitted, the substring starting from
|
||||
* start until the end of the string will be
|
||||
* returned.
|
||||
* @return string Returns the extracted part of string;, or
|
||||
* an empty string.
|
||||
* @throws StringsException
|
||||
* @deprecated The Safe version of this function is no longer needed in PHP 8.0+
|
||||
*
|
||||
*/
|
||||
function substr(string $string, int $start, int $length = null): string
|
||||
{
|
||||
error_clear_last();
|
||||
if ($length !== null) {
|
||||
$result = \substr($string, $start, $length);
|
||||
} else {
|
||||
$result = \substr($string, $start);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw StringsException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Operates as sprintf but accepts an array of
|
||||
* arguments, rather than a variable number of arguments.
|
||||
*
|
||||
* @param string $format The format string is composed of zero or more directives:
|
||||
* ordinary characters (excluding %) that are
|
||||
* copied directly to the result and conversion
|
||||
* specifications, each of which results in fetching its
|
||||
* own parameter.
|
||||
*
|
||||
* A conversion specification follows this prototype:
|
||||
* %[argnum$][flags][width][.precision]specifier.
|
||||
*
|
||||
* An integer followed by a dollar sign $,
|
||||
* to specify which number argument to treat in the conversion.
|
||||
*
|
||||
*
|
||||
* Flags
|
||||
*
|
||||
*
|
||||
*
|
||||
* Flag
|
||||
* Description
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* -
|
||||
*
|
||||
* Left-justify within the given field width;
|
||||
* Right justification is the default
|
||||
*
|
||||
*
|
||||
*
|
||||
* +
|
||||
*
|
||||
* Prefix positive numbers with a plus sign
|
||||
* +; Default only negative
|
||||
* are prefixed with a negative sign.
|
||||
*
|
||||
*
|
||||
*
|
||||
* (space)
|
||||
*
|
||||
* Pads the result with spaces.
|
||||
* This is the default.
|
||||
*
|
||||
*
|
||||
*
|
||||
* 0
|
||||
*
|
||||
* Only left-pads numbers with zeros.
|
||||
* With s specifiers this can
|
||||
* also right-pad with zeros.
|
||||
*
|
||||
*
|
||||
*
|
||||
* '(char)
|
||||
*
|
||||
* Pads the result with the character (char).
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* An integer that says how many characters (minimum)
|
||||
* this conversion should result in.
|
||||
*
|
||||
* A period . followed by an integer
|
||||
* who's meaning depends on the specifier:
|
||||
*
|
||||
*
|
||||
*
|
||||
* For e, E,
|
||||
* f and F
|
||||
* specifiers: this is the number of digits to be printed
|
||||
* after the decimal point (by default, this is 6).
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* For g and G
|
||||
* specifiers: this is the maximum number of significant
|
||||
* digits to be printed.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* For s specifier: it acts as a cutoff point,
|
||||
* setting a maximum character limit to the string.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* If the period is specified without an explicit value for precision,
|
||||
* 0 is assumed.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* Specifiers
|
||||
*
|
||||
*
|
||||
*
|
||||
* Specifier
|
||||
* Description
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* %
|
||||
*
|
||||
* A literal percent character. No argument is required.
|
||||
*
|
||||
*
|
||||
*
|
||||
* b
|
||||
*
|
||||
* The argument is treated as an integer and presented
|
||||
* as a binary number.
|
||||
*
|
||||
*
|
||||
*
|
||||
* c
|
||||
*
|
||||
* The argument is treated as an integer and presented
|
||||
* as the character with that ASCII.
|
||||
*
|
||||
*
|
||||
*
|
||||
* d
|
||||
*
|
||||
* The argument is treated as an integer and presented
|
||||
* as a (signed) decimal number.
|
||||
*
|
||||
*
|
||||
*
|
||||
* e
|
||||
*
|
||||
* The argument is treated as scientific notation (e.g. 1.2e+2).
|
||||
* The precision specifier stands for the number of digits after the
|
||||
* decimal point since PHP 5.2.1. In earlier versions, it was taken as
|
||||
* number of significant digits (one less).
|
||||
*
|
||||
*
|
||||
*
|
||||
* E
|
||||
*
|
||||
* Like the e specifier but uses
|
||||
* uppercase letter (e.g. 1.2E+2).
|
||||
*
|
||||
*
|
||||
*
|
||||
* f
|
||||
*
|
||||
* The argument is treated as a float and presented
|
||||
* as a floating-point number (locale aware).
|
||||
*
|
||||
*
|
||||
*
|
||||
* F
|
||||
*
|
||||
* The argument is treated as a float and presented
|
||||
* as a floating-point number (non-locale aware).
|
||||
* Available as of PHP 5.0.3.
|
||||
*
|
||||
*
|
||||
*
|
||||
* g
|
||||
*
|
||||
*
|
||||
* General format.
|
||||
*
|
||||
*
|
||||
* Let P equal the precision if nonzero, 6 if the precision is omitted,
|
||||
* or 1 if the precision is zero.
|
||||
* Then, if a conversion with style E would have an exponent of X:
|
||||
*
|
||||
*
|
||||
* If P > X ≥ −4, the conversion is with style f and precision P − (X + 1).
|
||||
* Otherwise, the conversion is with style e and precision P − 1.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* G
|
||||
*
|
||||
* Like the g specifier but uses
|
||||
* E and f.
|
||||
*
|
||||
*
|
||||
*
|
||||
* o
|
||||
*
|
||||
* The argument is treated as an integer and presented
|
||||
* as an octal number.
|
||||
*
|
||||
*
|
||||
*
|
||||
* s
|
||||
*
|
||||
* The argument is treated and presented as a string.
|
||||
*
|
||||
*
|
||||
*
|
||||
* u
|
||||
*
|
||||
* The argument is treated as an integer and presented
|
||||
* as an unsigned decimal number.
|
||||
*
|
||||
*
|
||||
*
|
||||
* x
|
||||
*
|
||||
* The argument is treated as an integer and presented
|
||||
* as a hexadecimal number (with lowercase letters).
|
||||
*
|
||||
*
|
||||
*
|
||||
* X
|
||||
*
|
||||
* The argument is treated as an integer and presented
|
||||
* as a hexadecimal number (with uppercase letters).
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* General format.
|
||||
*
|
||||
* Let P equal the precision if nonzero, 6 if the precision is omitted,
|
||||
* or 1 if the precision is zero.
|
||||
* Then, if a conversion with style E would have an exponent of X:
|
||||
*
|
||||
* If P > X ≥ −4, the conversion is with style f and precision P − (X + 1).
|
||||
* Otherwise, the conversion is with style e and precision P − 1.
|
||||
*
|
||||
* The c type specifier ignores padding and width
|
||||
*
|
||||
* Attempting to use a combination of the string and width specifiers with character sets that require more than one byte per character may result in unexpected results
|
||||
*
|
||||
* Variables will be co-erced to a suitable type for the specifier:
|
||||
*
|
||||
* Type Handling
|
||||
*
|
||||
*
|
||||
*
|
||||
* Type
|
||||
* Specifiers
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* string
|
||||
* s
|
||||
*
|
||||
*
|
||||
* integer
|
||||
*
|
||||
* d,
|
||||
* u,
|
||||
* c,
|
||||
* o,
|
||||
* x,
|
||||
* X,
|
||||
* b
|
||||
*
|
||||
*
|
||||
*
|
||||
* double
|
||||
*
|
||||
* g,
|
||||
* G,
|
||||
* e,
|
||||
* E,
|
||||
* f,
|
||||
* F
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param array $args
|
||||
* @return string Return array values as a formatted string according to
|
||||
* format.
|
||||
* @throws StringsException
|
||||
* @deprecated The Safe version of this function is no longer needed in PHP 8.0+
|
||||
*/
|
||||
function vsprintf(string $format, array $args): string
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \vsprintf($format, $args);
|
||||
if ($result === false) {
|
||||
throw StringsException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
0
vendor/thecodingmachine/safe/generated/Exceptions/.gitkeep
vendored
Normal file
0
vendor/thecodingmachine/safe/generated/Exceptions/.gitkeep
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/ApacheException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/ApacheException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ApacheException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/ApcuException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/ApcuException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ApcuException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/ArrayException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/ArrayException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ArrayException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/Bzip2Exception.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/Bzip2Exception.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class Bzip2Exception extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/CalendarException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/CalendarException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class CalendarException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/ClassobjException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/ClassobjException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ClassobjException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/ComException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/ComException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ComException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/CubridException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/CubridException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class CubridException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/DatetimeException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/DatetimeException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class DatetimeException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/DirException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/DirException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class DirException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/EioException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/EioException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class EioException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/ErrorfuncException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/ErrorfuncException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ErrorfuncException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/ExecException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/ExecException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ExecException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/FileinfoException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/FileinfoException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class FileinfoException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/FilesystemException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/FilesystemException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class FilesystemException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/FilterException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/FilterException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class FilterException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/FpmException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/FpmException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class FpmException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/FtpException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/FtpException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class FtpException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/FunchandException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/FunchandException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class FunchandException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/GettextException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/GettextException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class GettextException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/GmpException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/GmpException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class GmpException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/GnupgException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/GnupgException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class GnupgException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/HashException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/HashException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class HashException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/IbaseException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/IbaseException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class IbaseException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/IbmDb2Exception.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/IbmDb2Exception.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class IbmDb2Exception extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/IconvException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/IconvException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class IconvException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/ImageException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/ImageException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ImageException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/ImapException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/ImapException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ImapException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/InfoException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/InfoException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class InfoException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/InotifyException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/InotifyException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class InotifyException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/LdapException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/LdapException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class LdapException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/LibxmlException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/LibxmlException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class LibxmlException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/LzfException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/LzfException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class LzfException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/MailparseException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/MailparseException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class MailparseException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/MbstringException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/MbstringException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class MbstringException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/MiscException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/MiscException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class MiscException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/MysqlException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/MysqlException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class MysqlException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/NetworkException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/NetworkException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class NetworkException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/Oci8Exception.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/Oci8Exception.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class Oci8Exception extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/OpcacheException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/OpcacheException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class OpcacheException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/OutcontrolException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/OutcontrolException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class OutcontrolException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/PcntlException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/PcntlException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class PcntlException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/PgsqlException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/PgsqlException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class PgsqlException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/PosixException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/PosixException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class PosixException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/PsException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/PsException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class PsException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/PspellException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/PspellException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class PspellException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/ReadlineException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/ReadlineException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ReadlineException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/RpminfoException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/RpminfoException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class RpminfoException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/RrdException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/RrdException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class RrdException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/SemException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/SemException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class SemException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/SessionException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/SessionException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class SessionException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/ShmopException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/ShmopException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ShmopException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/SocketsException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/SocketsException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class SocketsException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/SodiumException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/SodiumException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class SodiumException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/SolrException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/SolrException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class SolrException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/SplException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/SplException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class SplException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/SqlsrvException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/SqlsrvException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class SqlsrvException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/SsdeepException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/SsdeepException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class SsdeepException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/Ssh2Exception.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/Ssh2Exception.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class Ssh2Exception extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/StreamException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/StreamException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class StreamException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/StringsException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/StringsException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class StringsException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/SwooleException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/SwooleException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class SwooleException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/UodbcException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/UodbcException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class UodbcException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/UopzException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/UopzException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class UopzException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/UrlException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/UrlException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class UrlException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/VarException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/VarException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class VarException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/XdiffException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/XdiffException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class XdiffException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/XmlException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/XmlException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class XmlException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/XmlrpcException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/XmlrpcException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class XmlrpcException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/YamlException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/YamlException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class YamlException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/YazException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/YazException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class YazException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/ZipException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/ZipException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ZipException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
11
vendor/thecodingmachine/safe/generated/Exceptions/ZlibException.php
vendored
Normal file
11
vendor/thecodingmachine/safe/generated/Exceptions/ZlibException.php
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ZlibException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
199
vendor/thecodingmachine/safe/generated/apache.php
vendored
Normal file
199
vendor/thecodingmachine/safe/generated/apache.php
vendored
Normal file
|
@ -0,0 +1,199 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\ApacheException;
|
||||
|
||||
/**
|
||||
* Fetch the Apache version.
|
||||
*
|
||||
* @return string Returns the Apache version on success.
|
||||
* @throws ApacheException
|
||||
*
|
||||
*/
|
||||
function apache_get_version(): string
|
||||
{
|
||||
error_clear_last();
|
||||
$safeResult = \apache_get_version();
|
||||
if ($safeResult === false) {
|
||||
throw ApacheException::createFromPhpError();
|
||||
}
|
||||
return $safeResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve an Apache environment variable specified by
|
||||
* variable.
|
||||
*
|
||||
* @param string $variable The Apache environment variable
|
||||
* @param bool $walk_to_top Whether to get the top-level variable available to all Apache layers.
|
||||
* @return string The value of the Apache environment variable on success
|
||||
* @throws ApacheException
|
||||
*
|
||||
*/
|
||||
function apache_getenv(string $variable, bool $walk_to_top = false): string
|
||||
{
|
||||
error_clear_last();
|
||||
$safeResult = \apache_getenv($variable, $walk_to_top);
|
||||
if ($safeResult === false) {
|
||||
throw ApacheException::createFromPhpError();
|
||||
}
|
||||
return $safeResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This performs a partial request for a URI. It goes just far
|
||||
* enough to obtain all the important information about the given
|
||||
* resource.
|
||||
*
|
||||
* @param string $filename The filename (URI) that's being requested.
|
||||
* @return object An object of related URI information. The properties of
|
||||
* this object are:
|
||||
*
|
||||
*
|
||||
* status
|
||||
* the_request
|
||||
* status_line
|
||||
* method
|
||||
* content_type
|
||||
* handler
|
||||
* uri
|
||||
* filename
|
||||
* path_info
|
||||
* args
|
||||
* boundary
|
||||
* no_cache
|
||||
* no_local_copy
|
||||
* allowed
|
||||
* send_bodyct
|
||||
* bytes_sent
|
||||
* byterange
|
||||
* clength
|
||||
* unparsed_uri
|
||||
* mtime
|
||||
* request_time
|
||||
*
|
||||
*
|
||||
* Returns FALSE on failure.
|
||||
* @throws ApacheException
|
||||
*
|
||||
*/
|
||||
function apache_lookup_uri(string $filename): object
|
||||
{
|
||||
error_clear_last();
|
||||
$safeResult = \apache_lookup_uri($filename);
|
||||
if ($safeResult === false) {
|
||||
throw ApacheException::createFromPhpError();
|
||||
}
|
||||
return $safeResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetches all HTTP request headers from the current request. Works in the
|
||||
* Apache, FastCGI, CLI, and FPM webservers.
|
||||
*
|
||||
* @return array An associative array of all the HTTP headers in the current request.
|
||||
* @throws ApacheException
|
||||
*
|
||||
*/
|
||||
function apache_request_headers(): array
|
||||
{
|
||||
error_clear_last();
|
||||
$safeResult = \apache_request_headers();
|
||||
if ($safeResult === false) {
|
||||
throw ApacheException::createFromPhpError();
|
||||
}
|
||||
return $safeResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch all HTTP response headers. Works in the
|
||||
* Apache, FastCGI, CLI, and FPM webservers.
|
||||
*
|
||||
* @return array An array of all Apache response headers on success.
|
||||
* @throws ApacheException
|
||||
*
|
||||
*/
|
||||
function apache_response_headers(): array
|
||||
{
|
||||
error_clear_last();
|
||||
$safeResult = \apache_response_headers();
|
||||
if ($safeResult === false) {
|
||||
throw ApacheException::createFromPhpError();
|
||||
}
|
||||
return $safeResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* apache_setenv sets the value of the Apache
|
||||
* environment variable specified by
|
||||
* variable.
|
||||
*
|
||||
* @param string $variable The environment variable that's being set.
|
||||
* @param string $value The new variable value.
|
||||
* @param bool $walk_to_top Whether to set the top-level variable available to all Apache layers.
|
||||
* @throws ApacheException
|
||||
*
|
||||
*/
|
||||
function apache_setenv(string $variable, string $value, bool $walk_to_top = false): void
|
||||
{
|
||||
error_clear_last();
|
||||
$safeResult = \apache_setenv($variable, $value, $walk_to_top);
|
||||
if ($safeResult === false) {
|
||||
throw ApacheException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetches all HTTP headers from the current request.
|
||||
*
|
||||
* This function is an alias for apache_request_headers.
|
||||
* Please read the apache_request_headers
|
||||
* documentation for more information on how this function works.
|
||||
*
|
||||
* @return array An associative array of all the HTTP headers in the current request.
|
||||
* @throws ApacheException
|
||||
*
|
||||
*/
|
||||
function getallheaders(): array
|
||||
{
|
||||
error_clear_last();
|
||||
$safeResult = \getallheaders();
|
||||
if ($safeResult === false) {
|
||||
throw ApacheException::createFromPhpError();
|
||||
}
|
||||
return $safeResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virtual is an Apache-specific function which
|
||||
* is similar to <!--#include virtual...--> in
|
||||
* mod_include.
|
||||
* It performs an Apache sub-request. It is useful for including
|
||||
* CGI scripts or .shtml files, or anything else that you would
|
||||
* parse through Apache. Note that for a CGI script, the script
|
||||
* must generate valid CGI headers. At the minimum that means it
|
||||
* must generate a Content-Type header.
|
||||
*
|
||||
* To run the sub-request, all buffers are terminated and flushed to the
|
||||
* browser, pending headers are sent too.
|
||||
*
|
||||
* @param string $uri The file that the virtual command will be performed on.
|
||||
* @throws ApacheException
|
||||
*
|
||||
*/
|
||||
function virtual(string $uri): void
|
||||
{
|
||||
error_clear_last();
|
||||
$safeResult = \virtual($uri);
|
||||
if ($safeResult === false) {
|
||||
throw ApacheException::createFromPhpError();
|
||||
}
|
||||
}
|
112
vendor/thecodingmachine/safe/generated/apcu.php
vendored
Normal file
112
vendor/thecodingmachine/safe/generated/apcu.php
vendored
Normal file
|
@ -0,0 +1,112 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\ApcuException;
|
||||
|
||||
/**
|
||||
* Retrieves cached information and meta-data from APC's data store.
|
||||
*
|
||||
* @param bool $limited If limited is TRUE, the
|
||||
* return value will exclude the individual list of cache entries. This
|
||||
* is useful when trying to optimize calls for statistics gathering.
|
||||
* @return array Array of cached data (and meta-data)
|
||||
* @throws ApcuException
|
||||
*
|
||||
*/
|
||||
function apcu_cache_info(bool $limited = false): array
|
||||
{
|
||||
error_clear_last();
|
||||
$safeResult = \apcu_cache_info($limited);
|
||||
if ($safeResult === false) {
|
||||
throw ApcuException::createFromPhpError();
|
||||
}
|
||||
return $safeResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* apcu_cas updates an already existing integer value if the
|
||||
* old parameter matches the currently stored value
|
||||
* with the value of the new parameter.
|
||||
*
|
||||
* @param string $key The key of the value being updated.
|
||||
* @param int $old The old value (the value currently stored).
|
||||
* @param int $new The new value to update to.
|
||||
* @throws ApcuException
|
||||
*
|
||||
*/
|
||||
function apcu_cas(string $key, int $old, int $new): void
|
||||
{
|
||||
error_clear_last();
|
||||
$safeResult = \apcu_cas($key, $old, $new);
|
||||
if ($safeResult === false) {
|
||||
throw ApcuException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Decreases a stored integer value.
|
||||
*
|
||||
* @param string $key The key of the value being decreased.
|
||||
* @param int $step The step, or value to decrease.
|
||||
* @param bool|null $success Optionally pass the success or fail boolean value to
|
||||
* this referenced variable.
|
||||
* @param int $ttl TTL to use if the operation inserts a new value (rather than decrementing an existing one).
|
||||
* @return int Returns the current value of key's value on success
|
||||
* @throws ApcuException
|
||||
*
|
||||
*/
|
||||
function apcu_dec(string $key, int $step = 1, ?bool &$success = null, int $ttl = 0): int
|
||||
{
|
||||
error_clear_last();
|
||||
$safeResult = \apcu_dec($key, $step, $success, $ttl);
|
||||
if ($safeResult === false) {
|
||||
throw ApcuException::createFromPhpError();
|
||||
}
|
||||
return $safeResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Increases a stored number.
|
||||
*
|
||||
* @param string $key The key of the value being increased.
|
||||
* @param int $step The step, or value to increase.
|
||||
* @param bool|null $success Optionally pass the success or fail boolean value to
|
||||
* this referenced variable.
|
||||
* @param int $ttl TTL to use if the operation inserts a new value (rather than incrementing an existing one).
|
||||
* @return int Returns the current value of key's value on success
|
||||
* @throws ApcuException
|
||||
*
|
||||
*/
|
||||
function apcu_inc(string $key, int $step = 1, ?bool &$success = null, int $ttl = 0): int
|
||||
{
|
||||
error_clear_last();
|
||||
$safeResult = \apcu_inc($key, $step, $success, $ttl);
|
||||
if ($safeResult === false) {
|
||||
throw ApcuException::createFromPhpError();
|
||||
}
|
||||
return $safeResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves APCu Shared Memory Allocation information.
|
||||
*
|
||||
* @param bool $limited When set to FALSE (default) apcu_sma_info will
|
||||
* return a detailed information about each segment.
|
||||
* @return array Array of Shared Memory Allocation data; FALSE on failure.
|
||||
* @throws ApcuException
|
||||
*
|
||||
*/
|
||||
function apcu_sma_info(bool $limited = false): array
|
||||
{
|
||||
error_clear_last();
|
||||
$safeResult = \apcu_sma_info($limited);
|
||||
if ($safeResult === false) {
|
||||
throw ApcuException::createFromPhpError();
|
||||
}
|
||||
return $safeResult;
|
||||
}
|
59
vendor/thecodingmachine/safe/generated/array.php
vendored
Normal file
59
vendor/thecodingmachine/safe/generated/array.php
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\ArrayException;
|
||||
|
||||
/**
|
||||
* Applies the user-defined callback function to each
|
||||
* element of the array. This function will recurse
|
||||
* into deeper arrays.
|
||||
*
|
||||
* @param array|object $array The input array.
|
||||
* @param callable $callback Typically, callback takes on two parameters.
|
||||
* The array parameter's value being the first, and
|
||||
* the key/index second.
|
||||
*
|
||||
* If callback needs to be working with the
|
||||
* actual values of the array, specify the first parameter of
|
||||
* callback as a
|
||||
* reference. Then,
|
||||
* any changes made to those elements will be made in the
|
||||
* original array itself.
|
||||
* @param mixed $arg If the optional arg parameter is supplied,
|
||||
* it will be passed as the third parameter to the
|
||||
* callback.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function array_walk_recursive(&$array, callable $callback, $arg = null): void
|
||||
{
|
||||
error_clear_last();
|
||||
if ($arg !== null) {
|
||||
$safeResult = \array_walk_recursive($array, $callback, $arg);
|
||||
} else {
|
||||
$safeResult = \array_walk_recursive($array, $callback);
|
||||
}
|
||||
if ($safeResult === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function shuffles (randomizes the order of the elements in) an array.
|
||||
* It uses a pseudo random number generator that is not suitable for
|
||||
* cryptographic purposes.
|
||||
*
|
||||
* @param array $array The array.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function shuffle(array &$array): void
|
||||
{
|
||||
error_clear_last();
|
||||
$safeResult = \shuffle($array);
|
||||
if ($safeResult === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
97
vendor/thecodingmachine/safe/generated/bzip2.php
vendored
Normal file
97
vendor/thecodingmachine/safe/generated/bzip2.php
vendored
Normal file
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\Bzip2Exception;
|
||||
|
||||
/**
|
||||
* Closes the given bzip2 file pointer.
|
||||
*
|
||||
* @param resource $bz The file pointer. It must be valid and must point to a file
|
||||
* successfully opened by bzopen.
|
||||
* @throws Bzip2Exception
|
||||
*
|
||||
*/
|
||||
function bzclose($bz): void
|
||||
{
|
||||
error_clear_last();
|
||||
$safeResult = \bzclose($bz);
|
||||
if ($safeResult === false) {
|
||||
throw Bzip2Exception::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function is supposed to force a write of all buffered bzip2 data for the file pointer
|
||||
* bz,
|
||||
* but is implemented as null function in libbz2, and as such does nothing.
|
||||
*
|
||||
* @param resource $bz The file pointer. It must be valid and must point to a file
|
||||
* successfully opened by bzopen.
|
||||
* @throws Bzip2Exception
|
||||
*
|
||||
*/
|
||||
function bzflush($bz): void
|
||||
{
|
||||
error_clear_last();
|
||||
$safeResult = \bzflush($bz);
|
||||
if ($safeResult === false) {
|
||||
throw Bzip2Exception::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* bzread reads from the given bzip2 file pointer.
|
||||
*
|
||||
* Reading stops when length (uncompressed) bytes have
|
||||
* been read or EOF is reached, whichever comes first.
|
||||
*
|
||||
* @param resource $bz The file pointer. It must be valid and must point to a file
|
||||
* successfully opened by bzopen.
|
||||
* @param int $length If not specified, bzread will read 1024
|
||||
* (uncompressed) bytes at a time. A maximum of 8192
|
||||
* uncompressed bytes will be read at a time.
|
||||
* @return string Returns the uncompressed data.
|
||||
* @throws Bzip2Exception
|
||||
*
|
||||
*/
|
||||
function bzread($bz, int $length = 1024): string
|
||||
{
|
||||
error_clear_last();
|
||||
$safeResult = \bzread($bz, $length);
|
||||
if ($safeResult === false) {
|
||||
throw Bzip2Exception::createFromPhpError();
|
||||
}
|
||||
return $safeResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* bzwrite writes a string into the given bzip2 file
|
||||
* stream.
|
||||
*
|
||||
* @param resource $bz The file pointer. It must be valid and must point to a file
|
||||
* successfully opened by bzopen.
|
||||
* @param string $data The written data.
|
||||
* @param int $length If supplied, writing will stop after length
|
||||
* (uncompressed) bytes have been written or the end of
|
||||
* data is reached, whichever comes first.
|
||||
* @return int Returns the number of bytes written.
|
||||
* @throws Bzip2Exception
|
||||
*
|
||||
*/
|
||||
function bzwrite($bz, string $data, int $length = null): int
|
||||
{
|
||||
error_clear_last();
|
||||
if ($length !== null) {
|
||||
$safeResult = \bzwrite($bz, $data, $length);
|
||||
} else {
|
||||
$safeResult = \bzwrite($bz, $data);
|
||||
}
|
||||
if ($safeResult === false) {
|
||||
throw Bzip2Exception::createFromPhpError();
|
||||
}
|
||||
return $safeResult;
|
||||
}
|
30
vendor/thecodingmachine/safe/generated/calendar.php
vendored
Normal file
30
vendor/thecodingmachine/safe/generated/calendar.php
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\CalendarException;
|
||||
|
||||
/**
|
||||
* Return the Julian Day for a Unix timestamp
|
||||
* (seconds since 1.1.1970), or for the current day if no
|
||||
* timestamp is given. Either way, the time is regarded
|
||||
* as local time (not UTC).
|
||||
*
|
||||
* @param int $timestamp A unix timestamp to convert.
|
||||
* @return int A julian day number as integer.
|
||||
* @throws CalendarException
|
||||
*
|
||||
*/
|
||||
function unixtojd(int $timestamp = null): int
|
||||
{
|
||||
error_clear_last();
|
||||
if ($timestamp !== null) {
|
||||
$safeResult = \unixtojd($timestamp);
|
||||
} else {
|
||||
$safeResult = \unixtojd();
|
||||
}
|
||||
if ($safeResult === false) {
|
||||
throw CalendarException::createFromPhpError();
|
||||
}
|
||||
return $safeResult;
|
||||
}
|
25
vendor/thecodingmachine/safe/generated/classobj.php
vendored
Normal file
25
vendor/thecodingmachine/safe/generated/classobj.php
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\ClassobjException;
|
||||
|
||||
/**
|
||||
* Creates an alias named alias
|
||||
* based on the user defined class class.
|
||||
* The aliased class is exactly the same as the original class.
|
||||
*
|
||||
* @param string $class The original class.
|
||||
* @param string $alias The alias name for the class.
|
||||
* @param bool $autoload Whether to autoload if the original class is not found.
|
||||
* @throws ClassobjException
|
||||
*
|
||||
*/
|
||||
function class_alias(string $class, string $alias, bool $autoload = true): void
|
||||
{
|
||||
error_clear_last();
|
||||
$safeResult = \class_alias($class, $alias, $autoload);
|
||||
if ($safeResult === false) {
|
||||
throw ClassobjException::createFromPhpError();
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue