update lock clucknut
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 14s
Build, Push and Deploy / build-and-push (push) Successful in 3m14s
Build, Push and Deploy / deploy-staging (push) Successful in 25s
Build, Push and Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-04-18 20:32:18 +07:00
parent 4554035227
commit dcaf267458
3359 changed files with 153185 additions and 205489 deletions

View File

@@ -5,9 +5,7 @@
use Safe\Exceptions\ApacheException;
/**
* Fetch the Apache version.
*
* @return string Returns the Apache version on success.
* @return string
* @throws ApacheException
*
*/
@@ -23,12 +21,9 @@ function apache_get_version(): string
/**
* 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
* @param string $variable
* @param bool $walk_to_top
* @return string
* @throws ApacheException
*
*/
@@ -44,39 +39,8 @@ function apache_getenv(string $variable, bool $walk_to_top = false): string
/**
* 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.
* @param string $filename
* @return object
* @throws ApacheException
*
*/
@@ -92,10 +56,7 @@ function apache_lookup_uri(string $filename): object
/**
* 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.
* @return array
* @throws ApacheException
*
*/
@@ -111,10 +72,7 @@ function apache_request_headers(): array
/**
* 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.
* @return array
* @throws ApacheException
*
*/
@@ -130,13 +88,9 @@ function apache_response_headers(): array
/**
* 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.
* @param string $variable
* @param string $value
* @param bool $walk_to_top
* @throws ApacheException
*
*/
@@ -151,13 +105,7 @@ function apache_setenv(string $variable, string $value, bool $walk_to_top = fals
/**
* 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.
* @return array
* @throws ApacheException
*
*/
@@ -173,19 +121,7 @@ function getallheaders(): array
/**
* 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.
* @param string $uri
* @throws ApacheException
*
*/

View File

@@ -5,12 +5,8 @@
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)
* @param bool $limited
* @return array
* @throws ApcuException
*
*/
@@ -26,13 +22,9 @@ function apcu_cache_info(bool $limited = false): array
/**
* 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.
* @param string $key
* @param int $old
* @param int $new
* @throws ApcuException
*
*/
@@ -47,14 +39,11 @@ function apcu_cas(string $key, int $old, int $new): void
/**
* 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
* @param string $key
* @param int $step
* @param bool|null $success
* @param int $ttl
* @return int
* @throws ApcuException
*
*/
@@ -70,14 +59,11 @@ function apcu_dec(string $key, int $step = 1, ?bool &$success = null, int $ttl =
/**
* 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
* @param string $key
* @param int $step
* @param bool|null $success
* @param int $ttl
* @return int
* @throws ApcuException
*
*/
@@ -93,11 +79,8 @@ function apcu_inc(string $key, int $step = 1, ?bool &$success = null, int $ttl =
/**
* 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.
* @param bool $limited
* @return array
* @throws ApcuException
*
*/

View File

@@ -5,15 +5,9 @@
use Safe\Exceptions\ArrayException;
/**
* 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.
* @param array $keys
* @param array $values
* @return array
* @throws ArrayException
*
*/
@@ -29,21 +23,8 @@ function array_combine(array $keys, array $values): array
/**
* 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 int 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.
* @param array $array
* @return array
* @throws ArrayException
*
*/
@@ -59,27 +40,9 @@ function array_flip(array $array): array
/**
* 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.
* @param array $array
* @param array $replacements
* @return array
* @throws ArrayException
*
*/
@@ -99,22 +62,9 @@ function array_replace_recursive(array $array, array ...$replacements): array
/**
* 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.
* @param array $array
* @param array $replacements
* @return array
* @throws ArrayException
*
*/
@@ -134,24 +84,9 @@ function array_replace(array $array, array ...$replacements): array
/**
* 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.
* @param array|object $array
* @param callable $callback
* @param mixed $arg
* @throws ArrayException
*
*/
@@ -170,11 +105,7 @@ function array_walk_recursive(&$array, callable $callback, $arg = null): void
/**
* 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.
* @param array $array
* @throws ArrayException
*
*/

View File

@@ -5,10 +5,7 @@
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.
* @param resource $bz
* @throws Bzip2Exception
*
*/
@@ -23,12 +20,7 @@ function bzclose($bz): void
/**
* 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.
* @param resource $bz
* @throws Bzip2Exception
*
*/
@@ -43,14 +35,9 @@ function bzflush($bz): void
/**
* bzopen opens a bzip2 (.bz2) file for reading or
* writing.
*
* @param resource|string $file The name of the file to open, or an existing stream resource.
* @param string $mode The modes 'r' (read), and 'w' (write) are supported.
* Everything else will cause bzopen to return FALSE.
* @return resource If the open fails, bzopen returns FALSE, otherwise
* it returns a pointer to the newly opened file.
* @param resource|string $file
* @param string $mode
* @return resource
* @throws Bzip2Exception
*
*/
@@ -66,17 +53,9 @@ function bzopen($file, string $mode)
/**
* 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.
* @param resource $bz
* @param int $length
* @return string
* @throws Bzip2Exception
*
*/
@@ -92,16 +71,10 @@ function bzread($bz, int $length = 1024): string
/**
* 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|null $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.
* @param resource $bz
* @param string $data
* @param int|null $length
* @return int
* @throws Bzip2Exception
*
*/

View File

@@ -5,13 +5,8 @@
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|null $timestamp A unix timestamp to convert.
* @return int A julian day number as integer.
* @param int|null $timestamp
* @return int
* @throws CalendarException
*
*/

View File

@@ -5,13 +5,9 @@
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.
* @param string $class
* @param string $alias
* @param bool $autoload
* @throws ClassobjException
*
*/

View File

@@ -5,12 +5,7 @@
use Safe\Exceptions\ComException;
/**
* Generates a Globally Unique Identifier (GUID).
*
* A GUID is generated in the same way as DCE UUID's, except that the
* Microsoft convention is to enclose a GUID in curly braces.
*
* @return string Returns the GUID as a string.
* @return string
* @throws ComException
*
*/
@@ -26,24 +21,9 @@ function com_create_guid(): string
/**
* Instructs COM to sink events generated by
* variant into the PHP object
* sink_object.
*
* Be careful how you use this feature; if you are doing something similar
* to the example below, then it doesn't really make sense to run it in a
* web server context.
*
* @param object $variant
* @param object $sink_object sink_object should be an instance of a class with
* methods named after those of the desired dispinterface; you may use
* com_print_typeinfo to help generate a template class
* for this purpose.
* @param mixed $sink_interface PHP will attempt to use the default dispinterface type specified by
* the typelibrary associated with variant, but
* you may override this choice by setting
* sink_interface to the name of the dispinterface
* that you want to use.
* @param object $sink_object
* @param mixed $sink_interface
* @throws ComException
*
*/
@@ -62,54 +42,8 @@ function com_event_sink(object $variant, object $sink_object, $sink_interface =
/**
* Loads a type-library and registers its constants in the engine, as though
* they were defined using define.
*
* Note that it is much more efficient to use the configuration setting to pre-load and
* register the constants, although not so flexible.
*
* If you have turned on , then
* PHP will attempt to automatically register the constants associated with a
* COM object when you instantiate it. This depends on the interfaces
* provided by the COM object itself, and may not always be possible.
*
* @param string $typelib typelib can be one of the following:
*
*
*
* The filename of a .tlb file or the executable module
* that contains the type library.
*
*
*
*
* The type library GUID, followed by its version number, for example
* {00000200-0000-0010-8000-00AA006D2EA4},2,0.
*
*
*
*
* The type library name, e.g. Microsoft OLE DB ActiveX Data
* Objects 1.0 Library.
*
*
*
* PHP will attempt to resolve the type library in this order, as the
* process gets more and more expensive as you progress down the list;
* searching for the type library by name is handled by physically
* enumerating the registry until we find a match.
*
* The filename of a .tlb file or the executable module
* that contains the type library.
*
* The type library GUID, followed by its version number, for example
* {00000200-0000-0010-8000-00AA006D2EA4},2,0.
*
* The type library name, e.g. Microsoft OLE DB ActiveX Data
* Objects 1.0 Library.
* @param bool $case_insensitive The case_insensitive behaves inversely to
* the parameter $case_insensitive in the define
* function.
* @param string $typelib
* @param bool $case_insensitive
* @throws ComException
*
*/
@@ -124,17 +58,9 @@ function com_load_typelib(string $typelib, bool $case_insensitive = true): void
/**
* The purpose of this function is to help generate a skeleton class for use
* as an event sink. You may also use it to generate a dump of any COM
* object, provided that it supports enough of the introspection interfaces,
* and that you know the name of the interface you want to display.
*
* @param object $variant variant should be either an instance of a COM
* object, or be the name of a typelibrary (which will be resolved according
* to the rules set out in com_load_typelib).
* @param null|string $dispatch_interface The name of an IDispatch descendant interface that you want to display.
* @param bool $display_sink If set to TRUE, the corresponding sink interface will be displayed
* instead.
* @param object $variant
* @param null|string $dispatch_interface
* @param bool $display_sink
* @throws ComException
*
*/
@@ -155,12 +81,8 @@ function com_print_typeinfo(object $variant, ?string $dispatch_interface = null,
/**
* Converts variant from a VT_DATE
* (or similar) value into a Unix timestamp. This allows easier
* interopability between the Unix-ish parts of PHP and COM.
*
* @param object $variant The variant.
* @return int Returns a unix timestamp.
* @param object $variant
* @return int
* @throws ComException
*
*/
@@ -176,12 +98,9 @@ function variant_date_to_timestamp(object $variant): int
/**
* Returns the value of value rounded to
* decimals decimal places.
*
* @param mixed $value The variant.
* @param int $decimals Number of decimal places.
* @return mixed Returns the rounded value.
* @param mixed $value
* @param int $decimals
* @return mixed
* @throws ComException
*
*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -5,11 +5,9 @@
use Safe\Exceptions\DatetimeException;
/**
* Returns associative array with detailed info about given date/time.
*
* @param string $format Format accepted by DateTime::createFromFormat.
* @param string $datetime String representing the date/time.
* @return array{year: int|false, month: int|false, day: int|false, hour: int|false, minute: int|false, second: int|false, fraction: float|false, warning_count: int, warnings: string[], error_count: int, errors: string[], is_localtime: bool, zone_type: int|bool, zone: int|bool, is_dst: bool, tz_abbr: string, tz_id: string, relative: array{year: int, month: int, day: int, hour: int, minute: int, second: int, weekday: int, weekdays: int, first_day_of_month: bool, last_day_of_month: bool}}|null Returns associative array with detailed info about given date/time.
* @param string $format
* @param string $datetime
* @return array{year: int|false, month: int|false, day: int|false, hour: int|false, minute: int|false, second: int|false, fraction: float|false, warning_count: int, warnings: string[], error_count: int, errors: string[], is_localtime: bool, zone_type: int|bool, zone: int|bool, is_dst: bool, tz_abbr: string, tz_id: string, relative: array{year: int, month: int, day: int, hour: int, minute: int, second: int, weekday: int, weekdays: int, first_day_of_month: bool, last_day_of_month: bool}}|null
* @throws DatetimeException
*
*/
@@ -25,12 +23,8 @@ function date_parse_from_format(string $format, string $datetime): ?array
/**
*
*
* @param string $datetime Date/time in format accepted by
* DateTimeImmutable::__construct.
* @return array{year: int|false, month: int|false, day: int|false, hour: int|false, minute: int|false, second: int|false, fraction: float|false, warning_count: int, warnings: string[], error_count: int, errors: string[], is_localtime: bool, zone_type: int|bool, zone: int|bool, is_dst: bool, tz_abbr: string, tz_id: string, relative: array{year: int, month: int, day: int, hour: int, minute: int, second: int, weekday: int, weekdays: int, first_day_of_month: bool, last_day_of_month: bool}}|null Returns array with information about the parsed date/time
* on success.
* @param string $datetime
* @return array{year: int|false, month: int|false, day: int|false, hour: int|false, minute: int|false, second: int|false, fraction: float|false, warning_count: int, warnings: string[], error_count: int, errors: string[], is_localtime: bool, zone_type: int|bool, zone: int|bool, is_dst: bool, tz_abbr: string, tz_id: string, relative: array{year: int, month: int, day: int, hour: int, minute: int, second: int, weekday: int, weekdays: int, first_day_of_month: bool, last_day_of_month: bool}}|null
* @throws DatetimeException
*
*/
@@ -46,97 +40,10 @@ function date_parse(string $datetime): ?array
/**
*
*
* @param int $timestamp Unix timestamp.
* @param float $latitude Latitude in degrees.
* @param float $longitude Longitude in degrees.
* @return array{sunrise: int|bool,sunset: int|bool,transit: int|bool,civil_twilight_begin: int|bool,civil_twilight_end: int|bool,nautical_twilight_begin: int|bool,nautical_twilight_end: int|bool,astronomical_twilight_begin: int|bool,astronomical_twilight_end: int|bool} Returns array on success.
* The structure of the array is detailed in the following list:
*
*
*
* sunrise
*
*
* The timestamp of the sunrise (zenith angle = 90°35').
*
*
*
*
* sunset
*
*
* The timestamp of the sunset (zenith angle = 90°35').
*
*
*
*
* transit
*
*
* The timestamp when the sun is at its zenith, i.e. has reached its topmost
* point.
*
*
*
*
* civil_twilight_begin
*
*
* The start of the civil dawn (zenith angle = 96°). It ends at sunrise.
*
*
*
*
* civil_twilight_end
*
*
* The end of the civil dusk (zenith angle = 96°). It starts at sunset.
*
*
*
*
* nautical_twilight_begin
*
*
* The start of the nautical dawn (zenith angle = 102°). It ends at
* civil_twilight_begin.
*
*
*
*
* nautical_twilight_end
*
*
* The end of the nautical dusk (zenith angle = 102°). It starts at
* civil_twilight_end.
*
*
*
*
* astronomical_twilight_begin
*
*
* The start of the astronomical dawn (zenith angle = 108°). It ends at
* nautical_twilight_begin.
*
*
*
*
* astronomical_twilight_end
*
*
* The end of the astronomical dusk (zenith angle = 108°). It starts at
* nautical_twilight_end.
*
*
*
*
*
* The values of the array elements are either UNIX timestamps, FALSE if the
* sun is below the respective zenith for the whole day, or TRUE if the sun is
* above the respective zenith for the whole day.
* @param int $timestamp
* @param float $latitude
* @param float $longitude
* @return array{sunrise: int|bool,sunset: int|bool,transit: int|bool,civil_twilight_begin: int|bool,civil_twilight_end: int|bool,nautical_twilight_begin: int|bool,nautical_twilight_end: int|bool,astronomical_twilight_begin: int|bool,astronomical_twilight_end: int|bool}
* @throws DatetimeException
*
*/
@@ -152,84 +59,13 @@ function date_sun_info(int $timestamp, float $latitude, float $longitude): array
/**
* date_sunrise returns the sunrise time for a given
* day (specified as a timestamp) and location.
*
* @param int $timestamp The timestamp of the day from which the sunrise
* time is taken.
* @param int $timestamp
* @param int $returnFormat
* returnFormat constants
*
*
*
* constant
* description
* example
*
*
*
*
* SUNFUNCS_RET_STRING
* returns the result as string
* 16:46
*
*
* SUNFUNCS_RET_DOUBLE
* returns the result as float
* 16.78243132
*
*
* SUNFUNCS_RET_TIMESTAMP
* returns the result as int (timestamp)
* 1095034606
*
*
*
*
* @param float|null $latitude Defaults to North, pass in a negative value for South.
* See also: date.default_latitude
* @param float|null $longitude Defaults to East, pass in a negative value for West.
* See also: date.default_longitude
* @param float|null $zenith zenith is the angle between the center of the sun
* and a line perpendicular to earth's surface. It defaults to
* date.sunrise_zenith
*
* Common zenith angles
*
*
*
* Angle
* Description
*
*
*
*
* 90°50'
* Sunrise: the point where the sun becomes visible.
*
*
* 96°
* Civil twilight: conventionally used to signify the start of dawn.
*
*
* 102°
* Nautical twilight: the point at which the horizon starts being visible at sea.
*
*
* 108°
* Astronomical twilight: the point at which the sun starts being the source of any illumination.
*
*
*
*
* @param float|null $utcOffset Specified in hours.
* The utcOffset is ignored, if
* returnFormat is
* SUNFUNCS_RET_TIMESTAMP.
* @return mixed Returns the sunrise time in a specified returnFormat on
* success. One potential reason for failure is that the
* sun does not rise at all, which happens inside the polar circles for part of
* the year.
* @param float|null $latitude
* @param float|null $longitude
* @param float|null $zenith
* @param float|null $utcOffset
* @return mixed
* @throws DatetimeException
*
*/
@@ -255,84 +91,13 @@ function date_sunrise(int $timestamp, int $returnFormat = SUNFUNCS_RET_STRING, ?
/**
* date_sunset returns the sunset time for a given
* day (specified as a timestamp) and location.
*
* @param int $timestamp The timestamp of the day from which the sunset
* time is taken.
* @param int $timestamp
* @param int $returnFormat
* returnFormat constants
*
*
*
* constant
* description
* example
*
*
*
*
* SUNFUNCS_RET_STRING
* returns the result as string
* 16:46
*
*
* SUNFUNCS_RET_DOUBLE
* returns the result as float
* 16.78243132
*
*
* SUNFUNCS_RET_TIMESTAMP
* returns the result as int (timestamp)
* 1095034606
*
*
*
*
* @param float|null $latitude Defaults to North, pass in a negative value for South.
* See also: date.default_latitude
* @param float|null $longitude Defaults to East, pass in a negative value for West.
* See also: date.default_longitude
* @param float|null $zenith zenith is the angle between the center of the sun
* and a line perpendicular to earth's surface. It defaults to
* date.sunset_zenith
*
* Common zenith angles
*
*
*
* Angle
* Description
*
*
*
*
* 90°50'
* Sunset: the point where the sun becomes invisible.
*
*
* 96°
* Civil twilight: conventionally used to signify the end of dusk.
*
*
* 102°
* Nautical twilight: the point at which the horizon ends being visible at sea.
*
*
* 108°
* Astronomical twilight: the point at which the sun ends being the source of any illumination.
*
*
*
*
* @param float|null $utcOffset Specified in hours.
* The utcOffset is ignored, if
* returnFormat is
* SUNFUNCS_RET_TIMESTAMP.
* @return mixed Returns the sunset time in a specified returnFormat on
* success. One potential reason for failure is that the
* sun does not set at all, which happens inside the polar circles for part of
* the year.
* @param float|null $latitude
* @param float|null $longitude
* @param float|null $zenith
* @param float|null $utcOffset
* @return mixed
* @throws DatetimeException
*
*/
@@ -358,19 +123,9 @@ function date_sunset(int $timestamp, int $returnFormat = SUNFUNCS_RET_STRING, ?f
/**
* Returns a string formatted according to the given format string using the
* given integer timestamp or the current time
* if no timestamp is given. In other words, timestamp
* is optional and defaults to the value of time.
*
* @param string $format Format accepted by DateTimeInterface::format.
* @param int|null $timestamp The optional timestamp parameter is an
* int Unix timestamp that defaults to the current
* local time if timestamp is omitted or NULL. 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.
* @param string $format
* @param int|null $timestamp
* @return string
* @throws DatetimeException
*
*/
@@ -390,34 +145,13 @@ function date(string $format, ?int $timestamp = null): string
/**
* Identical to mktime except the passed parameters represents a
* GMT date. gmmktime internally uses mktime
* so only times valid in derived local time can be used.
*
* Like mktime, arguments may be left out in order
* from right to left, with any omitted arguments being set to the
* current corresponding GMT value.
*
* @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|null $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|null $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|null $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|null $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|null $year The year
* @return int Returns a int Unix timestamp on success.
* @param int $hour
* @param int|null $minute
* @param int|null $second
* @param int|null $month
* @param int|null $day
* @param int|null $year
* @return int
* @throws DatetimeException
*
*/
@@ -445,23 +179,9 @@ function gmmktime(int $hour, ?int $minute = null, ?int $second = null, ?int $mon
/**
* Behaves the same as strftime except that the
* time returned is Greenwich Mean Time (GMT). For example, when run
* in Eastern Standard Time (GMT -0500), the first line below prints
* "Dec 31 1998 20:00:00", while the second prints "Jan 01 1999
* 01:00:00".
*
* @param string $format See description in strftime.
* @param int|null $timestamp The optional timestamp parameter is an
* int Unix timestamp that defaults to the current
* local time if timestamp is omitted or NULL. In other
* words, it defaults to the value of time.
* @return string Returns a string formatted according to the given format string
* using the given timestamp or the current
* local time if no timestamp is given. Month and weekday names and
* other language dependent strings respect the current locale set
* with setlocale.
* On failure, FALSE is returned.
* @param string $format
* @param int|null $timestamp
* @return string
* @throws DatetimeException
*
*/
@@ -481,109 +201,9 @@ function gmstrftime(string $format, ?int $timestamp = null): string
/**
* Returns a number formatted according to the given format string using the
* given integer timestamp or the current local time
* if no timestamp is given. In other words, timestamp
* is optional and defaults to the value of time.
*
* Unlike the function date, idate
* accepts just one char in the format parameter.
*
* @param string $format
* The following characters are recognized in the
* format parameter string
*
*
*
* format character
* Description
*
*
*
*
* B
* Swatch Beat/Internet Time
*
*
* d
* Day of the month
*
*
* h
* Hour (12 hour format)
*
*
* H
* Hour (24 hour format)
*
*
* i
* Minutes
*
*
* I (uppercase i)
* returns 1 if DST is activated,
* 0 otherwise
*
*
* L (uppercase l)
* returns 1 for leap year,
* 0 otherwise
*
*
* m
* Month number
*
*
* s
* Seconds
*
*
* t
* Days in current month
*
*
* U
* Seconds since the Unix Epoch - January 1 1970 00:00:00 UTC -
* this is the same as time
*
*
* w
* Day of the week (0 on Sunday)
*
*
* W
* ISO-8601 week number of year, weeks starting on
* Monday
*
*
* y
* Year (1 or 2 digits - check note below)
*
*
* Y
* Year (4 digits)
*
*
* z
* Day of the year
*
*
* Z
* Timezone offset in seconds
*
*
*
*
* @param int|null $timestamp The optional timestamp parameter is an
* int Unix timestamp that defaults to the current
* local time if timestamp is omitted or NULL. In other
* words, it defaults to the value of time.
* @return int Returns an int on success.
*
* As idate always returns an int and
* as they can't start with a "0", idate may return
* fewer digits than you would expect. See the example below.
* @param int|null $timestamp
* @return int
* @throws DatetimeException
*
*/
@@ -603,41 +223,13 @@ function idate(string $format, ?int $timestamp = null): int
/**
* 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|null $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|null $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|null $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|null $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|null $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.
* @param int $hour
* @param int|null $minute
* @param int|null $second
* @param int|null $month
* @param int|null $day
* @param int|null $year
* @return int
* @throws DatetimeException
*
*/
@@ -665,310 +257,9 @@ function mktime(int $hour, ?int $minute = null, ?int $second = null, ?int $month
/**
* Format the time and/or date according to locale settings. Month and weekday
* names and other language-dependent strings respect the current locale set
* with setlocale.
*
* Not all conversion specifiers may be supported by your C library, in which
* case they will not be supported by PHP's strftime.
* Additionally, not all platforms support negative timestamps, so your
* date range may be limited to no earlier than the Unix epoch. This means that
* %e, %T, %R and, %D (and possibly others) - as well as dates prior to
* Jan 1, 1970 - will not work on Windows, some Linux
* distributions, and a few other operating systems. For Windows systems, a
* complete overview of supported conversion specifiers can be found at
* MSDN.
*
* @param string $format
* The following characters are recognized in the
* format parameter string
*
*
*
* format
* Description
* Example returned values
*
*
*
*
* Day
* ---
* ---
*
*
* %a
* An abbreviated textual representation of the day
* Sun through Sat
*
*
* %A
* A full textual representation of the day
* Sunday through Saturday
*
*
* %d
* Two-digit day of the month (with leading zeros)
* 01 to 31
*
*
* %e
*
* Day of the month, with a space preceding single digits. Not
* implemented as described on Windows. See below for more information.
*
* 1 to 31
*
*
* %j
* Day of the year, 3 digits with leading zeros
* 001 to 366
*
*
* %u
* ISO-8601 numeric representation of the day of the week
* 1 (for Monday) through 7 (for Sunday)
*
*
* %w
* Numeric representation of the day of the week
* 0 (for Sunday) through 6 (for Saturday)
*
*
* Week
* ---
* ---
*
*
* %U
* Week number of the given year, starting with the first
* Sunday as the first week
* 13 (for the 13th full week of the year)
*
*
* %V
* ISO-8601:1988 week number of the given year, starting with
* the first week of the year with at least 4 weekdays, with Monday
* being the start of the week
* 01 through 53 (where 53
* accounts for an overlapping week)
*
*
* %W
* A numeric representation of the week of the year, starting
* with the first Monday as the first week
* 46 (for the 46th week of the year beginning
* with a Monday)
*
*
* Month
* ---
* ---
*
*
* %b
* Abbreviated month name, based on the locale
* Jan through Dec
*
*
* %B
* Full month name, based on the locale
* January through December
*
*
* %h
* Abbreviated month name, based on the locale (an alias of %b)
* Jan through Dec
*
*
* %m
* Two digit representation of the month
* 01 (for January) through 12 (for December)
*
*
* Year
* ---
* ---
*
*
* %C
* Two digit representation of the century (year divided by 100, truncated to an integer)
* 19 for the 20th Century
*
*
* %g
* Two digit representation of the year going by ISO-8601:1988 standards (see %V)
* Example: 09 for the week of January 6, 2009
*
*
* %G
* The full four-digit version of %g
* Example: 2008 for the week of January 3, 2009
*
*
* %y
* Two digit representation of the year
* Example: 09 for 2009, 79 for 1979
*
*
* %Y
* Four digit representation for the year
* Example: 2038
*
*
* Time
* ---
* ---
*
*
* %H
* Two digit representation of the hour in 24-hour format
* 00 through 23
*
*
* %k
* Hour in 24-hour format, with a space preceding single digits
* 0 through 23
*
*
* %I
* Two digit representation of the hour in 12-hour format
* 01 through 12
*
*
* %l (lower-case 'L')
* Hour in 12-hour format, with a space preceding single digits
* 1 through 12
*
*
* %M
* Two digit representation of the minute
* 00 through 59
*
*
* %p
* UPPER-CASE 'AM' or 'PM' based on the given time
* Example: AM for 00:31, PM for 22:23
*
*
* %P
* lower-case 'am' or 'pm' based on the given time
* Example: am for 00:31, pm for 22:23
*
*
* %r
* Same as "%I:%M:%S %p"
* Example: 09:34:17 PM for 21:34:17
*
*
* %R
* Same as "%H:%M"
* Example: 00:35 for 12:35 AM, 16:44 for 4:44 PM
*
*
* %S
* Two digit representation of the second
* 00 through 59
*
*
* %T
* Same as "%H:%M:%S"
* Example: 21:34:17 for 09:34:17 PM
*
*
* %X
* Preferred time representation based on locale, without the date
* Example: 03:59:16 or 15:59:16
*
*
* %z
* The time zone offset. Not implemented as described on
* Windows. See below for more information.
* Example: -0500 for US Eastern Time
*
*
* %Z
* The time zone abbreviation. Not implemented as described on
* Windows. See below for more information.
* Example: EST for Eastern Time
*
*
* Time and Date Stamps
* ---
* ---
*
*
* %c
* Preferred date and time stamp based on locale
* Example: Tue Feb 5 00:45:10 2009 for
* February 5, 2009 at 12:45:10 AM
*
*
* %D
* Same as "%m/%d/%y"
* Example: 02/05/09 for February 5, 2009
*
*
* %F
* Same as "%Y-%m-%d" (commonly used in database datestamps)
* Example: 2009-02-05 for February 5, 2009
*
*
* %s
* Unix Epoch Time timestamp (same as the time
* function)
* Example: 305815200 for September 10, 1979 08:40:00 AM
*
*
* %x
* Preferred date representation based on locale, without the time
* Example: 02/05/09 for February 5, 2009
*
*
* Miscellaneous
* ---
* ---
*
*
* %n
* A newline character ("\n")
* ---
*
*
* %t
* A Tab character ("\t")
* ---
*
*
* %%
* A literal percentage character ("%")
* ---
*
*
*
*
*
* Windows only:
*
* The %e modifier is not supported in the Windows
* implementation of this function. To achieve this value, the
* %#d modifier can be used instead. The example below
* illustrates how to write a cross platform compatible function.
*
* The %z and %Z modifiers both
* return the time zone name instead of the offset or abbreviation.
* @param int|null $timestamp The optional timestamp parameter is an
* int Unix timestamp that defaults to the current
* local time if timestamp is omitted or NULL. In other
* words, it defaults to the value of time.
* @return string Returns a string formatted according format
* using the given timestamp or the current
* local time if no timestamp is given. Month and weekday names and
* other language-dependent strings respect the current locale set
* with setlocale.
* The function returns FALSE if format is empty, contains unsupported
* conversion specifiers, or if the length of the returned string would be greater than
* 4095.
* @param int|null $timestamp
* @return string
* @throws DatetimeException
*
*/
@@ -988,74 +279,9 @@ function strftime(string $format, ?int $timestamp = null): string
/**
* strptime returns an array with the
* timestamp parsed.
*
* Month and weekday names and other language dependent strings respect the
* current locale set with setlocale (LC_TIME).
*
* @param string $timestamp The string to parse (e.g. returned from strftime).
* @param string $format The format used in timestamp (e.g. the same as
* used in strftime). Note that some of the format
* options available to strftime may not have any
* effect within strptime; the exact subset that are
* supported will vary based on the operating system and C library in
* use.
*
* For more information about the format options, read the
* strftime page.
* @return array Returns an array.
*
*
* The following parameters are returned in the array
*
*
*
* parameters
* Description
*
*
*
*
* "tm_sec"
* Seconds after the minute (0-61)
*
*
* "tm_min"
* Minutes after the hour (0-59)
*
*
* "tm_hour"
* Hour since midnight (0-23)
*
*
* "tm_mday"
* Day of the month (1-31)
*
*
* "tm_mon"
* Months since January (0-11)
*
*
* "tm_year"
* Years since 1900
*
*
* "tm_wday"
* Days since Sunday (0-6)
*
*
* "tm_yday"
* Days since January 1 (0-365)
*
*
* "unparsed"
* the timestamp part which was not
* recognized using the specified format
*
*
*
*
* @param string $timestamp
* @param string $format
* @return array
* @throws DatetimeException
*
*/
@@ -1071,16 +297,9 @@ function strptime(string $timestamp, string $format): array
/**
* Each parameter of this function uses the default time zone unless a
* time zone is specified in that parameter. Be careful not to use
* different time zones in each parameter unless that is intended.
* See date_default_timezone_get on the various
* ways to define the default time zone.
*
* @param string $datetime A date/time string. Valid formats are explained in Date and Time Formats.
* @param int|null $baseTimestamp The timestamp which is used as a base for the calculation of relative
* dates.
* @return int Returns a timestamp on success.
* @param string $datetime
* @param int|null $baseTimestamp
* @return int
* @throws DatetimeException
*
*/
@@ -1100,23 +319,10 @@ function strtotime(string $datetime, ?int $baseTimestamp = null): int
/**
*
*
* @param string $abbr Time zone abbreviation.
* @param int $utcOffset Offset from GMT in seconds. Defaults to -1 which means that first found
* time zone corresponding to abbr is returned.
* Otherwise exact offset is searched and only if not found then the first
* time zone with any offset is returned.
* @param int $isDST Daylight saving time indicator. Defaults to -1, which means that
* whether the time zone has daylight saving or not is not taken into
* consideration when searching. If this is set to 1, then the
* utcOffset is assumed to be an offset with
* daylight saving in effect; if 0, then utcOffset
* is assumed to be an offset without daylight saving in effect. If
* abbr doesn't exist then the time zone is
* searched solely by the utcOffset and
* isDST.
* @return string Returns time zone name on success.
* @param string $abbr
* @param int $utcOffset
* @param int $isDST
* @return string
* @throws DatetimeException
*
*/

View File

@@ -5,10 +5,7 @@
use Safe\Exceptions\DirException;
/**
* Changes PHP's current directory to
* directory.
*
* @param string $directory The new current directory
* @param string $directory
* @throws DirException
*
*/
@@ -23,18 +20,7 @@ function chdir(string $directory): void
/**
* Changes the root directory of the current process to
* directory, and changes the current
* working directory to "/".
*
* This function is only available to GNU and BSD systems, and
* only when using the CLI, CGI or Embed SAPI. Also, this function
* requires root privileges.
*
* Calling this function does not change the values of the __DIR__
* and __FILE__ magic constants.
*
* @param string $directory The path to change the root directory to.
* @param string $directory
* @throws DirException
*
*/
@@ -49,13 +35,9 @@ function chroot(string $directory): void
/**
* A pseudo-object-oriented mechanism for reading a directory. The
* given directory is opened.
*
* @param string $directory Directory to open
* @param null|resource $context A context stream
* resource.
* @return \Directory Returns an instance of Directory, or FALSE in case of error.
* @param string $directory
* @param null|resource $context
* @return \Directory
* @throws DirException
*
*/
@@ -75,15 +57,7 @@ function dir(string $directory, $context = null): \Directory
/**
* Gets the current working directory.
*
* @return non-empty-string Returns the current working directory on success.
*
* On some Unix variants, getcwd will return
* FALSE if any one of the parent directories does not have the
* readable or search mode set, even if the current directory
* does. See chmod for more information on
* modes and permissions.
* @return non-empty-string
* @throws DirException
*
*/
@@ -99,15 +73,9 @@ function getcwd(): string
/**
* Opens up a directory handle to be used in subsequent
* closedir, readdir, and
* rewinddir calls.
*
* @param string $directory The directory path that is to be opened
* @param null|resource $context For a description of the context parameter,
* refer to the streams section of
* the manual.
* @return resource Returns a directory handle resource on success
* @param string $directory
* @param null|resource $context
* @return resource
* @throws DirException
*
*/
@@ -127,21 +95,10 @@ function opendir(string $directory, $context = null)
/**
* Returns an array of files and directories from the
* directory.
*
* @param string $directory The directory that will be scanned.
* @param SCANDIR_SORT_ASCENDING|SCANDIR_SORT_DESCENDING|SCANDIR_SORT_NONE $sorting_order By default, the sorted order is alphabetical in ascending order. If
* the optional sorting_order is set to
* SCANDIR_SORT_DESCENDING, then the sort order is
* alphabetical in descending order. If it is set to
* SCANDIR_SORT_NONE then the result is unsorted.
* @param null|resource $context For a description of the context parameter,
* refer to the streams section of
* the manual.
* @return list Returns an array of filenames on success. If directory is not a directory, then
* boolean FALSE is returned, and an error of level
* E_WARNING is generated.
* @param string $directory
* @param SCANDIR_SORT_ASCENDING|SCANDIR_SORT_DESCENDING|SCANDIR_SORT_NONE $sorting_order
* @param null|resource $context
* @return list
* @throws DirException
*
*/

File diff suppressed because it is too large Load Diff

View File

@@ -5,64 +5,10 @@
use Safe\Exceptions\ErrorfuncException;
/**
* Sends an error message to the web server's error log or to a file.
*
* @param string $message The error message that should be logged.
* @param 0|1|2|3|4 $message_type Says where the error should go. The possible message types are as
* follows:
*
*
* error_log log types
*
*
*
* 0
*
* message is sent to PHP's system logger, using
* the Operating System's system logging mechanism or a file, depending
* on what the error_log
* configuration directive is set to. This is the default option.
*
*
*
* 1
*
* message is sent by email to the address in
* the destination parameter. This is the only
* message type where the fourth parameter,
* extra_headers is used.
*
*
*
* 2
*
* No longer an option.
*
*
*
* 3
*
* message is appended to the file
* destination. A newline is not automatically
* added to the end of the message string.
*
*
*
* 4
*
* message is sent directly to the SAPI logging
* handler.
*
*
*
*
*
* @param string $destination The destination. Its meaning depends on the
* message_type parameter as described above.
* @param string $extra_headers The extra headers. It's used when the message_type
* parameter is set to 1.
* This message type uses the same internal function as
* mail does.
* @param string $message
* @param 0|1|2|3|4 $message_type
* @param string $destination
* @param string $extra_headers
* @throws ErrorfuncException
*
*/

View File

@@ -5,30 +5,10 @@
use Safe\Exceptions\ExecException;
/**
* exec executes the given
* command.
*
* @param string $command The command that will be executed.
* @param array|null $output If the output argument is present, then the
* specified array will be filled with every line of output from the
* command. Trailing whitespace, such as \n, is not
* included in this array. Note that if the array already contains some
* elements, exec will append to the end of the array.
* If you do not want the function to append elements, call
* unset on the array before passing it to
* exec.
* @param int|null $result_code If the result_code argument is present
* along with the output argument, then the
* return status of the executed command will be written to this
* variable.
* @return string The last line from the result of the command. If you need to execute a
* command and have all the data from the command passed directly back without
* any interference, use the passthru function.
*
* Returns FALSE on failure.
*
* To get the output of the executed command, be sure to set and use the
* output parameter.
* @param string $command
* @param array|null $output
* @param int|null $result_code
* @return string
* @throws ExecException
*
*/
@@ -44,18 +24,8 @@ function exec(string $command, ?array &$output = null, ?int &$result_code = null
/**
* proc_close is similar to pclose
* except that it only works on processes opened by
* proc_open.
* proc_close waits for the process to terminate, and
* returns its exit code. Open pipes to that process are closed
* when this function is called, in
* order to avoid a deadlock - the child process may not be able to exit
* while the pipes are open.
*
* @param resource $process The proc_open resource that will
* be closed.
* @return int Returns the termination status of the process that was run.
* @param resource $process
* @return int
* @throws ExecException
*
*/
@@ -71,22 +41,7 @@ function proc_close($process): int
/**
* proc_nice changes the priority of the current
* process by the amount specified in priority. A
* positive priority will lower the priority of the
* current process, whereas a negative priority
* will raise the priority.
*
* proc_nice is not related to
* proc_open and its associated functions in any way.
*
* @param int $priority The new priority value, the value of this may differ on platforms.
*
* On Unix, a low value, such as -20 means high priority
* wheras a positive value have a lower priority.
*
* For Windows the priority parameter have the
* following meanings:
* @param int $priority
* @throws ExecException
*
*/
@@ -101,80 +56,13 @@ function proc_nice(int $priority): void
/**
* proc_open is similar to popen
* but provides a much greater degree of control over the program execution.
*
* @param string $cmd The commandline to execute as string. Special characters have to be properly escaped,
* and proper quoting has to be applied.
*
* As of PHP 7.4.0, cmd may be passed as array of command parameters.
* In this case the process will be opened directly (without going through a shell)
* and PHP will take care of any necessary argument escaping.
*
* On Windows, the argument escaping of the array elements assumes that the
* command line parsing of the executed command is compatible with the parsing
* of command line arguments done by the VC runtime.
* @param array $descriptorspec An indexed array where the key represents the descriptor number and the
* value represents how PHP will pass that descriptor to the child
* process. 0 is stdin, 1 is stdout, while 2 is stderr.
*
* Each element can be:
*
* An array describing the pipe to pass to the process. The first
* element is the descriptor type and the second element is an option for
* the given type. Valid types are pipe (the second
* element is either r to pass the read end of the pipe
* to the process, or w to pass the write end) and
* file (the second element is a filename).
*
*
* A stream resource representing a real file descriptor (e.g. opened file,
* a socket, STDIN).
*
*
*
* The file descriptor numbers are not limited to 0, 1 and 2 - you may
* specify any valid file descriptor number and it will be passed to the
* child process. This allows your script to interoperate with other
* scripts that run as "co-processes". In particular, this is useful for
* passing passphrases to programs like PGP, GPG and openssl in a more
* secure manner. It is also useful for reading status information
* provided by those programs on auxiliary file descriptors.
* @param null|resource[] $pipes Will be set to an indexed array of file pointers that correspond to
* PHP's end of any pipes that are created.
* @param null|string $cwd The initial working dir for the command. This must be an
* absolute directory path, or NULL
* if you want to use the default value (the working dir of the current
* PHP process)
* @param array|null $env An array with the environment variables for the command that will be
* run, or NULL to use the same environment as the current PHP process
* @param array|null $other_options Allows you to specify additional options. Currently supported options
* include:
*
*
* suppress_errors (windows only): suppresses errors
* generated by this function when it's set to TRUE
*
*
* bypass_shell (windows only): bypass
* cmd.exe shell when set to TRUE
*
*
* blocking_pipes (windows only): force
* blocking pipes when set to TRUE
*
*
* create_process_group (windows only): allow the
* child process to handle CTRL events when set to TRUE
*
*
* create_new_console (windows only): the new process
* has a new console, instead of inheriting its parent's console
*
*
* @return resource Returns a resource representing the process, which should be freed using
* proc_close when you are finished with it. On failure
* returns FALSE.
* @param string $cmd
* @param array $descriptorspec
* @param null|resource[] $pipes
* @param null|string $cwd
* @param array|null $env
* @param array|null $other_options
* @return resource
* @throws ExecException
*
*/
@@ -198,10 +86,8 @@ function proc_open(string $cmd, array $descriptorspec, ?array &$pipes, ?string $
/**
* This function is identical to the backtick operator.
*
* @param string $command The command that will be executed.
* @return null|string A string containing the output from the executed command or NULL if an error occurs or the command produces no output.
* @param string $command
* @return null|string
* @throws ExecException
*
*/
@@ -217,23 +103,9 @@ function shell_exec(string $command): ?string
/**
* system is just like the C version of the
* function in that it executes the given
* command and outputs the result.
*
* The system call also tries to automatically
* flush the web server's output buffer after each line of output if
* PHP is running as a server module.
*
* If you need to execute a command and have all the data from the
* command passed directly back without any interference, use the
* passthru function.
*
* @param string $command The command that will be executed.
* @param int|null $result_code If the result_code argument is present, then the
* return status of the executed command will be written to this
* variable.
* @return string Returns the last line of the command output on success.
* @param string $command
* @param int|null $result_code
* @return string
* @throws ExecException
*
*/

View File

@@ -5,9 +5,7 @@
use Safe\Exceptions\FileinfoException;
/**
* This function closes the instance opened by finfo_open.
*
* @param \finfo $finfo An finfo instance, returned by finfo_open.
* @param \finfo $finfo
* @throws FileinfoException
*
*/
@@ -22,24 +20,9 @@ function finfo_close(\finfo $finfo): void
/**
* Procedural style
*
* Object-oriented style (constructor):
*
* This function opens a magic database and returns its instance.
*
* @param int $flags One or disjunction of more Fileinfo
* constants.
* @param null|string $magic_database Name of a magic database file, usually something like
* /path/to/magic.mime. If not specified, the
* MAGIC environment variable is used. If the
* environment variable isn't set, then PHP's bundled magic database will
* be used.
*
* Passing NULL or an empty string will be equivalent to the default
* value.
* @return \finfo (Procedural style only)
* Returns an finfo instance on success.
* @param int $flags
* @param null|string $magic_database
* @return \finfo
* @throws FileinfoException
*
*/
@@ -59,12 +42,8 @@ function finfo_open(int $flags = FILEINFO_NONE, ?string $magic_database = null):
/**
* Returns the MIME content type for a file as determined by using
* information from the magic.mime file.
*
* @param resource|string $filename Path to the tested file.
* @return string Returns the content type in MIME format, like
* text/plain or application/octet-stream.
* @param resource|string $filename
* @return string
* @throws FileinfoException
*
*/

File diff suppressed because it is too large Load Diff

View File

@@ -5,34 +5,10 @@
use Safe\Exceptions\FilterException;
/**
* This function is useful for retrieving many values without
* repetitively calling filter_input.
*
* @param int $type One of INPUT_GET, INPUT_POST,
* INPUT_COOKIE, INPUT_SERVER, or
* INPUT_ENV.
* @param array|int $options An array defining the arguments. A valid key is a string
* containing a variable name and a valid value is either a filter type, or an array
* optionally specifying the filter, flags and options. If the value is an
* array, valid keys are filter which specifies the
* filter type,
* flags which specifies any flags that apply to the
* filter, and options which specifies any options that
* apply to the filter. See the example below for a better understanding.
*
* This parameter can be also an integer holding a filter constant. Then all values in the
* input array are filtered by this filter.
* @param bool $add_empty Add missing keys as NULL to the return value.
* @return array|null An array containing the values of the requested variables on success.
* If the input array designated by type is not populated,
* the function returns NULL if the FILTER_NULL_ON_FAILURE
* flag is not given, or FALSE otherwise. For other failures, FALSE is returned.
*
* An array value will be FALSE if the filter fails, or NULL if
* the variable is not set. Or if the flag FILTER_NULL_ON_FAILURE
* is used, it returns FALSE if the variable is not set and NULL if the filter
* fails. If the add_empty parameter is FALSE, no array
* element will be added for unset variables.
* @param int $type
* @param array|int $options
* @param bool $add_empty
* @return array|null
* @throws FilterException
*
*/
@@ -48,25 +24,10 @@ function filter_input_array(int $type, $options = FILTER_DEFAULT, bool $add_empt
/**
* This function is useful for retrieving many values without
* repetitively calling filter_var.
*
* @param array $array An array with string keys containing the data to filter.
* @param mixed $options An array defining the arguments. A valid key is a string
* containing a variable name and a valid value is either a
* filter type, or an
* array optionally specifying the filter, flags and options.
* If the value is an array, valid keys are filter
* which specifies the filter type,
* flags which specifies any flags that apply to the
* filter, and options which specifies any options that
* apply to the filter. See the example below for a better understanding.
*
* This parameter can be also an integer holding a filter constant. Then all values in the
* input array are filtered by this filter.
* @param bool $add_empty Add missing keys as NULL to the return value.
* @return array|null An array containing the values of the requested variables on success. An array value will be FALSE if the filter fails, or NULL if
* the variable is not set.
* @param array $array
* @param mixed $options
* @param bool $add_empty
* @return array|null
* @throws FilterException
*
*/

View File

@@ -5,10 +5,6 @@
use Safe\Exceptions\FpmException;
/**
* This function flushes all response data to the client and finishes the
* request. This allows for time consuming tasks to be performed without
* leaving the connection to the client open.
*
* @throws FpmException
*
*/

View File

@@ -5,13 +5,9 @@
use Safe\Exceptions\FtpException;
/**
* Sends an ALLO command to the remote FTP server to
* allocate space for a file to be uploaded.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param int $size The number of bytes to allocate.
* @param null|string $response A textual representation of the servers response will be returned by
* reference in response if a variable is provided.
* @param \FTP\Connection $ftp
* @param int $size
* @param null|string $response
* @throws FtpException
*
*/
@@ -26,9 +22,7 @@ function ftp_alloc(\FTP\Connection $ftp, int $size, ?string &$response = null):
/**
*
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param \FTP\Connection $ftp
* @param string $remote_filename
* @param string $local_filename
* @param FTP_ASCII|FTP_BINARY $mode
@@ -46,9 +40,7 @@ function ftp_append(\FTP\Connection $ftp, string $remote_filename, string $local
/**
* Changes to the parent directory.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param \FTP\Connection $ftp
* @throws FtpException
*
*/
@@ -63,10 +55,8 @@ function ftp_cdup(\FTP\Connection $ftp): void
/**
* Changes the current directory to the specified one.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $directory The target directory.
* @param \FTP\Connection $ftp
* @param string $directory
* @throws FtpException
*
*/
@@ -81,13 +71,10 @@ function ftp_chdir(\FTP\Connection $ftp, string $directory): void
/**
* Sets the permissions on the specified remote file to
* permissions.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param int $permissions The new permissions, given as an octal value.
* @param string $filename The remote file.
* @return int Returns the new file permissions on success.
* @param \FTP\Connection $ftp
* @param int $permissions
* @param string $filename
* @return int
* @throws FtpException
*
*/
@@ -103,10 +90,7 @@ function ftp_chmod(\FTP\Connection $ftp, int $permissions, string $filename): in
/**
* ftp_close closes the given link identifier
* and releases the resource.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param \FTP\Connection $ftp
* @throws FtpException
*
*/
@@ -121,18 +105,10 @@ function ftp_close(\FTP\Connection $ftp): void
/**
* ftp_connect opens an FTP connection to the
* specified hostname.
*
* @param string $hostname The FTP server address. This parameter shouldn't have any trailing
* slashes and shouldn't be prefixed with ftp://.
* @param int $port This parameter specifies an alternate port to connect to. If it is
* omitted or set to zero, then the default FTP port, 21, will be used.
* @param int $timeout This parameter specifies the timeout in seconds for all subsequent network operations.
* If omitted, the default value is 90 seconds. The timeout can be changed and
* queried at any time with ftp_set_option and
* ftp_get_option.
* @return \FTP\Connection Returns an FTP\Connection instance on success.
* @param string $hostname
* @param int $port
* @param int $timeout
* @return \FTP\Connection
* @throws FtpException
*
*/
@@ -148,11 +124,8 @@ function ftp_connect(string $hostname, int $port = 21, int $timeout = 90): \FTP\
/**
* ftp_delete deletes the file specified by
* filename from the FTP server.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $filename The file to delete.
* @param \FTP\Connection $ftp
* @param string $filename
* @throws FtpException
*
*/
@@ -167,15 +140,11 @@ function ftp_delete(\FTP\Connection $ftp, string $filename): void
/**
* ftp_fget retrieves remote_filename
* from the FTP server, and writes it to the given file pointer.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param resource $stream An open file pointer in which we store the data.
* @param string $remote_filename The remote file path.
* @param FTP_ASCII|FTP_BINARY $mode The transfer mode. Must be either FTP_ASCII or
* FTP_BINARY.
* @param int $offset The position in the remote file to start downloading from.
* @param \FTP\Connection $ftp
* @param resource $stream
* @param string $remote_filename
* @param FTP_ASCII|FTP_BINARY $mode
* @param int $offset
* @throws FtpException
*
*/
@@ -190,15 +159,11 @@ function ftp_fget(\FTP\Connection $ftp, $stream, string $remote_filename, int $m
/**
* ftp_fput uploads the data from a file pointer
* to a remote file on the FTP server.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $remote_filename The remote file path.
* @param resource $stream An open file pointer on the local file. Reading stops at end of file.
* @param FTP_ASCII|FTP_BINARY $mode The transfer mode. Must be either FTP_ASCII or
* FTP_BINARY.
* @param int $offset The position in the remote file to start uploading to.
* @param \FTP\Connection $ftp
* @param string $remote_filename
* @param resource $stream
* @param FTP_ASCII|FTP_BINARY $mode
* @param int $offset
* @throws FtpException
*
*/
@@ -213,15 +178,11 @@ function ftp_fput(\FTP\Connection $ftp, string $remote_filename, $stream, int $m
/**
* ftp_get retrieves a remote file from the FTP server,
* and saves it into a local file.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $local_filename The local file path (will be overwritten if the file already exists).
* @param string $remote_filename The remote file path.
* @param FTP_ASCII|FTP_BINARY $mode The transfer mode. Must be either FTP_ASCII or
* FTP_BINARY.
* @param int $offset The position in the remote file to start downloading from.
* @param \FTP\Connection $ftp
* @param string $local_filename
* @param string $remote_filename
* @param FTP_ASCII|FTP_BINARY $mode
* @param int $offset
* @throws FtpException
*
*/
@@ -236,11 +197,9 @@ function ftp_get(\FTP\Connection $ftp, string $local_filename, string $remote_fi
/**
* Logs in to the given FTP connection.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $username The username (USER).
* @param string $password The password (PASS).
* @param \FTP\Connection $ftp
* @param string $username
* @param string $password
* @throws FtpException
*
*/
@@ -255,11 +214,9 @@ function ftp_login(\FTP\Connection $ftp, string $username, string $password): vo
/**
* Creates the specified directory on the FTP server.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $directory The name of the directory that will be created.
* @return string Returns the newly created directory name on success.
* @param \FTP\Connection $ftp
* @param string $directory
* @return string
* @throws FtpException
*
*/
@@ -275,11 +232,9 @@ function ftp_mkdir(\FTP\Connection $ftp, string $directory): string
/**
*
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $directory The directory to be listed.
* @return array Returns an array of arrays with file infos from the specified directory on success.
* @param \FTP\Connection $ftp
* @param string $directory
* @return array
* @throws FtpException
*
*/
@@ -295,20 +250,12 @@ function ftp_mlsd(\FTP\Connection $ftp, string $directory): array
/**
* ftp_nb_put stores a local file on the FTP server.
*
* The difference between this function and the ftp_put
* is that this function uploads the file asynchronously, so your program can
* perform other operations while the file is being uploaded.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $remote_filename The remote file path.
* @param string $local_filename The local file path.
* @param FTP_ASCII|FTP_BINARY $mode The transfer mode. Must be either FTP_ASCII or
* FTP_BINARY.
* @param int $offset The position in the remote file to start uploading to.
* @return int Returns FTP_FAILED or FTP_FINISHED
* or FTP_MOREDATA to open the local file.
* @param \FTP\Connection $ftp
* @param string $remote_filename
* @param string $local_filename
* @param FTP_ASCII|FTP_BINARY $mode
* @param int $offset
* @return int
* @throws FtpException
*
*/
@@ -324,14 +271,9 @@ function ftp_nb_put(\FTP\Connection $ftp, string $remote_filename, string $local
/**
*
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $directory The directory to be listed. This parameter can also include arguments, eg.
* ftp_nlist($ftp, "-la /your/dir");.
* Note that this parameter isn't escaped so there may be some issues with
* filenames containing spaces and other characters.
* @return array Returns an array of filenames from the specified directory on success.
* @param \FTP\Connection $ftp
* @param string $directory
* @return array
* @throws FtpException
*
*/
@@ -347,16 +289,8 @@ function ftp_nlist(\FTP\Connection $ftp, string $directory): array
/**
* ftp_pasv turns on or off passive mode. In
* passive mode, data connections are initiated by the client,
* rather than by the server.
* It may be needed if the client is behind firewall.
*
* Please note that ftp_pasv can only be called after a
* successful login or otherwise it will fail.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param bool $enable If TRUE, the passive mode is turned on, else it's turned off.
* @param \FTP\Connection $ftp
* @param bool $enable
* @throws FtpException
*
*/
@@ -371,14 +305,11 @@ function ftp_pasv(\FTP\Connection $ftp, bool $enable): void
/**
* ftp_put stores a local file on the FTP server.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $remote_filename The remote file path.
* @param string $local_filename The local file path.
* @param FTP_ASCII|FTP_BINARY $mode The transfer mode. Must be either FTP_ASCII or
* FTP_BINARY.
* @param int $offset The position in the remote file to start uploading to.
* @param \FTP\Connection $ftp
* @param string $remote_filename
* @param string $local_filename
* @param FTP_ASCII|FTP_BINARY $mode
* @param int $offset
* @throws FtpException
*
*/
@@ -393,10 +324,8 @@ function ftp_put(\FTP\Connection $ftp, string $remote_filename, string $local_fi
/**
*
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @return string Returns the current directory name.
* @param \FTP\Connection $ftp
* @return string
* @throws FtpException
*
*/
@@ -412,12 +341,9 @@ function ftp_pwd(\FTP\Connection $ftp): string
/**
* ftp_rename renames a file or a directory on the FTP
* server.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $from The old file/directory name.
* @param string $to The new name.
* @param \FTP\Connection $ftp
* @param string $from
* @param string $to
* @throws FtpException
*
*/
@@ -432,11 +358,8 @@ function ftp_rename(\FTP\Connection $ftp, string $from, string $to): void
/**
* Removes the specified directory on the FTP server.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $directory The directory to delete. This must be either an absolute or relative
* path to an empty directory.
* @param \FTP\Connection $ftp
* @param string $directory
* @throws FtpException
*
*/
@@ -451,16 +374,8 @@ function ftp_rmdir(\FTP\Connection $ftp, string $directory): void
/**
* ftp_site sends the given SITE
* command to the FTP server.
*
* SITE commands are not standardized, and vary from server
* to server. They are useful for handling such things as file permissions and
* group membership.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $command The SITE command. Note that this parameter isn't escaped so there may
* be some issues with filenames containing spaces and other characters.
* @param \FTP\Connection $ftp
* @param string $command
* @throws FtpException
*
*/
@@ -475,12 +390,9 @@ function ftp_site(\FTP\Connection $ftp, string $command): void
/**
* ftp_size returns the size of the given file in
* bytes.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $filename The remote file.
* @return int Returns the file size on success.
* @param \FTP\Connection $ftp
* @param string $filename
* @return int
* @throws FtpException
*
*/
@@ -496,23 +408,10 @@ function ftp_size(\FTP\Connection $ftp, string $filename): int
/**
* ftp_ssl_connect opens an explicit SSL-FTP connection to the
* specified hostname. That implies that
* ftp_ssl_connect will succeed even if the server is not
* configured for SSL-FTP, or its certificate is invalid. Only when
* ftp_login is called, the client will send the
* appropriate AUTH FTP command, so ftp_login will fail in
* the mentioned cases.
*
* @param string $hostname The FTP server address. This parameter shouldn't have any trailing
* slashes and shouldn't be prefixed with ftp://.
* @param int $port This parameter specifies an alternate port to connect to. If it is
* omitted or set to zero, then the default FTP port, 21, will be used.
* @param int $timeout This parameter specifies the timeout for all subsequent network operations.
* If omitted, the default value is 90 seconds. The timeout can be changed and
* queried at any time with ftp_set_option and
* ftp_get_option.
* @return \FTP\Connection Returns an FTP\Connection instance on success.
* @param string $hostname
* @param int $port
* @param int $timeout
* @return \FTP\Connection
* @throws FtpException
*
*/
@@ -528,10 +427,8 @@ function ftp_ssl_connect(string $hostname, int $port = 21, int $timeout = 90): \
/**
* Returns the system type identifier of the remote FTP server.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @return string Returns the remote system type.
* @param \FTP\Connection $ftp
* @return string
* @throws FtpException
*
*/

View File

@@ -5,9 +5,7 @@
use Safe\Exceptions\FunchandException;
/**
*
*
* @param callable(): void $callback The function to register.
* @param callable(): void $callback
* @param mixed $args
* @throws FunchandException
*

View File

@@ -213,6 +213,7 @@
'ftp_pasv',
'ftp_put',
'ftp_pwd',
'ftp_raw',
'ftp_rename',
'ftp_rmdir',
'ftp_site',
@@ -264,6 +265,8 @@
'gztell',
'gzuncompress',
'gzwrite',
'hash_file',
'hash_hmac_file',
'hash_update_file',
'header_register_callback',
'hex2bin',
@@ -684,6 +687,7 @@
'parse_ini_file',
'parse_ini_string',
'parse_url',
'passthru',
'pclose',
'pcntl_getpriority',
'pcntl_setpriority',
@@ -1048,6 +1052,7 @@
'unixtojd',
'unlink',
'unpack',
'unserialize',
'uopz_extend',
'uopz_implement',
'variant_date_to_timestamp',

View File

@@ -5,14 +5,9 @@
use Safe\Exceptions\GettextException;
/**
* The bindtextdomain function sets or gets the path
* for a domain.
*
* @param string $domain The domain.
* @param string $directory The directory path.
* An empty string means the current directory.
* If NULL, the currently set directory is returned.
* @return string The full pathname for the domain currently being set.
* @param string $domain
* @param string $directory
* @return string
* @throws GettextException
*
*/

View File

@@ -5,17 +5,7 @@
use Safe\Exceptions\GmpException;
/**
*
*
* @param \GMP|int|string $seed The seed to be set for the gmp_random,
* gmp_random_bits, and
* gmp_random_range functions.
*
*
* A GMP object, an integer,
* or a string that can be interpreted as a number following the same logic
* as if the string was used in gmp_init with automatic
* base detection (i.e. when base is equal to 0).
* @param \GMP|int|string $seed
* @throws GmpException
*
*/

View File

@@ -5,12 +5,9 @@
use Safe\Exceptions\GnupgException;
/**
*
*
* @param resource $identifier The gnupg identifier, from a call to
* gnupg_init or gnupg.
* @param string $fingerprint The fingerprint key.
* @param string $passphrase The pass phrase.
* @param resource $identifier
* @param string $fingerprint
* @param string $passphrase
* @throws GnupgException
*
*/
@@ -25,11 +22,8 @@ function gnupg_adddecryptkey($identifier, string $fingerprint, string $passphras
/**
*
*
* @param resource $identifier The gnupg identifier, from a call to
* gnupg_init or gnupg.
* @param string $fingerprint The fingerprint key.
* @param resource $identifier
* @param string $fingerprint
* @throws GnupgException
*
*/
@@ -44,12 +38,9 @@ function gnupg_addencryptkey($identifier, string $fingerprint): void
/**
*
*
* @param resource $identifier The gnupg identifier, from a call to
* gnupg_init or gnupg.
* @param string $fingerprint The fingerprint key.
* @param string $passphrase The pass phrase.
* @param resource $identifier
* @param string $fingerprint
* @param string $passphrase
* @throws GnupgException
*
*/
@@ -68,10 +59,7 @@ function gnupg_addsignkey($identifier, string $fingerprint, ?string $passphrase
/**
*
*
* @param resource $identifier The gnupg identifier, from a call to
* gnupg_init or gnupg.
* @param resource $identifier
* @throws GnupgException
*
*/
@@ -86,10 +74,7 @@ function gnupg_cleardecryptkeys($identifier): void
/**
*
*
* @param resource $identifier The gnupg identifier, from a call to
* gnupg_init or gnupg.
* @param resource $identifier
* @throws GnupgException
*
*/
@@ -104,10 +89,7 @@ function gnupg_clearencryptkeys($identifier): void
/**
*
*
* @param resource $identifier The gnupg identifier, from a call to
* gnupg_init or gnupg.
* @param resource $identifier
* @throws GnupgException
*
*/
@@ -122,13 +104,8 @@ function gnupg_clearsignkeys($identifier): void
/**
* Toggle the armored output.
*
* @param resource $identifier The gnupg identifier, from a call to
* gnupg_init or gnupg.
* @param int $armor Pass a non-zero integer-value to this function to enable armored-output
* (default).
* Pass 0 to disable armored output.
* @param resource $identifier
* @param int $armor
* @throws GnupgException
*
*/
@@ -143,18 +120,8 @@ function gnupg_setarmor($identifier, int $armor): void
/**
* Sets the mode for signing.
*
* @param resource $identifier The gnupg identifier, from a call to
* gnupg_init or gnupg.
* @param int $signmode The mode for signing.
*
* signmode takes a constant indicating what type of
* signature should be produced. The possible values are
* GNUPG_SIG_MODE_NORMAL,
* GNUPG_SIG_MODE_DETACH and
* GNUPG_SIG_MODE_CLEAR.
* By default GNUPG_SIG_MODE_CLEAR is used.
* @param resource $identifier
* @param int $signmode
* @throws GnupgException
*
*/

View File

@@ -5,29 +5,12 @@
use Safe\Exceptions\HashException;
/**
*
*
* @param string $algo Name of selected hashing algorithm (i.e. "sha256", "sha512", "haval160,4", etc..)
* See hash_algos for a list of supported algorithms.
*
*
* Non-cryptographic hash functions are not allowed.
*
*
*
* Non-cryptographic hash functions are not allowed.
* @param string $key Input keying material (raw binary). Cannot be empty.
* @param int $length Desired output length in bytes.
* Cannot be greater than 255 times the chosen hash function size.
*
* If length is 0, the output length
* will default to the chosen hash function size.
* @param string $info Application/context-specific info string.
* @param string $salt Salt to use during derivation.
*
* While optional, adding random salt significantly improves the strength of HKDF.
* @return non-falsy-string Returns a string containing a raw binary representation of the derived key
* (also known as output keying material - OKM);.
* @param string $algo
* @param string $key
* @param int $length
* @param string $info
* @param string $salt
* @return non-falsy-string
* @throws HashException
*
*/
@@ -43,11 +26,9 @@ function hash_hkdf(string $algo, string $key, int $length = 0, string $info = ""
/**
*
*
* @param \HashContext $context Hashing context returned by hash_init.
* @param string $filename URL describing location of file to be hashed; Supports fopen wrappers.
* @param \HashContext|null $stream_context Stream context as returned by stream_context_create.
* @param \HashContext $context
* @param string $filename
* @param \HashContext|null $stream_context
* @throws HashException
*
*/

View File

@@ -5,10 +5,7 @@
use Safe\Exceptions\IbaseException;
/**
* This function will discard a BLOB if it has not yet been closed by
* fbird_blob_close.
*
* @param resource $blob_handle A BLOB handle opened with fbird_blob_create.
* @param resource $blob_handle
* @throws IbaseException
*
*/
@@ -23,14 +20,12 @@ function fbird_blob_cancel($blob_handle): void
/**
*
*
* @param resource $service_handle The handle on the database server service.
* @param string $user_name The login name of the new database user.
* @param string $password The password of the new user.
* @param string $first_name The first name of the new database user.
* @param string $middle_name The middle name of the new database user.
* @param string $last_name The last name of the new database user.
* @param resource $service_handle
* @param string $user_name
* @param string $password
* @param string $first_name
* @param string $middle_name
* @param string $last_name
* @throws IbaseException
*
*/
@@ -53,29 +48,12 @@ function ibase_add_user($service_handle, string $user_name, string $password, ?s
/**
* This function passes the arguments to the (remote) database server. There it starts a new backup process. Therefore you
* won't get any responses.
*
* @param resource $service_handle A previously opened connection to the database server.
* @param string $source_db The absolute file path to the database on the database server. You can also use a database alias.
* @param string $dest_file The path to the backup file on the database server.
* @param int $options Additional options to pass to the database server for backup.
* The options parameter can be a combination
* of the following constants:
* IBASE_BKP_IGNORE_CHECKSUMS,
* IBASE_BKP_IGNORE_LIMBO,
* IBASE_BKP_METADATA_ONLY,
* IBASE_BKP_NO_GARBAGE_COLLECT,
* IBASE_BKP_OLD_DESCRIPTIONS,
* IBASE_BKP_NON_TRANSPORTABLE or
* IBASE_BKP_CONVERT.
* Read the section about for further information.
* @param bool $verbose Since the backup process is done on the database server, you don't have any chance
* to get its output. This argument is useless.
* @return mixed Returns TRUE on success.
*
* Since the backup process is done on the (remote) server, this function just passes the arguments to it.
* While the arguments are legal, you won't get FALSE.
* @param resource $service_handle
* @param string $source_db
* @param string $dest_file
* @param int $options
* @param bool $verbose
* @return mixed
* @throws IbaseException
*
*/
@@ -91,10 +69,7 @@ function ibase_backup($service_handle, string $source_db, string $dest_file, int
/**
* This function will discard a BLOB if it has not yet been closed by
* ibase_blob_close.
*
* @param resource $blob_handle A BLOB handle opened with ibase_blob_create.
* @param resource $blob_handle
* @throws IbaseException
*
*/
@@ -109,13 +84,8 @@ function ibase_blob_cancel($blob_handle): void
/**
* ibase_blob_create creates a new BLOB for filling with
* data.
*
* @param null|resource $link_identifier An InterBase link identifier. If omitted, the last opened link is
* assumed.
* @return resource Returns a BLOB handle for later use with
* ibase_blob_add.
* @param null|resource $link_identifier
* @return resource
* @throws IbaseException
*
*/
@@ -135,12 +105,9 @@ function ibase_blob_create($link_identifier = null)
/**
* This function returns at most len bytes from a BLOB
* that has been opened for reading by ibase_blob_open.
*
* @param resource $blob_handle A BLOB handle opened with ibase_blob_open.
* @param int $len Size of returned data.
* @return string Returns at most len bytes from the BLOB.
* @param resource $blob_handle
* @param int $len
* @return string
* @throws IbaseException
*
*/
@@ -156,14 +123,7 @@ function ibase_blob_get($blob_handle, int $len): string
/**
* Closes the link to an InterBase database that's associated with
* a connection id returned from ibase_connect.
* Default transaction on link is committed, other transactions are
* rolled back.
*
* @param null|resource $connection_id An InterBase link identifier returned from
* ibase_connect. If omitted, the last opened link
* is assumed.
* @param null|resource $connection_id
* @throws IbaseException
*
*/
@@ -182,15 +142,7 @@ function ibase_close($connection_id = null): void
/**
* Commits a transaction without closing it.
*
* @param null|resource $link_or_trans_identifier If called without an argument, this function commits the default
* transaction of the default link. If the argument is a connection
* identifier, the default transaction of the corresponding connection
* will be committed. If the argument is a transaction identifier, the
* corresponding transaction will be committed. The transaction context
* will be retained, so statements executed from within this transaction
* will not be invalidated.
* @param null|resource $link_or_trans_identifier
* @throws IbaseException
*
*/
@@ -209,13 +161,7 @@ function ibase_commit_ret($link_or_trans_identifier = null): void
/**
* Commits a transaction.
*
* @param null|resource $link_or_trans_identifier If called without an argument, this function commits the default
* transaction of the default link. If the argument is a connection
* identifier, the default transaction of the corresponding connection
* will be committed. If the argument is a transaction identifier, the
* corresponding transaction will be committed.
* @param null|resource $link_or_trans_identifier
* @throws IbaseException
*
*/
@@ -234,35 +180,15 @@ function ibase_commit($link_or_trans_identifier = null): void
/**
* Establishes a connection to an Firebird/InterBase server.
*
* In case a second call is made to ibase_connect with
* the same arguments, no new link will be established, but instead, the link
* identifier of the already opened link will be returned. 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 ibase_close.
*
* @param string $database The database argument has to be a valid path to
* database file on the server it resides on. If the server is not local,
* it must be prefixed with either 'hostname:' (TCP/IP), 'hostname/port:'
* (TCP/IP with interbase server on custom TCP port), '//hostname/'
* (NetBEUI), depending on the connection
* protocol used.
* @param string $username The user name. Can be set with the
* ibase.default_user php.ini directive.
* @param string $password The password for username. Can be set with the
* ibase.default_password php.ini directive.
* @param string $charset charset is the default character set for a
* database.
* @param int $buffers buffers is the number of database buffers to
* allocate for the server-side cache. If 0 or omitted, server chooses
* its own default.
* @param int $dialect dialect selects the default SQL dialect for any
* statement executed within a connection, and it defaults to the highest
* one supported by client libraries.
* @param string $role Functional only with InterBase 5 and up.
* @param string $database
* @param string $username
* @param string $password
* @param string $charset
* @param int $buffers
* @param int $dialect
* @param string $role
* @param int $sync
* @return resource Returns an Firebird/InterBase link identifier on success.
* @return resource
* @throws IbaseException
*
*/
@@ -296,10 +222,8 @@ function ibase_connect(?string $database = null, ?string $username = null, ?stri
/**
*
*
* @param resource $service_handle The handle on the database server service.
* @param string $user_name The login name of the user you want to delete from the database.
* @param resource $service_handle
* @param string $user_name
* @throws IbaseException
*
*/
@@ -314,11 +238,7 @@ function ibase_delete_user($service_handle, string $user_name): void
/**
* This functions drops a database that was opened by either ibase_connect
* or ibase_pconnect. The database is closed and deleted from the server.
*
* @param null|resource $connection An InterBase link identifier. If omitted, the last opened link is
* assumed.
* @param null|resource $connection
* @throws IbaseException
*
*/
@@ -337,12 +257,7 @@ function ibase_drop_db($connection = null): void
/**
* This function causes the registered event handler specified by
* event to be cancelled. The callback function will
* no longer be called for the events it was registered to handle.
*
* @param resource $event An event resource, created by
* ibase_set_event_handler.
* @param resource $event
* @throws IbaseException
*
*/
@@ -357,9 +272,7 @@ function ibase_free_event_handler($event): void
/**
* Frees a prepared query.
*
* @param resource $query A query prepared with ibase_prepare.
* @param resource $query
* @throws IbaseException
*
*/
@@ -374,10 +287,7 @@ function ibase_free_query($query): void
/**
* Frees a result set.
*
* @param resource $result_identifier A result set created by ibase_query or
* ibase_execute.
* @param resource $result_identifier
* @throws IbaseException
*
*/
@@ -392,8 +302,6 @@ function ibase_free_result($result_identifier): void
/**
*
*
* @param resource $service_handle
* @param string $db
* @param int $action
@@ -412,14 +320,12 @@ function ibase_maintain_db($service_handle, string $db, int $action, int $argume
/**
*
*
* @param resource $service_handle The handle on the database server service.
* @param string $user_name The login name of the database user to modify.
* @param string $password The user's new password.
* @param string $first_name The user's new first name.
* @param string $middle_name The user's new middle name.
* @param string $last_name The user's new last name.
* @param resource $service_handle
* @param string $user_name
* @param string $password
* @param string $first_name
* @param string $middle_name
* @param string $last_name
* @throws IbaseException
*
*/
@@ -442,11 +348,8 @@ function ibase_modify_user($service_handle, string $user_name, string $password,
/**
* This function assigns a name to a result set. This name can be used later in
* UPDATE|DELETE ... WHERE CURRENT OF name statements.
*
* @param resource $result An InterBase result set.
* @param string $name The name to be assigned.
* @param resource $result
* @param string $name
* @throws IbaseException
*
*/
@@ -461,42 +364,15 @@ function ibase_name_result($result, string $name): void
/**
* Opens a persistent connection to an InterBase database.
*
* ibase_pconnect acts very much like
* ibase_connect with two major differences.
*
* First, when connecting, the function will first try to find a (persistent)
* link that's already opened with the same parameters. If one is found, an
* identifier for it will be returned instead of opening a new connection.
*
* Second, the connection to the InterBase server will not be closed when the
* execution of the script ends. Instead, the link will remain open for
* future use (ibase_close will not close links
* established by ibase_pconnect). This type of link is
* therefore called 'persistent'.
*
* @param string $database The database argument has to be a valid path to
* database file on the server it resides on. If the server is not local,
* it must be prefixed with either 'hostname:' (TCP/IP), '//hostname/'
* (NetBEUI) or 'hostname@' (IPX/SPX), depending on the connection
* protocol used.
* @param string $username The user name. Can be set with the
* ibase.default_user php.ini directive.
* @param string $password The password for username. Can be set with the
* ibase.default_password php.ini directive.
* @param string $charset charset is the default character set for a
* database.
* @param int $buffers buffers is the number of database buffers to
* allocate for the server-side cache. If 0 or omitted, server chooses
* its own default.
* @param int $dialect dialect selects the default SQL dialect for any
* statement executed within a connection, and it defaults to the highest
* one supported by client libraries. Functional only with InterBase 6
* and up.
* @param string $role Functional only with InterBase 5 and up.
* @param string $database
* @param string $username
* @param string $password
* @param string $charset
* @param int $buffers
* @param int $dialect
* @param string $role
* @param int $sync
* @return resource Returns an InterBase link identifier on success.
* @return resource
* @throws IbaseException
*
*/
@@ -530,32 +406,12 @@ function ibase_pconnect(?string $database = null, ?string $username = null, ?str
/**
* This function passes the arguments to the (remote) database server. There it starts a new restore process. Therefore you
* won't get any responses.
*
* @param resource $service_handle A previously opened connection to the database server.
* @param string $source_file The absolute path on the server where the backup file is located.
* @param string $dest_db The path to create the new database on the server. You can also use database alias.
* @param int $options Additional options to pass to the database server for restore.
* The options parameter can be a combination
* of the following constants:
* IBASE_RES_DEACTIVATE_IDX,
* IBASE_RES_NO_SHADOW,
* IBASE_RES_NO_VALIDITY,
* IBASE_RES_ONE_AT_A_TIME,
* IBASE_RES_REPLACE,
* IBASE_RES_CREATE,
* IBASE_RES_USE_ALL_SPACE,
* IBASE_PRP_PAGE_BUFFERS,
* IBASE_PRP_SWEEP_INTERVAL,
* IBASE_RES_CREATE.
* Read the section about for further information.
* @param bool $verbose Since the restore process is done on the database server, you don't have any chance
* to get its output. This argument is useless.
* @return mixed Returns TRUE on success.
*
* Since the restore process is done on the (remote) server, this function just passes the arguments to it.
* While the arguments are legal, you won't get FALSE.
* @param resource $service_handle
* @param string $source_file
* @param string $dest_db
* @param int $options
* @param bool $verbose
* @return mixed
* @throws IbaseException
*
*/
@@ -571,15 +427,7 @@ function ibase_restore($service_handle, string $source_file, string $dest_db, in
/**
* Rolls back a transaction without closing it.
*
* @param null|resource $link_or_trans_identifier If called without an argument, this function rolls back the default
* transaction of the default link. If the argument is a connection
* identifier, the default transaction of the corresponding connection
* will be rolled back. If the argument is a transaction identifier, the
* corresponding transaction will be rolled back. The transaction context
* will be retained, so statements executed from within this transaction
* will not be invalidated.
* @param null|resource $link_or_trans_identifier
* @throws IbaseException
*
*/
@@ -598,13 +446,7 @@ function ibase_rollback_ret($link_or_trans_identifier = null): void
/**
* Rolls back a transaction.
*
* @param null|resource $link_or_trans_identifier If called without an argument, this function rolls back the default
* transaction of the default link. If the argument is a connection
* identifier, the default transaction of the corresponding connection
* will be rolled back. If the argument is a transaction identifier, the
* corresponding transaction will be rolled back.
* @param null|resource $link_or_trans_identifier
* @throws IbaseException
*
*/
@@ -623,13 +465,10 @@ function ibase_rollback($link_or_trans_identifier = null): void
/**
*
*
* @param string $host The name or ip address of the database host. You can define the port by adding
* '/' and port number. If no port is specified, port 3050 will be used.
* @param string $dba_username The name of any valid user.
* @param string $dba_password The user's password.
* @return resource Returns a Interbase / Firebird link identifier on success.
* @param string $host
* @param string $dba_username
* @param string $dba_password
* @return resource
* @throws IbaseException
*
*/
@@ -645,9 +484,7 @@ function ibase_service_attach(string $host, string $dba_username, string $dba_pa
/**
*
*
* @param resource $service_handle A previously created connection to the database server.
* @param resource $service_handle
* @throws IbaseException
*
*/

File diff suppressed because it is too large Load Diff

View File

@@ -5,21 +5,8 @@
use Safe\Exceptions\IconvException;
/**
* Retrieve internal configuration variables of iconv extension.
*
* @param string $type The value of the optional type can be:
*
* all
* input_encoding
* output_encoding
* internal_encoding
*
* @return mixed Returns the current value of the internal configuration variable if
* successful.
*
* If type is omitted or set to "all",
* iconv_get_encoding returns an array that
* stores all these variables.
* @param string $type
* @return mixed
* @throws IconvException
*
*/
@@ -35,53 +22,10 @@ function iconv_get_encoding(string $type = "all")
/**
* Decodes a MIME header field.
*
* @param string $string The encoded header, as a string.
* @param int $mode mode determines the behaviour in the event
* iconv_mime_decode encounters a malformed
* MIME header field. You can specify any combination
* of the following bitmasks.
*
* Bitmasks acceptable to iconv_mime_decode
*
*
*
* Value
* Constant
* Description
*
*
*
*
* 1
* ICONV_MIME_DECODE_STRICT
*
* If set, the given header is decoded in full conformance with the
* standards defined in RFC2047.
* This option is disabled by default because there are a lot of
* broken mail user agents that don't follow the specification and don't
* produce correct MIME headers.
*
*
*
* 2
* ICONV_MIME_DECODE_CONTINUE_ON_ERROR
*
* If set, iconv_mime_decode_headers
* attempts to ignore any grammatical errors and continue to process
* a given header.
*
*
*
*
*
* @param null|string $encoding The optional encoding parameter specifies the
* character set to represent the result by. If omitted or NULL,
* iconv.internal_encoding
* will be used.
* @return string Returns a decoded MIME field on success,
* or FALSE if an error occurs during the decoding.
* @param string $string
* @param int $mode
* @param null|string $encoding
* @return string
* @throws IconvException
*
*/
@@ -101,108 +45,10 @@ function iconv_mime_decode(string $string, int $mode = 0, ?string $encoding = nu
/**
* Composes and returns a string that represents a valid MIME
* header field, which looks like the following:
*
*
*
* In the above example, "Subject" is the field name and the portion that
* begins with "=?ISO-8859-1?..." is the field value.
*
* @param string $field_name The field name.
* @param string $field_value The field value.
* @param array $options You can control the behaviour of iconv_mime_encode
* by specifying an associative array that contains configuration items
* to the optional third parameter options.
* The items supported by iconv_mime_encode are
* listed below. Note that item names are treated case-sensitive.
*
* Configuration items supported by iconv_mime_encode
*
*
*
* Item
* Type
* Description
* Default value
* Example
*
*
*
*
* scheme
* string
*
* Specifies the method to encode a field value by. The value of
* this item may be either "B" or "Q", where "B" stands for
* base64 encoding scheme and "Q" stands for
* quoted-printable encoding scheme.
*
* B
* B
*
*
* input-charset
* string
*
* Specifies the character set in which the first parameter
* field_name and the second parameter
* field_value are presented. If not given,
* iconv_mime_encode assumes those parameters
* are presented to it in the
* iconv.internal_encoding
* ini setting.
*
*
* iconv.internal_encoding
*
* ISO-8859-1
*
*
* output-charset
* string
*
* Specifies the character set to use to compose the
* MIME header.
*
*
* iconv.internal_encoding
*
* UTF-8
*
*
* line-length
* int
*
* Specifies the maximum length of the header lines. The resulting
* header is "folded" to a set of multiple lines in case
* the resulting header field would be longer than the value of this
* parameter, according to
* RFC2822 - Internet Message Format.
* If not given, the length will be limited to 76 characters.
*
* 76
* 996
*
*
* line-break-chars
* string
*
* Specifies the sequence of characters to append to each line
* as an end-of-line sign when "folding" is performed on a long header
* field. If not given, this defaults to "\r\n"
* (CR LF). Note that
* this parameter is always treated as an ASCII string regardless
* of the value of input-charset.
*
* \r\n
* \n
*
*
*
*
* @return string Returns an encoded MIME field on success,
* or FALSE if an error occurs during the encoding.
* @param string $field_name
* @param string $field_value
* @param array $options
* @return string
* @throws IconvException
*
*/
@@ -218,16 +64,8 @@ function iconv_mime_encode(string $field_name, string $field_value, array $optio
/**
* Changes the value of the internal configuration variable specified by
* type to encoding.
*
* @param string $type The value of type can be any one of these:
*
* input_encoding
* output_encoding
* internal_encoding
*
* @param string $encoding The character set.
* @param string $type
* @param string $encoding
* @throws IconvException
*
*/
@@ -242,18 +80,9 @@ function iconv_set_encoding(string $type, string $encoding): void
/**
* In contrast to strlen,
* iconv_strlen counts the occurrences of characters
* in the given byte sequence string on the basis of
* the specified character set, the result of which is not necessarily
* identical to the length of the string in byte.
*
* @param string $string The string.
* @param null|string $encoding If encoding parameter is omitted or NULL,
* string is assumed to be encoded in
* iconv.internal_encoding.
* @return 0|positive-int Returns the character count of string, as an integer,
* or FALSE if an error occurs during the encoding.
* @param string $string
* @param null|string $encoding
* @return 0|positive-int
* @throws IconvException
*
*/
@@ -273,29 +102,10 @@ function iconv_strlen(string $string, ?string $encoding = null): int
/**
* Performs a character set conversion on the string
* string from from_encoding
* to to_encoding.
*
* @param string $from_encoding The input charset.
* @param string $to_encoding The output charset.
*
* If you append the string //TRANSLIT to
* to_encoding transliteration is activated. This
* means that when a character can't be represented in the target charset,
* it can be approximated through one or several similarly looking
* characters. If you append the string //IGNORE,
* characters that cannot be represented in the target charset are silently
* discarded. Otherwise, E_NOTICE is generated and the function
* will return FALSE.
*
* If and how //TRANSLIT works exactly depends on the
* system's iconv() implementation (cf. ICONV_IMPL).
* Some implementations are known to ignore //TRANSLIT,
* so the conversion is likely to fail for characters which are illegal for
* the to_encoding.
* @param string $string The string to be converted.
* @return string Returns the converted string.
* @param string $from_encoding
* @param string $to_encoding
* @param string $string
* @return string
* @throws IconvException
*
*/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -5,104 +5,9 @@
use Safe\Exceptions\InfoException;
/**
* Set the various assert control options or just query
* their current settings.
*
* @param int $what
* Assert Options
*
*
*
* Option
* INI Setting
* Default value
* Description
*
*
*
*
* ASSERT_ACTIVE
* assert.active
* 1
* enable assert evaluation
*
*
* ASSERT_WARNING
* assert.warning
* 1
* issue a PHP warning for each failed assertion
*
*
* ASSERT_BAIL
* assert.bail
* 0
* terminate execution on failed assertions
*
*
* ASSERT_QUIET_EVAL
* assert.quiet_eval
* 0
*
* disable error_reporting during assertion expression
* evaluation
*
*
*
* ASSERT_CALLBACK
* assert.callback
* (NULL)
* Callback to call on failed assertions
*
*
*
*
* @param mixed $value An optional new value for the option.
*
* The callback function set via ASSERT_CALLBACK or assert.callback should
* have the following signature:
*
* voidassert_callback
* stringfile
* intline
* stringassertion
* stringdescription
*
*
*
* file
*
*
* The file where assert has been called.
*
*
*
*
* line
*
*
* The line where assert has been called.
*
*
*
*
* assertion
*
*
* The assertion that has been passed to assert,
* converted to a string.
*
*
*
*
* description
*
*
* The description that has been passed to assert.
*
*
*
*
* @return mixed Returns the original setting of any options.
* @param mixed $value
* @return mixed
* @throws InfoException
*
*/
@@ -122,11 +27,7 @@ function assert_options(int $what, $value = null)
/**
* Sets the process title visible in tools such as top and
* ps. This function is available only in
* CLI mode.
*
* @param string $title The new title.
* @param string $title
* @throws InfoException
*
*/
@@ -141,56 +42,7 @@ function cli_set_process_title(string $title): void
/**
* Loads the PHP extension given by the parameter
* extension_filename.
*
* Use extension_loaded to test whether a given
* extension is already available or not. This works on both built-in
* extensions and dynamically loaded ones (either through php.ini or
* dl).
*
* @param string $extension_filename This parameter is only the filename of the
* extension to load which also depends on your platform. For example,
* the sockets extension (if compiled
* as a shared module, not the default!) would be called
* sockets.so on Unix platforms whereas it is called
* php_sockets.dll on the Windows platform.
*
* The directory where the extension is loaded from depends on your
* platform:
*
* Windows - If not explicitly set in the php.ini, the extension is
* loaded from C:\php5\ by default.
*
* Unix - If not explicitly set in the php.ini, the default extension
* directory depends on
*
*
*
* whether PHP has been built with --enable-debug
* or not
*
*
*
*
* whether PHP has been built with (experimental) ZTS (Zend Thread Safety)
* support or not
*
*
*
*
* the current internal ZEND_MODULE_API_NO (Zend
* internal module API number, which is basically the date on which a
* major module API change happened, e.g. 20010901)
*
*
*
* Taking into account the above, the directory then defaults to
* <install-dir>/lib/php/extensions/ <debug-or-not>-<zts-or-not>-ZEND_MODULE_API_NO,
* e.g.
* /usr/local/php/lib/php/extensions/debug-non-zts-20010901
* or
* /usr/local/php/lib/php/extensions/no-debug-zts-20010901.
* @param string $extension_filename
* @throws InfoException
*
*/
@@ -205,18 +57,8 @@ function dl(string $extension_filename): void
/**
* Gets the value of a PHP configuration option.
*
* This function will not return configuration information set when the PHP
* was compiled, or read from an Apache configuration file.
*
* To check whether the system is using a configuration file, try retrieving the
* value of the cfg_file_path configuration setting. If this is available, a
* configuration file is being used.
*
* @param string $option The configuration option name.
* @return mixed Returns the current value of the PHP configuration variable specified by
* option, or FALSE if an error occurs.
* @param string $option
* @return mixed
* @throws InfoException
*
*/
@@ -232,9 +74,7 @@ function get_cfg_var(string $option)
/**
*
*
* @return string Returns the path, as a string.
* @return string
* @throws InfoException
*
*/
@@ -250,14 +90,7 @@ function get_include_path(): string
/**
* Gets the time of the last modification of the main script of execution.
*
* If you're interested in getting the last modification time
* of a different file, consider using filemtime.
*
* @return int Returns the time of the last modification of the current
* page. The value returned is a Unix timestamp, suitable for
* feeding to date.
* @return int
* @throws InfoException
*
*/
@@ -273,9 +106,7 @@ function getlastmod(): int
/**
*
*
* @return int Returns the group ID of the current script.
* @return int
* @throws InfoException
*
*/
@@ -291,9 +122,7 @@ function getmygid(): int
/**
* Gets the inode of the current script.
*
* @return int Returns the current script's inode as an integer.
* @return int
* @throws InfoException
*
*/
@@ -309,9 +138,7 @@ function getmyinode(): int
/**
* Gets the current PHP process ID.
*
* @return int Returns the current PHP process ID.
* @return int
* @throws InfoException
*
*/
@@ -327,9 +154,7 @@ function getmypid(): int
/**
*
*
* @return int Returns the user ID of the current script.
* @return int
* @throws InfoException
*
*/
@@ -345,12 +170,10 @@ function getmyuid(): int
/**
* Parses options passed to the script.
*
* @param string $short_options
* @param array $long_options
* @param int|null $rest_index
* @return array|array|array This function will return an array of option / argument pairs.
* @return array|array|array
* @throws InfoException
*
*/
@@ -366,14 +189,8 @@ function getopt(string $short_options, array $long_options = [], ?int &$rest_ind
/**
* This is an interface to getrusage(2). It gets data returned
* from the system call.
*
* @param int $mode If mode is 1, getrusage will be called with
* RUSAGE_CHILDREN.
* @return array Returns an associative array containing the data returned from the system
* call. All entries are accessible by using their documented field names.
* Returns FALSE on failure.
* @param int $mode
* @return array
* @throws InfoException
*
*/
@@ -389,12 +206,8 @@ function getrusage(int $mode = 0): array
/**
* Returns the value of the configuration option on success.
*
* @param string $option The configuration option name.
* @return string Returns the value of the configuration option as a string on success, or an
* empty string for null values. Returns FALSE if the
* configuration option doesn't exist.
* @param string $option
* @return string
* @throws InfoException
*
*/
@@ -410,15 +223,9 @@ function ini_get(string $option): string
/**
* Sets the value of the given configuration option. The configuration option
* will keep this new value during the script's execution, and will be restored
* at the script's ending.
*
* @param string $option Not all the available options can be changed using
* ini_set. There is a list of all available options
* in the appendix.
* @param bool|float|int|null|string $value The new value for the option.
* @return string Returns the old value on success.
* @param string $option
* @param bool|float|int|null|string $value
* @return string
* @throws InfoException
*
*/
@@ -434,18 +241,7 @@ function ini_set(string $option, $value): string
/**
*
*
* @return non-empty-string Returns the interface type, as a lowercase string.
*
* Although not exhaustive, the possible return values include
* apache,
* apache2handler,
* cgi (until PHP 5.3),
* cgi-fcgi, cli, cli-server,
* embed, fpm-fcgi,
* litespeed,
* phpdbg.
* @return non-empty-string
* @throws InfoException
*
*/
@@ -461,71 +257,7 @@ function php_sapi_name(): string
/**
* This function prints out the credits listing the PHP developers,
* modules, etc. It generates the appropriate HTML codes to insert
* the information in a page.
*
* @param int $flags To generate a custom credits page, you may want to use the
* flags parameter.
*
*
* Pre-defined phpcredits flags
*
*
*
* name
* description
*
*
*
*
* CREDITS_ALL
*
* All the credits, equivalent to using: CREDITS_DOCS +
* CREDITS_GENERAL + CREDITS_GROUP +
* CREDITS_MODULES + CREDITS_FULLPAGE.
* It generates a complete stand-alone HTML page with the appropriate tags.
*
*
*
* CREDITS_DOCS
* The credits for the documentation team
*
*
* CREDITS_FULLPAGE
*
* Usually used in combination with the other flags. Indicates
* that a complete stand-alone HTML page needs to be
* printed including the information indicated by the other
* flags.
*
*
*
* CREDITS_GENERAL
*
* General credits: Language design and concept, PHP authors
* and SAPI module.
*
*
*
* CREDITS_GROUP
* A list of the core developers
*
*
* CREDITS_MODULES
*
* A list of the extension modules for PHP, and their authors
*
*
*
* CREDITS_SAPI
*
* A list of the server API modules for PHP, and their authors
*
*
*
*
*
* @param int $flags
* @throws InfoException
*
*/
@@ -540,102 +272,7 @@ function phpcredits(int $flags = CREDITS_ALL): void
/**
* Outputs a large amount of information about the current state of PHP.
* This includes information about PHP compilation options and extensions,
* the PHP version, server information and environment (if compiled as a
* module), the PHP environment, OS version information, paths, master and
* local values of configuration options, HTTP headers, and the PHP License.
*
* Because every system is setup differently, phpinfo is
* commonly used to check configuration settings and for available
* predefined variables
* on a given system.
*
* phpinfo is also a valuable debugging tool as it
* contains all EGPCS (Environment, GET, POST, Cookie, Server) data.
*
* @param int $flags The output may be customized by passing one or more of the
* following constants bitwise values summed
* together in the optional flags parameter.
* One can also combine the respective constants or bitwise values
* together with the bitwise or operator.
*
*
* phpinfo options
*
*
*
* Name (constant)
* Value
* Description
*
*
*
*
* INFO_GENERAL
* 1
*
* The configuration line, php.ini location, build date, Web
* Server, System and more.
*
*
*
* INFO_CREDITS
* 2
*
* PHP Credits. See also phpcredits.
*
*
*
* INFO_CONFIGURATION
* 4
*
* Current Local and Master values for PHP directives. See
* also ini_get.
*
*
*
* INFO_MODULES
* 8
*
* Loaded modules and their respective settings. See also
* get_loaded_extensions.
*
*
*
* INFO_ENVIRONMENT
* 16
*
* Environment Variable information that's also available in
* $_ENV.
*
*
*
* INFO_VARIABLES
* 32
*
* Shows all
* predefined variables from EGPCS (Environment, GET,
* POST, Cookie, Server).
*
*
*
* INFO_LICENSE
* 64
*
* PHP License information. See also the license FAQ.
*
*
*
* INFO_ALL
* -1
*
* Shows all of the above.
*
*
*
*
*
* @param int $flags
* @throws InfoException
*
*/
@@ -650,12 +287,7 @@ function phpinfo(int $flags = INFO_ALL): void
/**
* Adds assignment to the server environment. The
* environment variable will only exist for the duration of the current
* request. At the end of the request the environment is restored to its
* original state.
*
* @param string $assignment The setting, like "FOO=BAR"
* @param string $assignment
* @throws InfoException
*
*/
@@ -670,12 +302,8 @@ function putenv(string $assignment): void
/**
* Sets the include_path
* configuration option for the duration of the script.
*
* @param string $include_path The new value for the include_path
* @return string Returns the old include_path on
* success.
* @param string $include_path
* @return string
* @throws InfoException
*
*/
@@ -691,19 +319,7 @@ function set_include_path(string $include_path): string
/**
* Set the number of seconds a script is allowed to run. If this is reached,
* the script returns a fatal error. The default limit is 30 seconds or, if
* it exists, the max_execution_time value defined in the
* php.ini.
*
* When called, set_time_limit restarts the timeout
* counter from zero. In other words, if the timeout is the default 30
* seconds, and 25 seconds into script execution a call such as
* set_time_limit(20) is made, the script will run for a
* total of 45 seconds before timing out.
*
* @param int $seconds The maximum execution time, in seconds. If set to zero, no time limit
* is imposed.
* @param int $seconds
* @throws InfoException
*
*/

View File

@@ -5,10 +5,7 @@
use Safe\Exceptions\InotifyException;
/**
* Initialize an inotify instance for use with
* inotify_add_watch
*
* @return resource A stream resource.
* @return resource
* @throws InotifyException
*
*/
@@ -24,13 +21,8 @@ function inotify_init()
/**
* inotify_rm_watch removes the watch
* watch_descriptor from the inotify instance
* inotify_instance.
*
* @param resource $inotify_instance Resource returned by
* inotify_init
* @param int $watch_descriptor Watch to remove from the instance
* @param resource $inotify_instance
* @param int $watch_descriptor
* @throws InotifyException
*
*/

View File

@@ -5,40 +5,10 @@
use Safe\Exceptions\JsonException;
/**
* Returns a string containing the JSON representation of the supplied
* value.
*
* The encoding is affected by the supplied flags
* and additionally the encoding of float values depends on the value of
* serialize_precision.
*
* @param mixed $value The value being encoded. Can be any type except
* a resource.
*
* All string data must be UTF-8 encoded.
*
* PHP implements a superset of JSON as specified in the original
* RFC 7159.
* @param int $flags Bitmask consisting of
* JSON_FORCE_OBJECT,
* JSON_HEX_QUOT,
* JSON_HEX_TAG,
* JSON_HEX_AMP,
* JSON_HEX_APOS,
* JSON_INVALID_UTF8_IGNORE,
* JSON_INVALID_UTF8_SUBSTITUTE,
* JSON_NUMERIC_CHECK,
* JSON_PARTIAL_OUTPUT_ON_ERROR,
* JSON_PRESERVE_ZERO_FRACTION,
* JSON_PRETTY_PRINT,
* JSON_UNESCAPED_LINE_TERMINATORS,
* JSON_UNESCAPED_SLASHES,
* JSON_UNESCAPED_UNICODE,
* JSON_THROW_ON_ERROR.
* The behaviour of these constants is described on the
* JSON constants page.
* @param positive-int $depth Set the maximum depth. Must be greater than zero.
* @return non-empty-string Returns a JSON encoded string on success.
* @param mixed $value
* @param int $flags
* @param positive-int $depth
* @return non-empty-string
* @throws JsonException
*
*/

File diff suppressed because it is too large Load Diff

View File

@@ -5,47 +5,7 @@
use Safe\Exceptions\LibxmlException;
/**
* Changes the default external entity loader.
* This can be used to suppress the expansion of arbitrary external entities to avoid XXE attacks,
* even when LIBXML_NOENT has been set for the respective operation,
* and is usually preferable over calling libxml_disable_entity_loader.
*
* @param callable $resolver_function A callable with the following signature:
*
* resourcestringnullresolver
* stringpublic_id
* stringsystem_id
* arraycontext
*
*
*
* public_id
*
*
* The public ID.
*
*
*
*
* system_id
*
*
* The system ID.
*
*
*
*
* context
*
*
* An array with the four elements "directory", "intSubName",
* "extSubURI" and "extSubSystem".
*
*
*
*
* This callable should return a resource, a string from which a resource can be
* opened. If NULL is returned, the entity reference resolution will fail.
* @param callable $resolver_function
* @throws LibxmlException
*
*/

View File

@@ -5,11 +5,8 @@
use Safe\Exceptions\LzfException;
/**
* lzf_compress compresses the given
* data string using LZF encoding.
*
* @param string $data The string to compress.
* @return string Returns the compressed data.
* @param string $data
* @return string
* @throws LzfException
*
*/
@@ -25,11 +22,8 @@ function lzf_compress(string $data): string
/**
* lzf_compress decompresses the given
* data string containing lzf encoded data.
*
* @param string $data The compressed string.
* @return string Returns the decompressed data.
* @param string $data
* @return string
* @throws LzfException
*
*/

View File

@@ -5,24 +5,10 @@
use Safe\Exceptions\MailparseException;
/**
* Extracts/decodes a message section from the supplied filename.
*
* The contents of the section will be decoded according to their transfer
* encoding - base64, quoted-printable and uuencoded text are supported.
*
* @param resource $mimemail A valid MIME resource, created with
* mailparse_msg_create.
* @param mixed $filename Can be a file name or a valid stream resource.
* @param callable $callbackfunc If set, this must be either a valid callback that will be passed the
* extracted section, or NULL to make this function return the
* extracted section.
*
* If not specified, the contents will be sent to "stdout".
* @return string If callbackfunc is not NULL returns TRUE on
* success.
*
* If callbackfunc is set to NULL, returns the
* extracted section as a string.
* @param resource $mimemail
* @param mixed $filename
* @param callable $callbackfunc
* @return string
* @throws MailparseException
*
*/
@@ -42,11 +28,7 @@ function mailparse_msg_extract_part_file($mimemail, $filename, ?callable $callba
/**
* Frees a MIME resource.
*
* @param resource $mimemail A valid MIME resource allocated by
* mailparse_msg_create or
* mailparse_msg_parse_file.
* @param resource $mimemail
* @throws MailparseException
*
*/
@@ -61,15 +43,8 @@ function mailparse_msg_free($mimemail): void
/**
* Parses a file.
* This is the optimal way of parsing a mail file that you have on disk.
*
* @param string $filename Path to the file holding the message.
* The file is opened and streamed through the parser.
*
* The message contained in filename is supposed to end with a newline
* (CRLF); otherwise the last line of the message will not be parsed.
* @return resource Returns a MIME resource representing the structure.
* @param string $filename
* @return resource
* @throws MailparseException
*
*/
@@ -85,14 +60,8 @@ function mailparse_msg_parse_file(string $filename)
/**
* Incrementally parse data into the supplied mime mail resource.
*
* This function allow you to stream portions of a file at a time, rather
* than read and parse the whole thing.
*
* @param resource $mimemail A valid MIME resource.
* @param string $data The final chunk of data is supposed to end with a newline
* (CRLF); otherwise the last line of the message will not be parsed.
* @param resource $mimemail
* @param string $data
* @throws MailparseException
*
*/
@@ -107,13 +76,9 @@ function mailparse_msg_parse($mimemail, string $data): void
/**
* Streams data from the source file pointer, apply
* encoding and write to the destination file pointer.
*
* @param resource $sourcefp A valid file handle. The file is streamed through the parser.
* @param resource $destfp The destination file handle in which the encoded data will be written.
* @param string $encoding One of the character encodings supported by the
* mbstring module.
* @param resource $sourcefp
* @param resource $destfp
* @param string $encoding
* @throws MailparseException
*
*/

View File

@@ -5,17 +5,9 @@
use Safe\Exceptions\MbstringException;
/**
* Returns a string containing the character specified by the Unicode code point value,
* encoded in the specified encoding.
*
* This function complements mb_ord.
*
* @param int $codepoint A Unicode codepoint value, e.g. 128024 for U+1F418 ELEPHANT
* @param null|string $encoding The encoding
* parameter is the character encoding. If it is omitted or NULL, the internal character
* encoding value will be used.
* @return string A string containing the requested character, if it can be represented in the specified
* encoding.
* @param int $codepoint
* @param null|string $encoding
* @return string
* @throws MbstringException
*
*/
@@ -35,23 +27,10 @@ function mb_chr(int $codepoint, ?string $encoding = null): string
/**
* Converts the character encoding of string
* to to_encoding
* from optionally from_encoding.
* If string is an array, all its string values will be
* converted recursively.
*
* @param array|string $string The string or array being encoded.
* @param string $to_encoding The type of encoding that string is being converted to.
* @param mixed $from_encoding Is specified by character code names before conversion. It is either
* an array, or a comma separated enumerated list.
* If from_encoding is not specified, the internal
* encoding will be used.
*
*
* See supported
* encodings.
* @return array|string The encoded string or array on success.
* @param array|string $string
* @param string $to_encoding
* @param mixed $from_encoding
* @return array|string
* @throws MbstringException
*
*/
@@ -71,27 +50,11 @@ function mb_convert_encoding($string, string $to_encoding, $from_encoding = null
/**
* Converts
* character encoding of variables var and vars in
* encoding from_encoding to encoding
* to_encoding.
*
* mb_convert_variables join strings in Array
* or Object to detect encoding, since encoding detection tends to
* fail for short strings. Therefore, it is impossible to mix
* encoding in single array or object.
*
* @param string $to_encoding The encoding that the string is being converted to.
* @param array|string $from_encoding from_encoding is specified as an array
* or comma separated string, it tries to detect encoding from
* from-coding. When from_encoding
* is omitted, detect_order is used.
* @param array|object|string $var var is the reference to the
* variable being converted. String, Array and Object are accepted.
* mb_convert_variables assumes all parameters
* have the same encoding.
* @param array|object|string $vars Additional vars.
* @return string The character encoding before conversion for success.
* @param string $to_encoding
* @param array|string $from_encoding
* @param array|object|string $var
* @param array|object|string $vars
* @return string
* @throws MbstringException
*
*/
@@ -107,31 +70,8 @@ function mb_convert_variables(string $to_encoding, $from_encoding, &$var, ...$va
/**
* Sets the automatic character
* encoding detection order to encoding.
*
* @param non-empty-list|non-falsy-string|null $encoding encoding is an array or
* comma separated list of character encoding. See supported encodings.
*
* If encoding is omitted or NULL, it returns
* the current character encoding detection order as array.
*
* This setting affects mb_detect_encoding and
* mb_send_mail.
*
* mbstring currently implements the following
* encoding detection filters. If there is an invalid byte sequence
* for the following encodings, encoding detection will fail.
*
* For ISO-8859-*, mbstring
* always detects as ISO-8859-*.
*
* For UTF-16, UTF-32,
* UCS2 and UCS4, encoding
* detection will fail always.
* @return bool|list When setting the encoding detection order, TRUE is returned on success.
*
* When getting the encoding detection order, an ordered array of the encodings is returned.
* @param non-empty-list|non-falsy-string|null $encoding
* @return bool|list
* @throws MbstringException
*
*/
@@ -151,10 +91,8 @@ function mb_detect_order($encoding = null)
/**
* Returns an array of aliases for a known encoding type.
*
* @param string $encoding The encoding type being checked, for aliases.
* @return list Returns a numerically indexed array of encoding aliases on success
* @param string $encoding
* @return list
* @throws MbstringException
*
*/
@@ -170,36 +108,11 @@ function mb_encoding_aliases(string $encoding): array
/**
* Scans string for matches to
* pattern, then replaces the matched text
* with the output of callback function.
*
* The behavior of this function is almost identical to mb_ereg_replace,
* except for the fact that instead of
* replacement parameter, one should specify a
* callback.
*
* @param string $pattern The regular expression pattern.
*
* Multibyte characters may be used in pattern.
* @param callable(array):string $callback A callback that will be called and passed an array of matched elements
* in the subject string. The callback should
* return the replacement string.
*
* You'll often need the callback function
* for a mb_ereg_replace_callback in just one place.
* In this case you can use an
* anonymous function to
* declare the callback within the call to
* mb_ereg_replace_callback. By doing it this way
* you have all information for the call in one place and do not
* clutter the function namespace with a callback function's name
* not used anywhere else.
* @param string $string The string being checked.
* @param null|string $options The search option. See mb_regex_set_options for explanation.
* @return null|string The resultant string on success.
* If string is not valid for the current encoding, NULL
* is returned.
* @param string $pattern
* @param callable(array):string $callback
* @param string $string
* @param null|string $options
* @return null|string
* @throws MbstringException
*
*/
@@ -219,17 +132,11 @@ function mb_ereg_replace_callback(string $pattern, callable $callback, string $s
/**
*
*
* @param string $pattern The regular expression pattern.
*
* Multibyte characters may be used in pattern.
* @param string $replacement The replacement text.
* @param string $string The string being checked.
* @param string $pattern
* @param string $replacement
* @param string $string
* @param null|string $options
* @return null|string The resultant string on success.
* If string is not valid for the current encoding, NULL
* is returned.
* @return null|string
* @throws MbstringException
*
*/
@@ -249,8 +156,6 @@ function mb_ereg_replace(string $pattern, string $replacement, string $string, ?
/**
*
*
* @return array
* @throws MbstringException
*
@@ -267,16 +172,9 @@ function mb_ereg_search_getregs(): array
/**
* mb_ereg_search_init sets
* string and pattern
* for a multibyte regular expression. These values are used for
* mb_ereg_search,
* mb_ereg_search_pos, and
* mb_ereg_search_regs.
*
* @param string $string The search string.
* @param null|string $pattern The search pattern.
* @param null|string $options The search option. See mb_regex_set_options for explanation.
* @param string $string
* @param null|string $pattern
* @param null|string $options
* @throws MbstringException
*
*/
@@ -297,10 +195,8 @@ function mb_ereg_search_init(string $string, ?string $pattern = null, ?string $o
/**
* Returns the matched part of a multibyte regular expression.
*
* @param null|string $pattern The search pattern.
* @param null|string $options The search option. See mb_regex_set_options for explanation.
* @param null|string $pattern
* @param null|string $options
* @return array
* @throws MbstringException
*
@@ -323,9 +219,7 @@ function mb_ereg_search_regs(?string $pattern = null, ?string $options = null):
/**
*
*
* @param int $offset The position to set. If it is negative, it counts from the end of the string.
* @param int $offset
* @throws MbstringException
*
*/
@@ -340,15 +234,11 @@ function mb_ereg_search_setpos(int $offset): void
/**
*
*
* @param string $pattern The regular expression pattern. Multibyte characters may be used. The case will be ignored.
* @param string $replacement The replacement text.
* @param string $string The searched string.
* @param string $pattern
* @param string $replacement
* @param string $string
* @param null|string $options
* @return string The resultant string.
* If string is not valid for the current encoding, NULL
* is returned.
* @return string
* @throws MbstringException
*
*/
@@ -368,29 +258,8 @@ function mb_eregi_replace(string $pattern, string $replacement, string $string,
/**
*
*
* @param string $type If type is not specified or is specified as "all",
* "internal_encoding", "http_input",
* "http_output", "http_output_conv_mimetypes",
* "mail_charset", "mail_header_encoding",
* "mail_body_encoding", "illegal_chars",
* "encoding_translation", "language",
* "detect_order", "substitute_character"
* and "strict_detection"
* will be returned.
*
* If type is specified as
* "internal_encoding", "http_input",
* "http_output", "http_output_conv_mimetypes",
* "mail_charset", "mail_header_encoding",
* "mail_body_encoding", "illegal_chars",
* "encoding_translation", "language",
* "detect_order", "substitute_character"
* or "strict_detection"
* the specified setting parameter will be returned.
* @return mixed An array of type information if type
* is not specified, otherwise a specific type.
* @param string $type
* @return mixed
* @throws MbstringException
*
*/
@@ -406,20 +275,8 @@ function mb_get_info(string $type = "all")
/**
* Set/Get the HTTP output character encoding.
* Output after this function is called will be converted from the set internal encoding to encoding.
*
* @param null|string $encoding If encoding is set,
* mb_http_output sets the HTTP output character
* encoding to encoding.
*
* If encoding is omitted,
* mb_http_output returns the current HTTP output
* character encoding.
* @return bool|string If encoding is omitted,
* mb_http_output returns the current HTTP output
* character encoding. Otherwise,
* Returns TRUE on success.
* @param null|string $encoding
* @return bool|string
* @throws MbstringException
*
*/
@@ -439,18 +296,8 @@ function mb_http_output(?string $encoding = null)
/**
* Set/Get the internal character encoding
*
* @param null|string $encoding encoding is the character encoding name
* used for the HTTP input character encoding conversion, HTTP output
* character encoding conversion, and the default character encoding
* for string functions defined by the mbstring module.
* You should notice that the internal encoding is totally different from the one for multibyte regex.
* @return bool|string If encoding is set, then
* Returns TRUE on success.
* In this case, the character encoding for multibyte regex is NOT changed.
* If encoding is omitted, then
* the current character encoding name is returned.
* @param null|string $encoding
* @return bool|string
* @throws MbstringException
*
*/
@@ -470,15 +317,9 @@ function mb_internal_encoding(?string $encoding = null)
/**
* Returns the Unicode code point value of the given character.
*
* This function complements mb_chr.
*
* @param string $string A string
* @param null|string $encoding The encoding
* parameter is the character encoding. If it is omitted or NULL, the internal character
* encoding value will be used.
* @return int The Unicode code point for the first character of string.
* @param string $string
* @param null|string $encoding
* @return int
* @throws MbstringException
*
*/
@@ -498,15 +339,8 @@ function mb_ord(string $string, ?string $encoding = null): int
/**
* Parses GET/POST/COOKIE data and
* sets global variables. Since PHP does not provide raw POST/COOKIE
* data, it can only be used for GET data for now. It parses URL
* encoded data, detects encoding, converts coding to internal
* encoding and set values to the result array or
* global variables.
*
* @param string $string The URL encoded data.
* @param array|null $result An array containing decoded and character encoded converted values.
* @param string $string
* @param array|null $result
* @throws MbstringException
*
*/
@@ -521,11 +355,7 @@ function mb_parse_str(string $string, ?array &$result): void
/**
* Set/Get character encoding for a multibyte regex.
*
* @param null|string $encoding The encoding
* parameter is the character encoding. If it is omitted or NULL, the internal character
* encoding value will be used.
* @param null|string $encoding
* @return bool|string
* @throws MbstringException
*
@@ -546,59 +376,11 @@ function mb_regex_encoding(?string $encoding = null)
/**
* Sends email. Headers and messages are converted and encoded according
* to the mb_language setting. It's a wrapper function
* for mail, so see also mail for details.
*
* @param string $to The mail addresses being sent to. Multiple
* recipients may be specified by putting a comma between each
* address in to.
* This parameter is not automatically encoded.
* @param string $subject The subject of the mail.
* @param string $message The message of the mail.
* @param array|null|string $additional_headers String or array to be inserted at the end of the email header.
*
* This is typically used to add extra headers (From, Cc, and Bcc).
* Multiple extra headers should be separated with a CRLF (\r\n).
* Validate parameter not to be injected unwanted headers by attackers.
*
* If an array is passed, its keys are the header names and its
* values are the respective header values.
*
* When sending mail, the mail must contain
* a From header. This can be set with the
* additional_headers parameter, or a default
* can be set in php.ini.
*
* Failing to do this will result in an error
* message similar to Warning: mail(): "sendmail_from" not
* set in php.ini or custom "From:" header missing.
* The From header sets also
* Return-Path under Windows.
*
* If messages are not received, try using a LF (\n) only.
* Some Unix mail transfer agents (most notably
* qmail) replace LF by CRLF
* automatically (which leads to doubling CR if CRLF is used).
* This should be a last resort, as it does not comply with
* RFC 2822.
* @param null|string $additional_params additional_params is a MTA command line
* parameter. It is useful when setting the correct Return-Path
* header when using sendmail.
*
* This parameter is escaped by escapeshellcmd internally
* to prevent command execution. escapeshellcmd prevents
* command execution, but allows to add additional parameters. For security reason,
* this parameter should be validated.
*
* Since escapeshellcmd is applied automatically, some characters
* that are allowed as email addresses by internet RFCs cannot be used. Programs
* that are required to use these characters mail cannot be used.
*
* The user that the webserver runs as should be added as a trusted user to the
* sendmail configuration to prevent a 'X-Warning' header from being added
* to the message when the envelope sender (-f) is set using this method.
* For sendmail users, this file is /etc/mail/trusted-users.
* @param string $to
* @param string $subject
* @param string $message
* @param array|null|string $additional_headers
* @param null|string $additional_params
* @throws MbstringException
*
*/
@@ -617,12 +399,10 @@ function mb_send_mail(string $to, string $subject, string $message, $additional_
/**
*
*
* @param string $pattern The regular expression pattern.
* @param string $string The string being split.
* @param string $pattern
* @param string $string
* @param int $limit
* @return list The result as an array.
* @return list
* @throws MbstringException
*
*/

View File

@@ -5,26 +5,9 @@
use Safe\Exceptions\MiscException;
/**
* Defines a named constant at runtime.
*
* @param string $constant_name The name of the constant.
*
* It is possible to define constants with reserved or
* even invalid names, whose value can (only) be retrieved with
* constant. However, doing so is not recommended.
* @param mixed $value The value of the constant. In PHP 5, value must
* be a scalar value (int,
* float, string, bool, or
* NULL). In PHP 7, array values are also accepted.
*
* While it is possible to define resource constants, it is
* not recommended and may cause unpredictable behavior.
* @param bool $case_insensitive If set to TRUE, the constant will be defined case-insensitive.
* The default behavior is case-sensitive; i.e.
* CONSTANT and Constant represent
* different values.
*
* Case-insensitive constants are stored as lower-case.
* @param string $constant_name
* @param mixed $value
* @param bool $case_insensitive
* @throws MiscException
*
*/
@@ -39,22 +22,9 @@ function define(string $constant_name, $value, bool $case_insensitive = false):
/**
* Prints out or returns a syntax highlighted version of the code contained
* in filename using the colors defined in the
* built-in syntax highlighter for PHP.
*
* Many servers are configured to automatically highlight files
* with a phps extension. For example,
* example.phps when viewed will show the
* syntax highlighted source of the file. To enable this, add this
* line to the httpd.conf:
*
* @param string $filename Path to the PHP file to be highlighted.
* @param bool $return Set this parameter to TRUE to make this function return the
* highlighted code.
* @return bool|string If return is set to TRUE, returns the highlighted
* code as a string instead of printing it out. Otherwise, it will return
* TRUE on success.
* @param string $filename
* @param bool $return
* @return bool|string
* @throws MiscException
*
*/
@@ -70,14 +40,9 @@ function highlight_file(string $filename, bool $return = false)
/**
*
*
* @param string $string The PHP code to be highlighted. This should include the opening tag.
* @param bool $return Set this parameter to TRUE to make this function return the
* highlighted code.
* @return bool|string If return is set to TRUE, returns the highlighted
* code as a string instead of printing it out. Otherwise, it will return
* TRUE on success.
* @param string $string
* @param bool $return
* @return bool|string
* @throws MiscException
*
*/
@@ -93,15 +58,8 @@ function highlight_string(string $string, bool $return = false)
/**
*
*
* @param bool $as_number Whether the high resolution time should be returned as array
* or number.
* @return array{0:int,1:int}|float|int Returns an array of integers in the form [seconds, nanoseconds], if the
* parameter as_number is false. Otherwise the nanoseconds
* are returned as int (64bit platforms) or float
* (32bit platforms).
* Returns FALSE on failure.
* @param bool $as_number
* @return array{0:int,1:int}|float|int
* @throws MiscException
*
*/
@@ -117,156 +75,9 @@ function hrtime(bool $as_number = false)
/**
* Pack given arguments into a binary string according to
* format.
*
* The idea for this function was taken from Perl and all formatting codes
* work the same as in Perl. However, there are some formatting codes that are
* missing such as Perl's "u" format code.
*
* Note that the distinction between signed and unsigned values only
* affects the function unpack, where as
* function pack gives the same result for
* signed and unsigned format codes.
*
* @param string $format The format string consists of format codes
* followed by an optional repeater argument. The repeater argument can
* be either an integer value or * for repeating to
* the end of the input data. For a, A, h, H the repeat count specifies
* how many characters of one data argument are taken, for @ it is the
* absolute position where to put the next data, for everything else the
* repeat count specifies how many data arguments are consumed and packed
* into the resulting binary string.
*
* Currently implemented formats are:
*
* pack format characters
*
*
*
* Code
* Description
*
*
*
*
* a
* NUL-padded string
*
*
* A
* SPACE-padded string
*
* h
* Hex string, low nibble first
*
* H
* Hex string, high nibble first
* csigned char
*
* C
* unsigned char
*
* s
* signed short (always 16 bit, machine byte order)
*
*
* S
* unsigned short (always 16 bit, machine byte order)
*
*
* n
* unsigned short (always 16 bit, big endian byte order)
*
*
* v
* unsigned short (always 16 bit, little endian byte order)
*
*
* i
* signed integer (machine dependent size and byte order)
*
*
* I
* unsigned integer (machine dependent size and byte order)
*
*
* l
* signed long (always 32 bit, machine byte order)
*
*
* L
* unsigned long (always 32 bit, machine byte order)
*
*
* N
* unsigned long (always 32 bit, big endian byte order)
*
*
* V
* unsigned long (always 32 bit, little endian byte order)
*
*
* q
* signed long long (always 64 bit, machine byte order)
*
*
* Q
* unsigned long long (always 64 bit, machine byte order)
*
*
* J
* unsigned long long (always 64 bit, big endian byte order)
*
*
* P
* unsigned long long (always 64 bit, little endian byte order)
*
*
* f
* float (machine dependent size and representation)
*
*
* g
* float (machine dependent size, little endian byte order)
*
*
* G
* float (machine dependent size, big endian byte order)
*
*
* d
* double (machine dependent size and representation)
*
*
* e
* double (machine dependent size, little endian byte order)
*
*
* E
* double (machine dependent size, big endian byte order)
*
*
* x
* NUL byte
*
*
* X
* Back up one byte
*
*
* Z
* NUL-padded string
*
*
* @
* NUL-fill to absolute position
*
*
*
*
* @param string $format
* @param mixed $values
* @return string Returns a binary string containing data.
* @return string
* @throws MiscException
*
*/
@@ -286,15 +97,10 @@ function pack(string $format, ...$values): string
/**
* Convert string from one codepage to another.
*
* @param int|string $in_codepage The codepage of the subject string.
* Either the codepage name or identifier.
* @param int|string $out_codepage The codepage to convert the subject string to.
* Either the codepage name or identifier.
* @param string $subject The string to convert.
* @return string The subject string converted to
* out_codepage.
* @param int|string $in_codepage
* @param int|string $out_codepage
* @param string $subject
* @return string
* @throws MiscException
*
*/
@@ -310,9 +116,7 @@ function sapi_windows_cp_conv($in_codepage, $out_codepage, string $subject): str
/**
* Set the codepage of the current process.
*
* @param int $codepage A codepage identifier.
* @param int $codepage
* @throws MiscException
*
*/
@@ -327,13 +131,8 @@ function sapi_windows_cp_set(int $codepage): void
/**
* Sends a CTRL event to another process in the same process group.
*
* @param int $event The CTRL even to send;
* either PHP_WINDOWS_EVENT_CTRL_C
* or PHP_WINDOWS_EVENT_CTRL_BREAK.
* @param int $pid The ID of the process to which to send the event to. If 0
* is given, the event is sent to all processes of the process group.
* @param int $event
* @param int $pid
* @throws MiscException
*
*/
@@ -348,32 +147,7 @@ function sapi_windows_generate_ctrl_event(int $event, int $pid = 0): void
/**
* Sets or removes a CTRL event handler, which allows Windows
* CLI processes to intercept or ignore CTRL+C and
* CTRL+BREAK events. Note that in multithreaded environments,
* this is only possible when called from the main thread.
*
* @param callable|null $handler A callback function to set or remove. If set, this function will be called
* whenever a CTRL+C or CTRL+BREAK event
* occurs. The function is supposed to have the following signature:
*
* voidhandler
* intevent
*
*
*
* event
*
*
* The CTRL event which has been received;
* either PHP_WINDOWS_EVENT_CTRL_C
* or PHP_WINDOWS_EVENT_CTRL_BREAK.
*
*
*
*
* Setting a NULL handler causes the process to ignore
* CTRL+C events, but not CTRL+BREAK events.
* @param callable|null $handler
* @param bool $add
* @throws MiscException
*
@@ -389,18 +163,8 @@ function sapi_windows_set_ctrl_handler(?callable $handler, bool $add = true): vo
/**
* If enable is NULL, the function returns TRUE if the stream stream has VT100 control codes enabled.
*
* If enable is a bool, the function will try to enable or disable the VT100 features of the stream stream.
* If the feature has been successfully enabled (or disabled).
*
* At startup, PHP tries to enable the VT100 feature of the STDOUT/STDERR streams. By the way, if those streams are redirected to a file, the VT100 features may not be enabled.
*
* If VT100 support is enabled, it is possible to use control sequences as they are known from the VT100 terminal.
* They allow the modification of the terminal's output. On Windows these sequences are called Console Virtual Terminal Sequences.
*
* @param resource $stream The stream on which the function will operate.
* @param bool|null $enable If bool, the VT100 feature will be enabled (if TRUE) or disabled (if FALSE).
* @param resource $stream
* @param bool|null $enable
* @throws MiscException
*
*/
@@ -419,17 +183,8 @@ function sapi_windows_vt100_support($stream, ?bool $enable = null): void
/**
*
*
* @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.
* @param int $seconds
* @return int
* @throws MiscException
*
*/
@@ -445,29 +200,9 @@ function sleep(int $seconds): int
/**
* Delays program execution for the given number of
* seconds and nanoseconds.
*
* @param int $seconds Must be a non-negative integer.
* @param int $nanoseconds Must be a non-negative integer less than 1 billion.
* @return array{seconds:0|positive-int,nanoseconds:0|positive-int}|bool Returns TRUE on success.
*
* If the delay was interrupted by a signal, an associative array will be
* returned with the components:
*
*
*
* seconds - number of seconds remaining in
* the delay
*
*
*
*
* nanoseconds - number of nanoseconds
* remaining in the delay
*
*
*
* @param int $seconds
* @param int $nanoseconds
* @return array{seconds:0|positive-int,nanoseconds:0|positive-int}|bool
* @throws MiscException
*
*/
@@ -483,10 +218,7 @@ function time_nanosleep(int $seconds, int $nanoseconds)
/**
* Makes the script sleep until the specified
* timestamp.
*
* @param float $timestamp The timestamp when the script should wake.
* @param float $timestamp
* @throws MiscException
*
*/
@@ -501,35 +233,10 @@ function time_sleep_until(float $timestamp): void
/**
* Unpacks from a binary string into an array according to the given
* format.
*
* The unpacked data is stored in an associative array. To
* accomplish this you have to name the different format codes and
* separate them by a slash /. If a repeater argument is present,
* then each of the array keys will have a sequence number behind
* the given name.
*
* Changes were made to bring this function into line with Perl:
*
*
* The "a" code now retains trailing NULL bytes.
*
*
* The "A" code now strips all trailing ASCII whitespace (spaces, tabs,
* newlines, carriage returns, and NULL bytes).
*
*
* The "Z" code was added for NULL-padded strings, and removes trailing
* NULL bytes.
*
*
*
* @param string $format See pack for an explanation of the format codes.
* @param string $string The packed data.
* @param int $offset The offset to begin unpacking from.
* @return array Returns an associative array containing unpacked elements of binary
* string.
* @param string $format
* @param string $string
* @param int $offset
* @return array
* @throws MiscException
*
*/

View File

@@ -5,24 +5,7 @@
use Safe\Exceptions\MysqlException;
/**
* mysql_close closes the non-persistent connection to
* the MySQL server that's associated with the specified link identifier. If
* link_identifier isn't specified, the last opened
* link is used.
*
*
* Open non-persistent MySQL connections and result sets are automatically destroyed when a
* PHP script finishes its execution. So, while explicitly closing open
* connections and freeing result sets is optional, doing so is recommended.
* This will immediately return resources to PHP and MySQL, which can
* improve performance. For related information, see
* freeing resources
*
* @param null|resource $link_identifier The MySQL connection. If the
* link identifier is not specified, the last link opened by
* mysql_connect is assumed. If no connection is found or
* established, an E_WARNING level error is
* generated.
* @param null|resource $link_identifier
* @throws MysqlException
*
*/
@@ -37,39 +20,12 @@ function mysql_close($link_identifier = null): void
/**
* Opens or reuses a connection to a MySQL server.
*
* @param string $server The MySQL server. It can also include a port number. e.g.
* "hostname:port" or a path to a local socket e.g. ":/path/to/socket" for
* the localhost.
*
* If the PHP directive
* mysql.default_host is undefined (default), then the default
* value is 'localhost:3306'. In SQL safe mode, this parameter is ignored
* and value 'localhost:3306' is always used.
* @param string $username The username. Default value is defined by mysql.default_user. In
* SQL safe mode, this parameter is ignored and the name of the user that
* owns the server process is used.
* @param string $password The password. Default value is defined by mysql.default_password. In
* SQL safe mode, this parameter is ignored and empty password is used.
* @param bool $new_link If a second call is made to mysql_connect
* with the same arguments, no new link will be established, but
* instead, the link identifier of the already opened link will be
* returned. The new_link parameter modifies this
* behavior and makes mysql_connect always open
* a new link, even if mysql_connect was called
* before with the same parameters.
* In SQL safe mode, this parameter is ignored.
* @param int $client_flags The client_flags parameter can be a combination
* of the following constants:
* 128 (enable LOAD DATA LOCAL handling),
* MYSQL_CLIENT_SSL,
* MYSQL_CLIENT_COMPRESS,
* MYSQL_CLIENT_IGNORE_SPACE or
* MYSQL_CLIENT_INTERACTIVE.
* Read the section about for further information.
* In SQL safe mode, this parameter is ignored.
* @return resource Returns a MySQL link identifier on success.
* @param string $server
* @param string $username
* @param string $password
* @param bool $new_link
* @param int $client_flags
* @return resource
* @throws MysqlException
*
*/
@@ -97,17 +53,8 @@ function mysql_connect(?string $server = null, ?string $username = null, ?string
/**
* mysql_create_db attempts to create a new
* database on the server associated with the specified link
* identifier.
*
* @param string $database_name The name of the database being created.
* @param null|resource $link_identifier The MySQL connection. If the
* link identifier is not specified, the last link opened by
* mysql_connect is assumed. If no such link is found, it
* will try to create one as if mysql_connect had been called
* with no arguments. If no connection is found or established, an
* E_WARNING level error is generated.
* @param string $database_name
* @param null|resource $link_identifier
* @throws MysqlException
*
*/
@@ -122,23 +69,8 @@ function mysql_create_db(string $database_name, $link_identifier = null): void
/**
* mysql_data_seek moves the internal row
* pointer of the MySQL result associated with the specified result
* identifier to point to the specified row number. The next call
* to a MySQL fetch function, such as mysql_fetch_assoc,
* would return that row.
*
* row_number starts at 0. The
* row_number should be a value in the range from 0 to
* mysql_num_rows - 1. However if the result set
* is empty (mysql_num_rows == 0), a seek to 0 will
* fail with an E_WARNING and
* mysql_data_seek will return FALSE.
*
* @param resource $result The result resource that
* is being evaluated. This result comes from a call to
* mysql_query.
* @param int $row_number The desired row number of the new result pointer.
* @param resource $result
* @param int $row_number
* @throws MysqlException
*
*/
@@ -153,15 +85,10 @@ function mysql_data_seek($result, int $row_number): void
/**
* Retrieve the database name from a call to
* mysql_list_dbs.
*
* @param resource $result The result pointer from a call to mysql_list_dbs.
* @param int $row The index into the result set.
* @param mixed $field The field name.
* @return string Returns the database name on success. If FALSE
* is returned, use mysql_error to determine the nature
* of the error.
* @param resource $result
* @param int $row
* @param mixed $field
* @return string
* @throws MysqlException
*
*/
@@ -177,22 +104,10 @@ function mysql_db_name($result, int $row, $field = null): string
/**
* mysql_db_query selects a database, and executes a
* query on it.
*
* @param string $database The name of the database that will be selected.
* @param string $query The MySQL query.
*
* Data inside the query should be properly escaped.
* @param null|resource $link_identifier The MySQL connection. If the
* link identifier is not specified, the last link opened by
* mysql_connect is assumed. If no such link is found, it
* will try to create one as if mysql_connect had been called
* with no arguments. If no connection is found or established, an
* E_WARNING level error is generated.
* @return bool|resource Returns a positive MySQL result resource to the query result. The function also returns TRUE/FALSE for
* INSERT/UPDATE/DELETE
* queries to indicate success/failure.
* @param string $database
* @param string $query
* @param null|resource $link_identifier
* @return bool|resource
* @throws MysqlException
*
*/
@@ -208,19 +123,8 @@ function mysql_db_query(string $database, string $query, $link_identifier = null
/**
* mysql_drop_db attempts to drop (remove) an
* entire database from the server associated with the specified
* link identifier. This function is deprecated, it is preferable to use
* mysql_query to issue an sql
* DROP DATABASE statement instead.
*
* @param string $database_name The name of the database that will be deleted.
* @param null|resource $link_identifier The MySQL connection. If the
* link identifier is not specified, the last link opened by
* mysql_connect is assumed. If no such link is found, it
* will try to create one as if mysql_connect had been called
* with no arguments. If no connection is found or established, an
* E_WARNING level error is generated.
* @param string $database_name
* @param null|resource $link_identifier
* @throws MysqlException
*
*/
@@ -235,21 +139,8 @@ function mysql_drop_db(string $database_name, $link_identifier = null): void
/**
* Returns an array that corresponds to the lengths of each field
* in the last row fetched by MySQL.
*
* mysql_fetch_lengths stores the lengths of
* each result column in the last row returned by
* mysql_fetch_row,
* mysql_fetch_assoc,
* mysql_fetch_array, and
* mysql_fetch_object in an array, starting at
* offset 0.
*
* @param resource $result The result resource that
* is being evaluated. This result comes from a call to
* mysql_query.
* @return array An array of lengths on success.
* @param resource $result
* @return array
* @throws MysqlException
*
*/
@@ -265,27 +156,9 @@ function mysql_fetch_lengths($result): array
/**
* mysql_field_flags returns the field flags of
* the specified field. The flags are reported as a single word
* per flag separated by a single space, so that you can split the
* returned value using explode.
*
* @param resource $result The result resource that
* is being evaluated. This result comes from a call to
* mysql_query.
* @param int $field_offset The numerical field offset. The
* field_offset starts at 0. If
* field_offset does not exist, an error of level
* E_WARNING is also issued.
* @return string Returns a string of flags associated with the result.
*
* The following flags are reported, if your version of MySQL
* is current enough to support them: "not_null",
* "primary_key", "unique_key",
* "multiple_key", "blob",
* "unsigned", "zerofill",
* "binary", "enum",
* "auto_increment" and "timestamp".
* @param resource $result
* @param int $field_offset
* @return string
* @throws MysqlException
*
*/
@@ -301,17 +174,9 @@ function mysql_field_flags($result, int $field_offset): string
/**
* mysql_field_len returns the length of the
* specified field.
*
* @param resource $result The result resource that
* is being evaluated. This result comes from a call to
* mysql_query.
* @param int $field_offset The numerical field offset. The
* field_offset starts at 0. If
* field_offset does not exist, an error of level
* E_WARNING is also issued.
* @return int The length of the specified field index on success.
* @param resource $result
* @param int $field_offset
* @return int
* @throws MysqlException
*
*/
@@ -327,17 +192,9 @@ function mysql_field_len($result, int $field_offset): int
/**
* mysql_field_name returns the name of the
* specified field index.
*
* @param resource $result The result resource that
* is being evaluated. This result comes from a call to
* mysql_query.
* @param int $field_offset The numerical field offset. The
* field_offset starts at 0. If
* field_offset does not exist, an error of level
* E_WARNING is also issued.
* @return string The name of the specified field index on success.
* @param resource $result
* @param int $field_offset
* @return string
* @throws MysqlException
*
*/
@@ -353,18 +210,8 @@ function mysql_field_name($result, int $field_offset): string
/**
* Seeks to the specified field offset. If the next call to
* mysql_fetch_field doesn't include a field
* offset, the field offset specified in
* mysql_field_seek will be returned.
*
* @param resource $result The result resource that
* is being evaluated. This result comes from a call to
* mysql_query.
* @param int $field_offset The numerical field offset. The
* field_offset starts at 0. If
* field_offset does not exist, an error of level
* E_WARNING is also issued.
* @param resource $result
* @param int $field_offset
* @throws MysqlException
*
*/
@@ -379,17 +226,7 @@ function mysql_field_seek($result, int $field_offset): void
/**
* mysql_free_result will free all memory
* associated with the result identifier result.
*
* mysql_free_result only needs to be called if
* you are concerned about how much memory is being used for queries
* that return large result sets. All associated result memory is
* automatically freed at the end of the script's execution.
*
* @param resource $result The result resource that
* is being evaluated. This result comes from a call to
* mysql_query.
* @param resource $result
* @throws MysqlException
*
*/
@@ -404,17 +241,8 @@ function mysql_free_result($result): void
/**
* Describes the type of connection in use for the connection, including the
* server host name.
*
* @param null|resource $link_identifier The MySQL connection. If the
* link identifier is not specified, the last link opened by
* mysql_connect is assumed. If no such link is found, it
* will try to create one as if mysql_connect had been called
* with no arguments. If no connection is found or established, an
* E_WARNING level error is generated.
* @return string Returns a string describing the type of MySQL connection in use for the
* connection.
* @param null|resource $link_identifier
* @return string
* @throws MysqlException
*
*/
@@ -430,15 +258,8 @@ function mysql_get_host_info($link_identifier = null): string
/**
* Retrieves the MySQL protocol.
*
* @param null|resource $link_identifier The MySQL connection. If the
* link identifier is not specified, the last link opened by
* mysql_connect is assumed. If no such link is found, it
* will try to create one as if mysql_connect had been called
* with no arguments. If no connection is found or established, an
* E_WARNING level error is generated.
* @return int Returns the MySQL protocol on success.
* @param null|resource $link_identifier
* @return int
* @throws MysqlException
*
*/
@@ -454,15 +275,8 @@ function mysql_get_proto_info($link_identifier = null): int
/**
* Retrieves the MySQL server version.
*
* @param null|resource $link_identifier The MySQL connection. If the
* link identifier is not specified, the last link opened by
* mysql_connect is assumed. If no such link is found, it
* will try to create one as if mysql_connect had been called
* with no arguments. If no connection is found or established, an
* E_WARNING level error is generated.
* @return string Returns the MySQL server version on success.
* @param null|resource $link_identifier
* @return string
* @throws MysqlException
*
*/
@@ -478,17 +292,8 @@ function mysql_get_server_info($link_identifier = null): string
/**
* Returns detailed information about the last query.
*
* @param null|resource $link_identifier The MySQL connection. If the
* link identifier is not specified, the last link opened by
* mysql_connect is assumed. If no such link is found, it
* will try to create one as if mysql_connect had been called
* with no arguments. If no connection is found or established, an
* E_WARNING level error is generated.
* @return string Returns information about the statement on success. See the example below for which statements provide information,
* and what the returned value may look like. Statements that are not listed
* will return FALSE.
* @param null|resource $link_identifier
* @return string
* @throws MysqlException
*
*/
@@ -504,18 +309,8 @@ function mysql_info($link_identifier = null): string
/**
* Returns a result pointer containing the databases available from the
* current mysql daemon.
*
* @param null|resource $link_identifier The MySQL connection. If the
* link identifier is not specified, the last link opened by
* mysql_connect is assumed. If no such link is found, it
* will try to create one as if mysql_connect had been called
* with no arguments. If no connection is found or established, an
* E_WARNING level error is generated.
* @return resource Returns a result pointer resource on success. Use the mysql_tablename function to traverse
* this result pointer, or any function for result tables, such as
* mysql_fetch_array.
* @param null|resource $link_identifier
* @return resource
* @throws MysqlException
*
*/
@@ -531,26 +326,10 @@ function mysql_list_dbs($link_identifier = null)
/**
* Retrieves information about the given table name.
*
* This function is deprecated. It is preferable to use
* mysql_query to issue an SQL SHOW COLUMNS FROM
* table [LIKE 'name'] statement instead.
*
* @param string $database_name The name of the database that's being queried.
* @param string $table_name The name of the table that's being queried.
* @param null|resource $link_identifier The MySQL connection. If the
* link identifier is not specified, the last link opened by
* mysql_connect is assumed. If no such link is found, it
* will try to create one as if mysql_connect had been called
* with no arguments. If no connection is found or established, an
* E_WARNING level error is generated.
* @return resource A result pointer resource on success.
*
* The returned result can be used with mysql_field_flags,
* mysql_field_len,
* mysql_field_name and
* mysql_field_type.
* @param string $database_name
* @param string $table_name
* @param null|resource $link_identifier
* @return resource
* @throws MysqlException
*
*/
@@ -566,15 +345,8 @@ function mysql_list_fields(string $database_name, string $table_name, $link_iden
/**
* Retrieves the current MySQL server threads.
*
* @param null|resource $link_identifier The MySQL connection. If the
* link identifier is not specified, the last link opened by
* mysql_connect is assumed. If no such link is found, it
* will try to create one as if mysql_connect had been called
* with no arguments. If no connection is found or established, an
* E_WARNING level error is generated.
* @return resource A result pointer resource on success.
* @param null|resource $link_identifier
* @return resource
* @throws MysqlException
*
*/
@@ -590,24 +362,9 @@ function mysql_list_processes($link_identifier = null)
/**
* Retrieves a list of table names from a MySQL database.
*
* This function is deprecated. It is preferable to use
* mysql_query to issue an SQL SHOW TABLES
* [FROM db_name] [LIKE 'pattern'] statement instead.
*
* @param string $database The name of the database
* @param null|resource $link_identifier The MySQL connection. If the
* link identifier is not specified, the last link opened by
* mysql_connect is assumed. If no such link is found, it
* will try to create one as if mysql_connect had been called
* with no arguments. If no connection is found or established, an
* E_WARNING level error is generated.
* @return resource A result pointer resource on success.
*
* Use the mysql_tablename function to
* traverse this result pointer, or any function for result tables,
* such as mysql_fetch_array.
* @param string $database
* @param null|resource $link_identifier
* @return resource
* @throws MysqlException
*
*/
@@ -623,13 +380,8 @@ function mysql_list_tables(string $database, $link_identifier = null)
/**
* Retrieves the number of fields from a query.
*
* @param resource $result The result resource that
* is being evaluated. This result comes from a call to
* mysql_query.
* @return int Returns the number of fields in the result set resource on
* success.
* @param resource $result
* @return int
* @throws MysqlException
*
*/
@@ -645,15 +397,8 @@ function mysql_num_fields($result): int
/**
* Retrieves the number of rows from a result set. This command is only valid
* for statements like SELECT or SHOW that return an actual result set.
* To retrieve the number of rows affected by a INSERT, UPDATE, REPLACE or
* DELETE query, use mysql_affected_rows.
*
* @param resource $result The result resource that
* is being evaluated. This result comes from a call to
* mysql_query.
* @return int The number of rows in a result set on success.
* @param resource $result
* @return int
* @throws MysqlException
*
*/
@@ -669,41 +414,9 @@ function mysql_num_rows($result): int
/**
* mysql_query sends a unique query (multiple queries
* are not supported) to the currently
* active database on the server that's associated with the
* specified link_identifier.
*
* @param string $query An SQL query
*
* The query string should not end with a semicolon.
* Data inside the query should be properly escaped.
* @param null|resource $link_identifier The MySQL connection. If the
* link identifier is not specified, the last link opened by
* mysql_connect is assumed. If no such link is found, it
* will try to create one as if mysql_connect had been called
* with no arguments. If no connection is found or established, an
* E_WARNING level error is generated.
* @return bool|resource For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset,
* mysql_query
* returns a resource on success.
*
* For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc,
* mysql_query returns TRUE on success.
*
* The returned result resource should be passed to
* mysql_fetch_array, and other
* functions for dealing with result tables, to access the returned data.
*
* Use mysql_num_rows to find out how many rows
* were returned for a SELECT statement or
* mysql_affected_rows to find out how many
* rows were affected by a DELETE, INSERT, REPLACE, or UPDATE
* statement.
*
* mysql_query will also fail and return FALSE
* if the user does not have permission to access the table(s) referenced by
* the query.
* @param string $query
* @param null|resource $link_identifier
* @return bool|resource
* @throws MysqlException
*
*/
@@ -719,28 +432,9 @@ function mysql_query(string $query, $link_identifier = null)
/**
* Escapes special characters in the unescaped_string,
* taking into account the current character set of the connection so that it
* is safe to place it in a mysql_query. If binary data
* is to be inserted, this function must be used.
*
* mysql_real_escape_string calls MySQL's library function
* mysql_real_escape_string, which prepends backslashes to the following characters:
* \x00, \n,
* \r, \, ',
* " and \x1a.
*
* This function must always (with few exceptions) be used to make data
* safe before sending a query to MySQL.
*
* @param string $unescaped_string The string that is to be escaped.
* @param null|resource $link_identifier The MySQL connection. If the
* link identifier is not specified, the last link opened by
* mysql_connect is assumed. If no such link is found, it
* will try to create one as if mysql_connect had been called
* with no arguments. If no connection is found or established, an
* E_WARNING level error is generated.
* @return string Returns the escaped string.
* @param string $unescaped_string
* @param null|resource $link_identifier
* @return string
* @throws MysqlException
*
*/
@@ -756,28 +450,10 @@ function mysql_real_escape_string(string $unescaped_string, $link_identifier = n
/**
* Retrieves the contents of one cell from a MySQL result set.
*
* When working on large result sets, you should consider using one
* of the functions that fetch an entire row (specified below). As
* these functions return the contents of multiple cells in one
* function call, they're MUCH quicker than
* mysql_result. Also, note that specifying a
* numeric offset for the field argument is much quicker than
* specifying a fieldname or tablename.fieldname argument.
*
* @param resource $result The result resource that
* is being evaluated. This result comes from a call to
* mysql_query.
* @param int $row The row number from the result that's being retrieved. Row numbers
* start at 0.
* @param mixed $field The name or offset of the field being retrieved.
*
* It can be the field's offset, the field's name, or the field's table
* dot field name (tablename.fieldname). If the column name has been
* aliased ('select foo as bar from...'), use the alias instead of the
* column name. If undefined, the first field is retrieved.
* @return string The contents of one cell from a MySQL result set on success.
* @param resource $result
* @param int $row
* @param mixed $field
* @return string
* @throws MysqlException
*
*/
@@ -793,17 +469,8 @@ function mysql_result($result, int $row, $field = 0): string
/**
* Sets the current active database on the server that's associated with the
* specified link identifier. Every subsequent call to
* mysql_query will be made on the active database.
*
* @param string $database_name The name of the database that is to be selected.
* @param null|resource $link_identifier The MySQL connection. If the
* link identifier is not specified, the last link opened by
* mysql_connect is assumed. If no such link is found, it
* will try to create one as if mysql_connect had been called
* with no arguments. If no connection is found or established, an
* E_WARNING level error is generated.
* @param string $database_name
* @param null|resource $link_identifier
* @throws MysqlException
*
*/
@@ -818,15 +485,8 @@ function mysql_select_db(string $database_name, $link_identifier = null): void
/**
* Sets the default character set for the current connection.
*
* @param string $charset A valid character set name.
* @param null|resource $link_identifier The MySQL connection. If the
* link identifier is not specified, the last link opened by
* mysql_connect is assumed. If no such link is found, it
* will try to create one as if mysql_connect had been called
* with no arguments. If no connection is found or established, an
* E_WARNING level error is generated.
* @param string $charset
* @param null|resource $link_identifier
* @throws MysqlException
*
*/
@@ -841,20 +501,9 @@ function mysql_set_charset(string $charset, $link_identifier = null): void
/**
* Retrieves the table name from a result.
*
* This function is deprecated. It is preferable to use
* mysql_query to issue an SQL SHOW TABLES
* [FROM db_name] [LIKE 'pattern'] statement instead.
*
* @param resource $result A result pointer resource that's returned from
* mysql_list_tables.
* @param int $i The integer index (row/table number)
* @return string The name of the table on success.
*
* Use the mysql_tablename function to
* traverse this result pointer, or any function for result tables,
* such as mysql_fetch_array.
* @param resource $result
* @param int $i
* @return string
* @throws MysqlException
*
*/
@@ -870,17 +519,8 @@ function mysql_tablename($result, int $i): string
/**
* Retrieves the current thread ID. If the connection is lost, and a reconnect
* with mysql_ping is executed, the thread ID will
* change. This means only retrieve the thread ID when needed.
*
* @param null|resource $link_identifier The MySQL connection. If the
* link identifier is not specified, the last link opened by
* mysql_connect is assumed. If no such link is found, it
* will try to create one as if mysql_connect had been called
* with no arguments. If no connection is found or established, an
* E_WARNING level error is generated.
* @return int The thread ID on success.
* @param null|resource $link_identifier
* @return int
* @throws MysqlException
*
*/
@@ -896,34 +536,9 @@ function mysql_thread_id($link_identifier = null): int
/**
* mysql_unbuffered_query sends the SQL query
* query to MySQL without automatically
* fetching and buffering the result rows as
* mysql_query does. This saves a considerable
* amount of memory with SQL queries that produce large result sets,
* and you can start working on the result set immediately after the
* first row has been retrieved as you don't have to wait until the
* complete SQL query has been performed. To use
* mysql_unbuffered_query while multiple database
* connections are open, you must specify the optional parameter
* link_identifier to identify which connection
* you want to use.
*
* @param string $query The SQL query to execute.
*
* Data inside the query should be properly escaped.
* @param null|resource $link_identifier The MySQL connection. If the
* link identifier is not specified, the last link opened by
* mysql_connect is assumed. If no such link is found, it
* will try to create one as if mysql_connect had been called
* with no arguments. If no connection is found or established, an
* E_WARNING level error is generated.
* @return bool|resource For SELECT, SHOW, DESCRIBE or EXPLAIN statements,
* mysql_unbuffered_query
* returns a resource on success.
*
* For other type of SQL statements, UPDATE, DELETE, DROP, etc,
* mysql_unbuffered_query returns TRUE on success.
* @param string $query
* @param null|resource $link_identifier
* @return bool|resource
* @throws MysqlException
*
*/

View File

@@ -5,9 +5,7 @@
use Safe\Exceptions\MysqliException;
/**
* Returns client per-process statistics.
*
* @return array Returns an array with client stats if success.
* @return array
* @throws MysqliException
*
*/

View File

@@ -5,9 +5,6 @@
use Safe\Exceptions\NetworkException;
/**
* closelog closes the descriptor being used to write to
* the system logger. The use of closelog is optional.
*
* @throws NetworkException
*
*/
@@ -22,227 +19,12 @@ function closelog(): void
/**
* Fetch DNS Resource Records associated with the given
* hostname.
*
* @param string $hostname hostname should be a valid DNS hostname such
* as "www.example.com". Reverse lookups can be generated
* using in-addr.arpa notation, but
* gethostbyaddr is more suitable for
* the majority of reverse lookups.
*
* Per DNS standards, email addresses are given in user.host format (for
* example: hostmaster.example.com as opposed to hostmaster@example.com),
* be sure to check this value and modify if necessary before using it
* with a functions such as mail.
* @param int $type By default, dns_get_record will search for any
* resource records associated with hostname.
* To limit the query, specify the optional type
* parameter. May be any one of the following:
* DNS_A, DNS_CNAME,
* DNS_HINFO, DNS_CAA,
* DNS_MX, DNS_NS,
* DNS_PTR, DNS_SOA,
* DNS_TXT, DNS_AAAA,
* DNS_SRV, DNS_NAPTR,
* DNS_A6, DNS_ALL
* or DNS_ANY.
*
* Because of eccentricities in the performance of libresolv
* between platforms, DNS_ANY will not
* always return every record, the slower DNS_ALL
* will collect all records more reliably.
*
* Windows: DNS_CAA is not supported.
* Support for DNS_A6 is not implemented.
* @param array|null $authoritative_name_servers Passed by reference and, if given, will be populated with Resource
* Records for the Authoritative Name Servers.
* @param array|null $additional_records Passed by reference and, if given, will be populated with any
* Additional Records.
* @param bool $raw The type will be interpreted as a raw DNS type ID
* (the DNS_* constants cannot be used).
* The return value will contain a data key, which needs
* to be manually parsed.
* @return list This function returns an array of associative arrays. Each associative array contains
* at minimum the following keys:
*
* Basic DNS attributes
*
*
*
* Attribute
* Meaning
*
*
*
*
* host
*
* The record in the DNS namespace to which the rest of the associated data refers.
*
*
*
* class
*
* dns_get_record only returns Internet class records and as
* such this parameter will always return IN.
*
*
*
* type
*
* String containing the record type. Additional attributes will also be contained
* in the resulting array dependant on the value of type. See table below.
*
*
*
* ttl
*
* "Time To Live" remaining for this record. This will not equal
* the record's original ttl, but will rather equal the original ttl minus whatever
* length of time has passed since the authoritative name server was queried.
*
*
*
*
*
*
*
* Other keys in associative arrays dependant on 'type'
*
*
*
* Type
* Extra Columns
*
*
*
*
* A
*
* ip: An IPv4 addresses in dotted decimal notation.
*
*
*
* MX
*
* pri: Priority of mail exchanger.
* Lower numbers indicate greater priority.
* target: FQDN of the mail exchanger.
* See also dns_get_mx.
*
*
*
* CNAME
*
* target: FQDN of location in DNS namespace to which
* the record is aliased.
*
*
*
* NS
*
* target: FQDN of the name server which is authoritative
* for this hostname.
*
*
*
* PTR
*
* target: Location within the DNS namespace to which
* this record points.
*
*
*
* TXT
*
* txt: Arbitrary string data associated with this record.
*
*
*
* HINFO
*
* cpu: IANA number designating the CPU of the machine
* referenced by this record.
* os: IANA number designating the Operating System on
* the machine referenced by this record.
* See IANA's Operating System
* Names for the meaning of these values.
*
*
*
* CAA
*
* flags: A one-byte bitfield; currently only bit 0 is defined,
* meaning 'critical'; other bits are reserved and should be ignored.
* tag: The CAA tag name (alphanumeric ASCII string).
* value: The CAA tag value (binary string, may use subformats).
* For additional information see: RFC 6844
*
*
*
* SOA
*
* mname: FQDN of the machine from which the resource
* records originated.
* rname: Email address of the administrative contact
* for this domain.
* serial: Serial # of this revision of the requested
* domain.
* refresh: Refresh interval (seconds) secondary name
* servers should use when updating remote copies of this domain.
* retry: Length of time (seconds) to wait after a
* failed refresh before making a second attempt.
* expire: Maximum length of time (seconds) a secondary
* DNS server should retain remote copies of the zone data without a
* successful refresh before discarding.
* minimum-ttl: Minimum length of time (seconds) a
* client can continue to use a DNS resolution before it should request
* a new resolution from the server. Can be overridden by individual
* resource records.
*
*
*
* AAAA
*
* ipv6: IPv6 address
*
*
*
* A6
*
* masklen: Length (in bits) to inherit from the target
* specified by chain.
* ipv6: Address for this specific record to merge with
* chain.
* chain: Parent record to merge with
* ipv6 data.
*
*
*
* SRV
*
* pri: (Priority) lowest priorities should be used first.
* weight: Ranking to weight which of commonly prioritized
* targets should be chosen at random.
* target and port: hostname and port
* where the requested service can be found.
* For additional information see: RFC 2782
*
*
*
* NAPTR
*
* order and pref: Equivalent to
* pri and weight above.
* flags, services, regex,
* and replacement: Parameters as defined by
* RFC 2915.
*
*
*
*
*
* @param string $hostname
* @param int $type
* @param array|null $authoritative_name_servers
* @param array|null $additional_records
* @param bool $raw
* @return list
* @throws NetworkException
*
*/
@@ -258,51 +40,12 @@ function dns_get_record(string $hostname, int $type = DNS_ANY, ?array &$authorit
/**
* Initiates a socket connection to the resource specified by
* hostname.
*
* PHP supports targets in the Internet and Unix domains as described in
* . A list of supported transports can also be
* retrieved using stream_get_transports.
*
* The socket will by default be opened in blocking mode. You can
* switch it to non-blocking mode by using
* stream_set_blocking.
*
* The function stream_socket_client is similar but
* provides a richer set of options, including non-blocking connection and the
* ability to provide a stream context.
*
* @param string $hostname If OpenSSL support is
* installed, you may prefix the hostname
* with either ssl:// or tls:// to
* use an SSL or TLS client connection over TCP/IP to connect to the
* remote host.
* @param int $port The port number. This can be omitted and skipped with
* -1 for transports that do not use ports, such as
* unix://.
* @param int|null $error_code If provided, holds the system level error number that occurred in the
* system-level connect() call.
*
* If the value returned in error_code is
* 0 and the function returned FALSE, it is an
* indication that the error occurred before the
* connect() call. This is most likely due to a
* problem initializing the socket.
* @param null|string $error_message The error message as a string.
* @param float|null $timeout The connection timeout, in seconds. When NULL, the
* default_socket_timeout php.ini setting is used.
*
* If you need to set a timeout for reading/writing data over the
* socket, use stream_set_timeout, as the
* timeout parameter to
* fsockopen only applies while connecting the
* socket.
* @return resource fsockopen returns a file pointer which may be used
* together with the other file functions (such as
* fgets, fgetss,
* fwrite, fclose, and
* feof). If the call fails, it will return FALSE
* @param string $hostname
* @param int $port
* @param int|null $error_code
* @param null|string $error_message
* @param float|null $timeout
* @return resource
* @throws NetworkException
*
*/
@@ -322,11 +65,7 @@ function fsockopen(string $hostname, int $port = -1, ?int &$error_code = null, ?
/**
* gethostname gets the standard host name for
* the local machine.
*
* @return string Returns a string with the hostname on success, otherwise FALSE is
* returned.
* @return string
* @throws NetworkException
*
*/
@@ -342,12 +81,8 @@ function gethostname(): string
/**
* getprotobyname returns the protocol number
* associated with the protocol protocol as per
* /etc/protocols.
*
* @param string $protocol The protocol name.
* @return int Returns the protocol number.
* @param string $protocol
* @return int
* @throws NetworkException
*
*/
@@ -363,12 +98,8 @@ function getprotobyname(string $protocol): int
/**
* getprotobynumber returns the protocol name
* associated with protocol protocol as per
* /etc/protocols.
*
* @param int $protocol The protocol number.
* @return string Returns the protocol name as a string.
* @param int $protocol
* @return string
* @throws NetworkException
*
*/
@@ -384,14 +115,9 @@ function getprotobynumber(int $protocol): string
/**
* getservbyport returns the Internet service
* associated with port for the specified
* protocol as per /etc/services.
*
* @param int $port The port number.
* @param string $protocol protocol is either "tcp"
* or "udp" (in lowercase).
* @return string Returns the Internet service name as a string.
* @param int $port
* @param string $protocol
* @return string
* @throws NetworkException
*
*/
@@ -407,14 +133,7 @@ function getservbyport(int $port, string $protocol): string
/**
* Registers a function that will be called when PHP starts sending output.
*
* The callback is executed just after PHP prepares all
* headers to be sent, and before any other output is sent, creating a window
* to manipulate the outgoing headers before being sent.
*
* @param callable $callback Function called just before the headers are sent. It gets no parameters
* and the return value is ignored.
* @param callable $callback
* @throws NetworkException
*
*/
@@ -429,10 +148,8 @@ function header_register_callback(callable $callback): void
/**
*
*
* @param string $ip A 32bit IPv4, or 128bit IPv6 address.
* @return string Returns a string representation of the address.
* @param string $ip
* @return string
* @throws NetworkException
*
*/
@@ -448,15 +165,8 @@ function inet_ntop(string $ip): string
/**
* This function converts a human readable IPv4 or IPv6 address (if PHP
* was built with IPv6 support enabled) into an address family appropriate
* 32bit or 128bit binary structure.
*
* @param string $ip A human readable IPv4 or IPv6 address.
* @return string Returns the in_addr representation of the given
* ip, or FALSE if a syntactically invalid
* ip is given (for example, an IPv4 address
* without dots or an IPv6 address without colons).
* @param string $ip
* @return string
* @throws NetworkException
*
*/
@@ -472,12 +182,8 @@ function inet_pton(string $ip): string
/**
* The function long2ip generates an Internet address
* in dotted format (i.e.: aaa.bbb.ccc.ddd) from the long integer
* representation.
*
* @param int $ip A proper address representation in long integer.
* @return string Returns the Internet IP address as a string.
* @param int $ip
* @return string
* @throws NetworkException
*
*/
@@ -493,134 +199,9 @@ function long2ip(int $ip): string
/**
* openlog opens a connection to the system
* logger for a program.
*
* The use of openlog is optional. It
* will automatically be called by syslog if
* necessary, in which case prefix will default
* to FALSE.
*
* @param string $prefix The string prefix is added to each message.
* @param int $flags The flags argument is used to indicate
* what logging options will be used when generating a log message.
*
* openlog Options
*
*
*
* Constant
* Description
*
*
*
*
* LOG_CONS
*
* if there is an error while sending data to the system logger,
* write directly to the system console
*
*
*
* LOG_NDELAY
*
* open the connection to the logger immediately
*
*
*
* LOG_ODELAY
*
* (default) delay opening the connection until the first
* message is logged
*
*
*
* LOG_PERROR
* print log message also to standard error
*
*
* LOG_PID
* include PID with each message
*
*
*
*
* You can use one or more of these options. When using multiple options
* you need to OR them, i.e. to open the connection
* immediately, write to the console and include the PID in each message,
* you will use: LOG_CONS | LOG_NDELAY | LOG_PID
* @param int $facility The facility argument is used to specify what
* type of program is logging the message. This allows you to specify
* (in your machine's syslog configuration) how messages coming from
* different facilities will be handled.
*
* openlog Facilities
*
*
*
* Constant
* Description
*
*
*
*
* LOG_AUTH
*
* security/authorization messages (use
* LOG_AUTHPRIV instead
* in systems where that constant is defined)
*
*
*
* LOG_AUTHPRIV
* security/authorization messages (private)
*
*
* LOG_CRON
* clock daemon (cron and at)
*
*
* LOG_DAEMON
* other system daemons
*
*
* LOG_KERN
* kernel messages
*
*
* LOG_LOCAL0 ... LOG_LOCAL7
* reserved for local use, these are not available in Windows
*
*
* LOG_LPR
* line printer subsystem
*
*
* LOG_MAIL
* mail subsystem
*
*
* LOG_NEWS
* USENET news subsystem
*
*
* LOG_SYSLOG
* messages generated internally by syslogd
*
*
* LOG_USER
* generic user-level messages
*
*
* LOG_UUCP
* UUCP subsystem
*
*
*
*
*
* LOG_USER is the only valid log type under Windows
* operating systems
* @param string $prefix
* @param int $flags
* @param int $facility
* @throws NetworkException
*
*/
@@ -635,20 +216,12 @@ function openlog(string $prefix, int $flags, int $facility): void
/**
* This function behaves exactly as fsockopen with the
* difference that the connection is not closed after the script finishes.
* It is the persistent version of fsockopen.
*
* @param string $hostname
* @param int $port
* @param int|null $error_code
* @param null|string $error_message
* @param float|null $timeout
* @return resource pfsockopen returns a file pointer which may be used
* together with the other file functions (such as
* fgets, fgetss,
* fwrite, fclose, and
* feof).
* @return resource
* @throws NetworkException
*
*/
@@ -668,64 +241,8 @@ function pfsockopen(string $hostname, int $port = -1, ?int &$error_code = null,
/**
* syslog generates a log message that will be
* distributed by the system logger.
*
* For information on setting up a user defined log handler, see the
* syslog.conf
* 5 Unix manual page. More
* information on the syslog facilities and option can be found in the man
* pages for syslog
* 3 on Unix machines.
*
* @param int $priority priority is a combination of the facility and
* the level. Possible values are:
*
* syslog Priorities (in descending order)
*
*
*
* Constant
* Description
*
*
*
*
* LOG_EMERG
* system is unusable
*
*
* LOG_ALERT
* action must be taken immediately
*
*
* LOG_CRIT
* critical conditions
*
*
* LOG_ERR
* error conditions
*
*
* LOG_WARNING
* warning conditions
*
*
* LOG_NOTICE
* normal, but significant, condition
*
*
* LOG_INFO
* informational message
*
*
* LOG_DEBUG
* debug-level message
*
*
*
*
* @param string $message The message to send.
* @param int $priority
* @param string $message
* @throws NetworkException
*
*/

File diff suppressed because it is too large Load Diff

View File

@@ -5,11 +5,7 @@
use Safe\Exceptions\OpcacheException;
/**
* This function compiles a PHP script and adds it to the opcode cache without
* executing it. This can be used to prime the cache after a Web server
* restart by pre-caching files that will be included in later requests.
*
* @param string $filename The path to the PHP script to be compiled.
* @param string $filename
* @throws OpcacheException
*
*/
@@ -24,11 +20,8 @@ function opcache_compile_file(string $filename): void
/**
* This function returns state information about the in-memory cache instance. It will not return any
* information about the file cache.
*
* @param bool $include_scripts Include script specific state information
* @return array Returns an array of information, optionally containing script specific state information.
* @param bool $include_scripts
* @return array
* @throws OpcacheException
*
*/

File diff suppressed because it is too large Load Diff

View File

@@ -5,15 +5,6 @@
use Safe\Exceptions\OutcontrolException;
/**
* This function discards the contents of the output buffer.
*
* This function does not destroy the output buffer like
* ob_end_clean does.
*
* The output buffer must be started by
* ob_start with PHP_OUTPUT_HANDLER_CLEANABLE
* flag. Otherwise ob_clean will not work.
*
* @throws OutcontrolException
*
*/
@@ -28,17 +19,6 @@ function ob_clean(): void
/**
* This function discards the contents of the topmost output buffer and turns
* off this output buffering. If you want to further process the buffer's
* contents you have to call ob_get_contents before
* ob_end_clean as the buffer contents are discarded
* when ob_end_clean is called.
*
* The output buffer must be started by
* ob_start with PHP_OUTPUT_HANDLER_CLEANABLE
* and PHP_OUTPUT_HANDLER_REMOVABLE
* flags. Otherwise ob_end_clean will not work.
*
* @throws OutcontrolException
*
*/
@@ -53,18 +33,6 @@ function ob_end_clean(): void
/**
* This function will send the contents of the topmost output buffer (if
* any) and turn this output buffer off. If you want to further
* process the buffer's contents you have to call
* ob_get_contents before
* ob_end_flush as the buffer contents are
* discarded after ob_end_flush is called.
*
* The output buffer must be started by
* ob_start with PHP_OUTPUT_HANDLER_FLUSHABLE
* and PHP_OUTPUT_HANDLER_REMOVABLE
* flags. Otherwise ob_end_flush will not work.
*
* @throws OutcontrolException
*
*/
@@ -79,15 +47,6 @@ function ob_end_flush(): void
/**
* This function will send the contents of the output buffer (if any). If you
* want to further process the buffer's contents you have to call
* ob_get_contents before ob_flush
* as the buffer contents are discarded after ob_flush
* is called.
*
* This function does not destroy the output buffer like
* ob_end_flush does.
*
* @throws OutcontrolException
*
*/
@@ -102,19 +61,7 @@ function ob_flush(): void
/**
* Gets the current buffer contents and delete current output buffer.
*
* ob_get_clean essentially executes both
* ob_get_contents and
* ob_end_clean.
*
* The output buffer must be started by
* ob_start with PHP_OUTPUT_HANDLER_CLEANABLE
* and PHP_OUTPUT_HANDLER_REMOVABLE
* flags. Otherwise ob_get_clean will not work.
*
* @return string Returns the contents of the output buffer and end output buffering.
* If output buffering isn't active then FALSE is returned.
* @return string
* @throws OutcontrolException
*
*/
@@ -130,87 +77,7 @@ function ob_get_clean(): string
/**
* This function will turn output buffering on. While output buffering is
* active no output is sent from the script (other than headers), instead the
* output is stored in an internal buffer.
*
* The contents of this internal buffer may be copied into a string variable
* using ob_get_contents. To output what is stored in
* the internal buffer, use ob_end_flush. Alternatively,
* ob_end_clean will silently discard the buffer
* contents.
*
* Output buffers are stackable, that is, you may call
* ob_start while another
* ob_start is active. Just make
* sure that you call ob_end_flush
* the appropriate number of times. If multiple output callback
* functions are active, output is being filtered sequentially
* through each of them in nesting order.
*
* If output buffering is still active when the script ends, PHP outputs the
* contents automatically.
*
* @param array|callable|null|string $callback An optional callback function may be
* specified. This function takes a string as a parameter and should
* return a string. The function will be called when
* the output buffer is flushed (sent) or cleaned (with
* ob_flush, ob_clean or similar
* function) or when the output buffer
* is flushed to the browser at the end of the request. When
* callback is called, it will receive the
* contents of the output buffer as its parameter and is expected to
* return a new output buffer as a result, which will be sent to the
* browser. If the callback is not a
* callable function, this function will return FALSE.
* This is the callback signature:
*
*
* stringhandler
* stringbuffer
* intphase
*
*
*
* buffer
*
*
* Contents of the output buffer.
*
*
*
*
* phase
*
*
* Bitmask of PHP_OUTPUT_HANDLER_* constants.
*
*
*
*
*
* If callback returns FALSE original
* input is sent to the browser.
*
* The callback parameter may be bypassed
* by passing a NULL value.
*
* ob_end_clean, ob_end_flush,
* ob_clean, ob_flush and
* ob_start may not be called from a callback
* function. If you call them from callback function, the behavior is
* undefined. If you would like to delete the contents of a buffer,
* return "" (a null string) from callback function.
* You can't even call functions using the output buffering functions like
* print_r($expression, true) or
* highlight_file($filename, true) from a callback
* function.
*
* ob_gzhandler function exists to
* facilitate sending gz-encoded data to web browsers that support
* compressed web pages. ob_gzhandler determines
* what type of content encoding the browser will accept and will return
* its output accordingly.
* @param array|callable|null|string $callback
* @param int $chunk_size
* @param int $flags
* @throws OutcontrolException
@@ -235,19 +102,8 @@ function ob_start($callback = null, int $chunk_size = 0, int $flags = PHP_OUTPUT
/**
* This function adds another name/value pair to the URL rewrite mechanism.
* The name and value will be added to URLs (as GET parameter) and forms
* (as hidden input fields) the same way as the session ID when transparent
* URL rewriting is enabled with session.use_trans_sid.
*
* This function's behaviour is controlled by the url_rewriter.tags and
* url_rewriter.hosts php.ini
* parameters.
*
* Note that this function can be successfully called at most once per request.
*
* @param string $name The variable name.
* @param string $value The variable value.
* @param string $name
* @param string $value
* @throws OutcontrolException
*
*/
@@ -262,10 +118,6 @@ function output_add_rewrite_var(string $name, string $value): void
/**
* This function resets the URL rewriter and removes all rewrite
* variables previously set by the output_add_rewrite_var
* function.
*
* @throws OutcontrolException
*
*/

View File

@@ -5,16 +5,9 @@
use Safe\Exceptions\PcntlException;
/**
* pcntl_getpriority gets the priority of
* process_id. Because priority levels can differ between
* system types and kernel versions, please see your system's getpriority(2)
* man page for specific details.
*
* @param int|null $process_id If NULL, the process id of the current process is used.
* @param int $mode One of PRIO_PGRP, PRIO_USER
* or PRIO_PROCESS.
* @return int pcntl_getpriority returns the priority of the process. A lower numerical value causes more favorable
* scheduling.
* @param int|null $process_id
* @param int $mode
* @return int
* @throws PcntlException
*
*/
@@ -36,18 +29,9 @@ function pcntl_getpriority(?int $process_id = null, int $mode = PRIO_PROCESS): i
/**
* pcntl_setpriority sets the priority of
* process_id.
*
* @param int $priority priority is generally a value in the range
* -20 to 20. The default priority
* is 0 while a lower numerical value causes more
* favorable scheduling. Because priority levels can differ between
* system types and kernel versions, please see your system's setpriority(2)
* man page for specific details.
* @param int|null $process_id If NULL, the process id of the current process is used.
* @param int $mode One of PRIO_PGRP, PRIO_USER
* or PRIO_PROCESS.
* @param int $priority
* @param int|null $process_id
* @param int $mode
* @throws PcntlException
*
*/
@@ -68,10 +52,6 @@ function pcntl_setpriority(int $priority, ?int $process_id = null, int $mode = P
/**
* The pcntl_signal_dispatch function calls the signal
* handlers installed by pcntl_signal for each pending
* signal.
*
* @throws PcntlException
*
*/
@@ -86,46 +66,8 @@ function pcntl_signal_dispatch(): void
/**
* The pcntl_signal function installs a new
* signal handler or replaces the current signal handler for the signal indicated by signal.
*
* @param int $signal The signal number.
* @param callable|int $handler The signal handler. This may be either a callable, which
* will be invoked to handle the signal, or either of the two global
* constants SIG_IGN or SIG_DFL,
* which will ignore the signal or restore the default signal handler
* respectively.
*
* If a callable is given, it must implement the following
* signature:
*
*
* voidhandler
* intsigno
* mixedsiginfo
*
*
*
* signal
*
*
* The signal being handled.
*
*
*
*
* siginfo
*
*
* If operating systems supports siginfo_t structures, this will be an array of signal information dependent on the signal.
*
*
*
*
*
* Note that when you set a handler to an object method, that object's
* reference count is increased which makes it persist until you either
* change the handler to something else, or your script ends.
* @param int $signal
* @param callable|int $handler
* @param bool $restart_syscalls
* @throws PcntlException
*
@@ -141,22 +83,9 @@ function pcntl_signal(int $signal, $handler, bool $restart_syscalls = true): voi
/**
* The pcntl_sigprocmask function adds, removes or sets blocked
* signals, depending on the mode parameter.
*
* @param int $mode Sets the behavior of pcntl_sigprocmask. Possible
* values:
*
* SIG_BLOCK: Add the signals to the
* currently blocked signals.
* SIG_UNBLOCK: Remove the signals from the
* currently blocked signals.
* SIG_SETMASK: Replace the currently
* blocked signals by the given list of signals.
*
* @param array $signals List of signals.
* @param array|null $old_signals The old_signals parameter is set to an array
* containing the list of the previously blocked signals.
* @param int $mode
* @param array $signals
* @param array|null $old_signals
* @throws PcntlException
*
*/
@@ -171,19 +100,11 @@ function pcntl_sigprocmask(int $mode, array $signals, ?array &$old_signals = nul
/**
* The pcntl_sigtimedwait function operates in exactly
* the same way as pcntl_sigwaitinfo except that it takes
* two additional parameters, seconds and
* nanoseconds, which enable an upper bound to be placed
* on the time for which the script is suspended.
*
* @param array $signals Array of signals to wait for.
* @param array|null $info The info is set to an array containing
* information about the signal. See
* pcntl_sigwaitinfo.
* @param int $seconds Timeout in seconds.
* @param int $nanoseconds Timeout in nanoseconds.
* @return int pcntl_sigtimedwait returns a signal number on success.
* @param array $signals
* @param array|null $info
* @param int $seconds
* @param int $nanoseconds
* @return int
* @throws PcntlException
*
*/
@@ -199,46 +120,9 @@ function pcntl_sigtimedwait(array $signals, ?array &$info = [], int $seconds = 0
/**
* The pcntl_sigwaitinfo function suspends execution of the
* calling script until one of the signals given in signals
* are delivered. If one of the signal is already pending (e.g. blocked by
* pcntl_sigprocmask),
* pcntl_sigwaitinfo will return immediately.
*
* @param array $signals Array of signals to wait for.
* @param array|null $info The info parameter is set to an array containing
* information about the signal.
*
* The following elements are set for all signals:
*
* signo: Signal number
* errno: An error number
* code: Signal code
*
*
* The following elements may be set for the SIGCHLD signal:
*
* status: Exit value or signal
* utime: User time consumed
* stime: System time consumed
* pid: Sending process ID
* uid: Real user ID of sending process
*
*
* The following elements may be set for the SIGILL,
* SIGFPE, SIGSEGV and
* SIGBUS signals:
*
* addr: Memory location which caused fault
*
*
* The following element may be set for the SIGPOLL
* signal:
*
* band: Band event
* fd: File descriptor number
*
* @return int Returns a signal number on success.
* @param array $signals
* @param array|null $info
* @return int
* @throws PcntlException
*
*/

View File

@@ -5,17 +5,10 @@
use Safe\Exceptions\PcreException;
/**
* Returns the array consisting of the elements of the
* array array that match the given
* pattern.
*
* @param string $pattern The pattern to search for, as a string.
* @param array $array The input array.
* @param int $flags If set to PREG_GREP_INVERT, this function returns
* the elements of the input array that do not match
* the given pattern.
* @return array Returns an array indexed using the keys from the
* array array.
* @param string $pattern
* @param array $array
* @param int $flags
* @return array
* @throws PcreException
*
*/
@@ -31,345 +24,12 @@ function preg_grep(string $pattern, array $array, int $flags = 0): array
/**
* Searches subject for all matches to the regular
* expression given in pattern and puts them in
* matches in the order specified by
* flags.
*
* After the first match is found, the subsequent searches are continued
* on from end of the last match.
*
* @param string $pattern The pattern to search for, as a string.
* @param string $subject The input string.
* @param array|null $matches Array of all matches in multi-dimensional array ordered according to
* flags.
* @param int $flags Can be a combination of the following flags (note that it doesn't make
* sense to use PREG_PATTERN_ORDER together with
* PREG_SET_ORDER):
*
*
* PREG_PATTERN_ORDER
*
*
* Orders results so that $matches[0] is an array of full
* pattern matches, $matches[1] is an array of strings matched by
* the first parenthesized subpattern, and so on.
*
*
*
*
*
* ]]>
*
* The above example will output:
*
* example: , this is a test
* example: , this is a test
* ]]>
*
*
* So, $out[0] contains array of strings that matched full pattern,
* and $out[1] contains array of strings enclosed by tags.
*
*
*
*
* If the pattern contains named subpatterns, $matches
* additionally contains entries for keys with the subpattern name.
*
*
* If the pattern contains duplicate named subpatterns, only the rightmost
* subpattern is stored in $matches[NAME].
*
*
*
* ]]>
*
* The above example will output:
*
*
* [1] => bar
* )
* ]]>
*
*
*
*
*
*
* PREG_SET_ORDER
*
*
* Orders results so that $matches[0] is an array of first set
* of matches, $matches[1] is an array of second set of matches,
* and so on.
*
*
*
* ]]>
*
* The above example will output:
*
* example: , example:
* this is a test, this is a test
* ]]>
*
*
*
*
*
*
* PREG_OFFSET_CAPTURE
*
*
* If this flag is passed, for every occurring match the appendant string
* offset (in bytes) will also be returned. Note that this changes the value of
* matches into an array of arrays where every element is an
* array consisting of the matched string at offset 0
* and its string offset into subject at offset
* 1.
*
*
*
* ]]>
*
* The above example will output:
*
* Array
* (
* [0] => Array
* (
* [0] => foobarbaz
* [1] => 0
* )
*
* )
*
* [1] => Array
* (
* [0] => Array
* (
* [0] => foo
* [1] => 0
* )
*
* )
*
* [2] => Array
* (
* [0] => Array
* (
* [0] => bar
* [1] => 3
* )
*
* )
*
* [3] => Array
* (
* [0] => Array
* (
* [0] => baz
* [1] => 6
* )
*
* )
*
* )
* ]]>
*
*
*
*
*
*
* PREG_UNMATCHED_AS_NULL
*
*
* If this flag is passed, unmatched subpatterns are reported as NULL;
* otherwise they are reported as an empty string.
*
*
*
*
*
* Orders results so that $matches[0] is an array of full
* pattern matches, $matches[1] is an array of strings matched by
* the first parenthesized subpattern, and so on.
*
*
*
*
* ]]>
*
* The above example will output:
*
* example: , this is a test
* example: , this is a test
* ]]>
*
*
* So, $out[0] contains array of strings that matched full pattern,
* and $out[1] contains array of strings enclosed by tags.
*
*
*
* The above example will output:
*
* So, $out[0] contains array of strings that matched full pattern,
* and $out[1] contains array of strings enclosed by tags.
*
* If the pattern contains named subpatterns, $matches
* additionally contains entries for keys with the subpattern name.
*
* If the pattern contains duplicate named subpatterns, only the rightmost
* subpattern is stored in $matches[NAME].
*
*
*
* ]]>
*
* The above example will output:
*
*
* [1] => bar
* )
* ]]>
*
*
*
* The above example will output:
*
* Orders results so that $matches[0] is an array of first set
* of matches, $matches[1] is an array of second set of matches,
* and so on.
*
*
*
* ]]>
*
* The above example will output:
*
* example: , example:
* this is a test, this is a test
* ]]>
*
*
*
* The above example will output:
*
* If this flag is passed, for every occurring match the appendant string
* offset (in bytes) will also be returned. Note that this changes the value of
* matches into an array of arrays where every element is an
* array consisting of the matched string at offset 0
* and its string offset into subject at offset
* 1.
*
*
*
* ]]>
*
* The above example will output:
*
* Array
* (
* [0] => Array
* (
* [0] => foobarbaz
* [1] => 0
* )
*
* )
*
* [1] => Array
* (
* [0] => Array
* (
* [0] => foo
* [1] => 0
* )
*
* )
*
* [2] => Array
* (
* [0] => Array
* (
* [0] => bar
* [1] => 3
* )
*
* )
*
* [3] => Array
* (
* [0] => Array
* (
* [0] => baz
* [1] => 6
* )
*
* )
*
* )
* ]]>
*
*
*
* The above example will output:
*
* If this flag is passed, unmatched subpatterns are reported as NULL;
* otherwise they are reported as an empty string.
*
* If no order flag is given, PREG_PATTERN_ORDER is
* assumed.
* @param int $offset Orders results so that $matches[0] is an array of full
* pattern matches, $matches[1] is an array of strings matched by
* the first parenthesized subpattern, and so on.
*
*
*
*
* ]]>
*
* The above example will output:
*
* example: , this is a test
* example: , this is a test
* ]]>
*
*
* So, $out[0] contains array of strings that matched full pattern,
* and $out[1] contains array of strings enclosed by tags.
*
*
*
* The above example will output:
*
* So, $out[0] contains array of strings that matched full pattern,
* and $out[1] contains array of strings enclosed by tags.
*
* If the pattern contains named subpatterns, $matches
* additionally contains entries for keys with the subpattern name.
*
* If the pattern contains duplicate named subpatterns, only the rightmost
* subpattern is stored in $matches[NAME].
*
*
*
* ]]>
*
* The above example will output:
*
*
* [1] => bar
* )
* ]]>
*
*
*
* The above example will output:
* @return 0|positive-int Returns the number of full pattern matches (which might be zero).
* @param string $pattern
* @param string $subject
* @param array|null $matches
* @param int $flags
* @param int $offset
* @return 0|positive-int
* @throws PcreException
*
*/
@@ -385,228 +45,12 @@ function preg_match_all(string $pattern, string $subject, ?array &$matches = nul
/**
* Searches subject for a match to the regular
* expression given in pattern.
*
* @param string $pattern The pattern to search for, as a string.
* @param string $subject The input string.
* @param null|string[] $matches If matches is provided, then it is filled with
* the results of search. $matches[0] will contain the
* text that matched the full pattern, $matches[1]
* will have the text that matched the first captured parenthesized
* subpattern, and so on.
* @param int $flags flags can be a combination of the following flags:
*
*
* PREG_OFFSET_CAPTURE
*
*
* If this flag is passed, for every occurring match the appendant string
* offset (in bytes) will also be returned. Note that this changes the value of
* matches into an array where every element is an
* array consisting of the matched string at offset 0
* and its string offset into subject at offset
* 1.
*
*
*
* ]]>
*
* The above example will output:
*
* Array
* (
* [0] => foobarbaz
* [1] => 0
* )
*
* [1] => Array
* (
* [0] => foo
* [1] => 0
* )
*
* [2] => Array
* (
* [0] => bar
* [1] => 3
* )
*
* [3] => Array
* (
* [0] => baz
* [1] => 6
* )
*
* )
* ]]>
*
*
*
*
*
*
* PREG_UNMATCHED_AS_NULL
*
*
* If this flag is passed, unmatched subpatterns are reported as NULL;
* otherwise they are reported as an empty string.
*
*
*
* ]]>
*
* The above example will output:
*
*
* string(2) "ac"
* [1]=>
* string(1) "a"
* [2]=>
* string(0) ""
* [3]=>
* string(1) "c"
* }
* array(4) {
* [0]=>
* string(2) "ac"
* [1]=>
* string(1) "a"
* [2]=>
* NULL
* [3]=>
* string(1) "c"
* }
* ]]>
*
*
*
*
*
*
*
* If this flag is passed, for every occurring match the appendant string
* offset (in bytes) will also be returned. Note that this changes the value of
* matches into an array where every element is an
* array consisting of the matched string at offset 0
* and its string offset into subject at offset
* 1.
*
*
*
* ]]>
*
* The above example will output:
*
* Array
* (
* [0] => foobarbaz
* [1] => 0
* )
*
* [1] => Array
* (
* [0] => foo
* [1] => 0
* )
*
* [2] => Array
* (
* [0] => bar
* [1] => 3
* )
*
* [3] => Array
* (
* [0] => baz
* [1] => 6
* )
*
* )
* ]]>
*
*
*
* The above example will output:
*
* If this flag is passed, unmatched subpatterns are reported as NULL;
* otherwise they are reported as an empty string.
*
*
*
* ]]>
*
* The above example will output:
*
*
* string(2) "ac"
* [1]=>
* string(1) "a"
* [2]=>
* string(0) ""
* [3]=>
* string(1) "c"
* }
* array(4) {
* [0]=>
* string(2) "ac"
* [1]=>
* string(1) "a"
* [2]=>
* NULL
* [3]=>
* string(1) "c"
* }
* ]]>
*
*
*
* The above example will output:
* @param int $offset If this flag is passed, for every occurring match the appendant string
* offset (in bytes) will also be returned. Note that this changes the value of
* matches into an array where every element is an
* array consisting of the matched string at offset 0
* and its string offset into subject at offset
* 1.
*
*
*
* ]]>
*
* The above example will output:
*
* Array
* (
* [0] => foobarbaz
* [1] => 0
* )
*
* [1] => Array
* (
* [0] => foo
* [1] => 0
* )
*
* [2] => Array
* (
* [0] => bar
* [1] => 3
* )
*
* [3] => Array
* (
* [0] => baz
* [1] => 6
* )
*
* )
* ]]>
*
*
*
* The above example will output:
* @return 0|1 preg_match returns 1 if the pattern
* matches given subject, 0 if it does not.
* @param string $pattern
* @param string $subject
* @param null|string[] $matches
* @param int $flags
* @param int $offset
* @return 0|1
* @throws PcreException
*
*/
@@ -622,28 +66,12 @@ function preg_match(string $pattern, string $subject, ?array &$matches = null, i
/**
* The behavior of this function is similar to
* preg_replace_callback, except that callbacks are
* executed on a per-pattern basis.
*
* @param array $pattern An associative array mapping patterns (keys) to callables (values).
* @param array|string $subject The string or an array with strings to search and replace.
* @param int $limit The maximum possible replacements for each pattern in each
* subject string. Defaults to
* -1 (no limit).
* @param int|null $count If specified, this variable will be filled with the number of
* replacements done.
* @param int $flags flags can be a combination of the
* PREG_OFFSET_CAPTURE and
* PREG_UNMATCHED_AS_NULL flags, which influence the
* format of the matches array.
* See the description in preg_match for more details.
* @return array|string preg_replace_callback_array returns an array if the
* subject parameter is an array, or a string
* otherwise. On errors the return value is NULL
*
* If matches are found, the new subject will be returned, otherwise
* subject will be returned unchanged.
* @param array $pattern
* @param array|string $subject
* @param int $limit
* @param int|null $count
* @param int $flags
* @return array|string
* @throws PcreException
*
*/
@@ -659,57 +87,13 @@ function preg_replace_callback_array(array $pattern, $subject, int $limit = -1,
/**
* The behavior of this function is almost identical to
* preg_replace, except for the fact that instead of
* replacement parameter, one should specify a
* callback.
*
* @param array|string $pattern The pattern to search for. It can be either a string or an array with
* strings.
* @param callable(array):string $callback A callback that will be called and passed an array of matched elements
* in the subject string. The callback should
* return the replacement string. This is the callback signature:
*
*
* stringhandler
* arraymatches
*
*
* You'll often need the callback function
* for a preg_replace_callback in just one place.
* In this case you can use an
* anonymous function to
* declare the callback within the call to
* preg_replace_callback. By doing it this way
* you have all information for the call in one place and do not
* clutter the function namespace with a callback function's name
* not used anywhere else.
*
*
* preg_replace_callback and
* anonymous function
*
*
* ]]>
*
*
* @param array|string $subject The string or an array with strings to search and replace.
* @param int $limit The maximum possible replacements for each pattern in each
* subject string. Defaults to
* -1 (no limit).
* @param int|null $count If specified, this variable will be filled with the number of
* replacements done.
* @param int $flags flags can be a combination of the
* PREG_OFFSET_CAPTURE and
* PREG_UNMATCHED_AS_NULL flags, which influence the
* format of the matches array.
* See the description in preg_match for more details.
* @return array|string preg_replace_callback returns an array if the
* subject parameter is an array, or a string
* otherwise. On errors the return value is NULL
*
* If matches are found, the new subject will be returned, otherwise
* subject will be returned unchanged.
* @param array|string $pattern
* @param callable(array):string $callback
* @param array|string $subject
* @param int $limit
* @param int|null $count
* @param int $flags
* @return array|string
* @throws PcreException
*
*/
@@ -725,55 +109,11 @@ function preg_replace_callback($pattern, callable $callback, $subject, int $limi
/**
* Split the given string by a regular expression.
*
* @param string $pattern The pattern to search for, as a string.
* @param string $subject The input string.
* @param int|null $limit If specified, then only substrings up to limit
* are returned with the rest of the string being placed in the last
* substring. A limit of -1 or 0 means "no limit".
* @param int $flags flags can be any combination of the following
* flags (combined with the | bitwise operator):
*
*
* PREG_SPLIT_NO_EMPTY
*
*
* If this flag is set, only non-empty pieces will be returned by
* preg_split.
*
*
*
*
* PREG_SPLIT_DELIM_CAPTURE
*
*
* If this flag is set, parenthesized expression in the delimiter pattern
* will be captured and returned as well.
*
*
*
*
* PREG_SPLIT_OFFSET_CAPTURE
*
*
* If this flag is set, for every occurring match the appendant string
* offset will also be returned. Note that this changes the return
* value in an array where every element is an array consisting of the
* matched string at offset 0 and its string offset
* into subject at offset 1.
*
*
*
*
*
* If this flag is set, for every occurring match the appendant string
* offset will also be returned. Note that this changes the return
* value in an array where every element is an array consisting of the
* matched string at offset 0 and its string offset
* into subject at offset 1.
* @return list Returns an array containing substrings of subject
* split along boundaries matched by pattern.
* @param string $pattern
* @param string $subject
* @param int|null $limit
* @param int $flags
* @return list
* @throws PcreException
*
*/

File diff suppressed because it is too large Load Diff

View File

@@ -5,18 +5,8 @@
use Safe\Exceptions\PosixException;
/**
* posix_access checks the user's permission of a file.
*
* @param string $filename The name of the file to be tested.
* @param int $flags A mask consisting of one or more of POSIX_F_OK,
* POSIX_R_OK, POSIX_W_OK and
* POSIX_X_OK.
*
* POSIX_R_OK, POSIX_W_OK and
* POSIX_X_OK request checking whether the file
* exists and has read, write and execute permissions, respectively.
* POSIX_F_OK just requests checking for the
* existence of the file.
* @param string $filename
* @param int $flags
* @throws PosixException
*
*/
@@ -31,55 +21,8 @@ function posix_access(string $filename, int $flags = 0): void
/**
* Gets information about a group provided its id.
*
* @param int $group_id The group id.
* @return array{name: string, passwd: string, gid: int, members: list} The array elements returned are:
*
* The group information array
*
*
*
* Element
* Description
*
*
*
*
* name
*
* The name element contains the name of the group. This is
* a short, usually less than 16 character "handle" of the
* group, not the real, full name.
*
*
*
* passwd
*
* The passwd element contains the group's password in an
* encrypted format. Often, for example on a system employing
* "shadow" passwords, an asterisk is returned instead.
*
*
*
* gid
*
* Group ID, should be the same as the
* group_id parameter used when calling the
* function, and hence redundant.
*
*
*
* members
*
* This consists of an array of
* string's for all the members in the group.
*
*
*
*
*
* The function returns FALSE on failure.
* @param int $group_id
* @return array{name: string, passwd: string, gid: int, members: list}
* @throws PosixException
*
*/
@@ -95,55 +38,8 @@ function posix_getgrgid(int $group_id): array
/**
* Gets information about a group provided its name.
*
* @param string $name The name of the group
* @return array{name: string, passwd: string, gid: int, members: list} Returns an array on success.
* The array elements returned are:
*
* The group information array
*
*
*
* Element
* Description
*
*
*
*
* name
*
* The name element contains the name of the group. This is
* a short, usually less than 16 character "handle" of the
* group, not the real, full name. This should be the same as
* the name parameter used when
* calling the function, and hence redundant.
*
*
*
* passwd
*
* The passwd element contains the group's password in an
* encrypted format. Often, for example on a system employing
* "shadow" passwords, an asterisk is returned instead.
*
*
*
* gid
*
* Group ID of the group in numeric form.
*
*
*
* members
*
* This consists of an array of
* string's for all the members in the group.
*
*
*
*
*
* @param string $name
* @return array{name: string, passwd: string, gid: int, members: list}
* @throws PosixException
*
*/
@@ -159,10 +55,7 @@ function posix_getgrnam(string $name): array
/**
* Gets the group set of the current process.
*
* @return list Returns an array of integers containing the numeric group ids of the group
* set of the current process.
* @return list
* @throws PosixException
*
*/
@@ -178,9 +71,7 @@ function posix_getgroups(): array
/**
* Returns the login name of the user owning the current process.
*
* @return string Returns the login name of the user, as a string.
* @return string
* @throws PosixException
*
*/
@@ -196,83 +87,8 @@ function posix_getlogin(): string
/**
* Returns an array of information about the user
* referenced by the given user ID.
*
* @param int $user_id The user identifier.
* @return array{name: string, passwd: string, uid: int, gid: int, gecos: string, dir: string, shell: string} Returns an associative array with the following elements:
*
* The user information array
*
*
*
* Element
* Description
*
*
*
*
* name
*
* The name element contains the username of the user. This is
* a short, usually less than 16 character "handle" of the
* user, not the real, full name.
*
*
*
* passwd
*
* The passwd element contains the user's password in an
* encrypted format. Often, for example on a system employing
* "shadow" passwords, an asterisk is returned instead.
*
*
*
* uid
*
* User ID, should be the same as the
* user_id parameter used when calling the
* function, and hence redundant.
*
*
*
* gid
*
* The group ID of the user. Use the function
* posix_getgrgid to resolve the group
* name and a list of its members.
*
*
*
* gecos
*
* GECOS is an obsolete term that refers to the finger
* information field on a Honeywell batch processing system.
* The field, however, lives on, and its contents have been
* formalized by POSIX. The field contains a comma separated
* list containing the user's full name, office phone, office
* number, and home phone number. On most systems, only the
* user's full name is available.
*
*
*
* dir
*
* This element contains the absolute path to the
* home directory of the user.
*
*
*
* shell
*
* The shell element contains the absolute path to the
* executable of the user's default shell.
*
*
*
*
*
* The function returns FALSE on failure.
* @param int $user_id
* @return array{name: string, passwd: string, uid: int, gid: int, gecos: string, dir: string, shell: string}
* @throws PosixException
*
*/
@@ -288,101 +104,7 @@ function posix_getpwuid(int $user_id): array
/**
* posix_getrlimit returns an array
* of information about the current resource's soft and hard limits.
*
*
* Each resource has an associated soft and hard limit. The soft
* limit is the value that the kernel enforces for the corresponding
* resource. The hard limit acts as a ceiling for the soft limit.
* An unprivileged process may only set its soft limit to a value
* from 0 to the hard limit, and irreversibly lower its hard limit.
*
* @return array Returns an associative array of elements for each
* limit that is defined. Each limit has a soft and a hard limit.
*
* List of possible limits returned
*
*
*
* Limit name
* Limit description
*
*
*
*
* core
*
* The maximum size of the core file. When 0, not core files are
* created. When core files are larger than this size, they will
* be truncated at this size.
*
*
*
* totalmem
*
* The maximum size of the memory of the process, in bytes.
*
*
*
* virtualmem
*
* The maximum size of the virtual memory for the process, in bytes.
*
*
*
* data
*
* The maximum size of the data segment for the process, in bytes.
*
*
*
* stack
*
* The maximum size of the process stack, in bytes.
*
*
*
* rss
*
* The maximum number of virtual pages resident in RAM
*
*
*
* maxproc
*
* The maximum number of processes that can be created for the
* real user ID of the calling process.
*
*
*
* memlock
*
* The maximum number of bytes of memory that may be locked into RAM.
*
*
*
* cpu
*
* The amount of time the process is allowed to use the CPU.
*
*
*
* filesize
*
* The maximum size of the data segment for the process, in bytes.
*
*
*
* openfiles
*
* One more than the maximum number of open file descriptors.
*
*
*
*
*
* The function returns FALSE on failure.
* @return array
* @throws PosixException
*
*/
@@ -398,14 +120,8 @@ function posix_getrlimit(): array
/**
* Return the session id of the process process_id.
* The session id of a process is the process group id of the session leader.
*
* @param int $process_id The process identifier. If set to 0, the current process is
* assumed. If an invalid process_id is
* specified, then FALSE is returned and an error is set which
* can be checked with posix_get_last_error.
* @return int Returns the identifier, as an int.
* @param int $process_id
* @return int
* @throws PosixException
*
*/
@@ -421,10 +137,8 @@ function posix_getsid(int $process_id): int
/**
* Calculates the group access list for the user specified in name.
*
* @param string $username The user to calculate the list for.
* @param int $group_id Typically the group number from the password file.
* @param string $username
* @param int $group_id
* @throws PosixException
*
*/
@@ -439,11 +153,8 @@ function posix_initgroups(string $username, int $group_id): void
/**
* Send the signal signal to the process with
* the process identifier process_id.
*
* @param int $process_id The process identifier.
* @param int $signal One of the PCNTL signals constants.
* @param int $process_id
* @param int $signal
* @throws PosixException
*
*/
@@ -458,16 +169,8 @@ function posix_kill(int $process_id, int $signal): void
/**
* posix_mkfifo creates a special
* FIFO file which exists in the file system and acts as
* a bidirectional communication endpoint for processes.
*
* @param string $filename Path to the FIFO file.
* @param int $permissions The second parameter permissions has to be given in
* octal notation (e.g. 0644). The permission of the newly created
* FIFO also depends on the setting of the current
* umask. The permissions of the created file are
* (mode & ~umask).
* @param string $filename
* @param int $permissions
* @throws PosixException
*
*/
@@ -482,17 +185,10 @@ function posix_mkfifo(string $filename, int $permissions): void
/**
* Creates a special or ordinary file.
*
* @param string $filename The file to create
* @param int $flags This parameter is constructed by a bitwise OR between file type (one of
* the following constants: POSIX_S_IFREG,
* POSIX_S_IFCHR, POSIX_S_IFBLK,
* POSIX_S_IFIFO or
* POSIX_S_IFSOCK) and permissions.
* @param int $major The major device kernel identifier (required to pass when using
* S_IFCHR or S_IFBLK).
* @param int $minor The minor device kernel identifier.
* @param string $filename
* @param int $flags
* @param int $major
* @param int $minor
* @throws PosixException
*
*/
@@ -507,11 +203,7 @@ function posix_mknod(string $filename, int $flags, int $major = 0, int $minor =
/**
* Set the effective group ID of the current process. This is a
* privileged function and needs appropriate privileges (usually
* root) on the system to be able to perform this function.
*
* @param int $group_id The group id.
* @param int $group_id
* @throws PosixException
*
*/
@@ -526,11 +218,7 @@ function posix_setegid(int $group_id): void
/**
* Set the effective user ID of the current process. This is a privileged
* function and needs appropriate privileges (usually root) on
* the system to be able to perform this function.
*
* @param int $user_id The user id.
* @param int $user_id
* @throws PosixException
*
*/
@@ -545,14 +233,7 @@ function posix_seteuid(int $user_id): void
/**
* Set the real group ID of the current process. This is a
* privileged function and needs appropriate privileges (usually
* root) on the system to be able to perform this function. The
* appropriate order of function calls is
* posix_setgid first,
* posix_setuid last.
*
* @param int $group_id The group id.
* @param int $group_id
* @throws PosixException
*
*/
@@ -567,11 +248,8 @@ function posix_setgid(int $group_id): void
/**
* Let the process process_id join the process group
* process_group_id.
*
* @param int $process_id The process id.
* @param int $process_group_id The process group id.
* @param int $process_id
* @param int $process_group_id
* @throws PosixException
*
*/
@@ -586,23 +264,9 @@ function posix_setpgid(int $process_id, int $process_group_id): void
/**
* posix_setrlimit sets the soft and hard limits for a
* given system resource.
*
*
* Each resource has an associated soft and hard limit. The soft
* limit is the value that the kernel enforces for the corresponding
* resource. The hard limit acts as a ceiling for the soft limit.
* An unprivileged process may only set its soft limit to a value
* from 0 to the hard limit, and irreversibly lower its hard limit.
*
* @param int $resource The
* resource limit constant
* corresponding to the limit that is being set.
* @param int $soft_limit The soft limit, in whatever unit the resource limit requires, or
* POSIX_RLIMIT_INFINITY.
* @param int $hard_limit The hard limit, in whatever unit the resource limit requires, or
* POSIX_RLIMIT_INFINITY.
* @param int $resource
* @param int $soft_limit
* @param int $hard_limit
* @throws PosixException
*
*/
@@ -617,9 +281,7 @@ function posix_setrlimit(int $resource, int $soft_limit, int $hard_limit): void
/**
* Make the current process a session leader.
*
* @return int Returns the session ids.
* @return int
* @throws PosixException
*
*/
@@ -635,11 +297,7 @@ function posix_setsid(): int
/**
* Set the real user ID of the current process. This is a privileged
* function that needs appropriate privileges (usually root) on
* the system to be able to perform this function.
*
* @param int $user_id The user id.
* @param int $user_id
* @throws PosixException
*
*/
@@ -654,39 +312,7 @@ function posix_setuid(int $user_id): void
/**
* Gets information about the current CPU usage.
*
* @return array Returns a hash of strings with information about the current
* process CPU usage. The indices of the hash are:
*
*
*
* ticks - the number of clock ticks that have elapsed since
* reboot.
*
*
*
*
* utime - user time used by the current process.
*
*
*
*
* stime - system time used by the current process.
*
*
*
*
* cutime - user time used by current process and children.
*
*
*
*
* cstime - system time used by current process and children.
*
*
*
* The function returns FALSE on failure.
* @return array
* @throws PosixException
*
*/
@@ -702,41 +328,7 @@ function posix_times(): array
/**
* Gets information about the system.
*
* Posix requires that assumptions must not be made about the
* format of the values, e.g. the assumption that a release may contain
* three digits or anything else returned by this function.
*
* @return array Returns a hash of strings with information about the
* system. The indices of the hash are
*
*
* sysname - operating system name (e.g. Linux)
*
*
* nodename - system name (e.g. valiant)
*
*
* release - operating system release (e.g. 2.2.10)
*
*
* version - operating system version (e.g. #4 Tue Jul 20
* 17:01:36 MEST 1999)
*
*
* machine - system architecture (e.g. i586)
*
*
* domainname - DNS domainname (e.g. example.com)
*
*
*
* domainname is a GNU extension and not part of POSIX.1, so this
* field is only available on GNU systems or when using the GNU
* libc.
*
* The function returns FALSE on failure.
* @return array
* @throws PosixException
*
*/

File diff suppressed because it is too large Load Diff

View File

@@ -5,10 +5,8 @@
use Safe\Exceptions\PspellException;
/**
*
*
* @param int $dictionary An PSpell\Dictionary instance.
* @param string $word The added word.
* @param int $dictionary
* @param string $word
* @throws PspellException
*
*/
@@ -23,10 +21,8 @@ function pspell_add_to_personal(int $dictionary, string $word): void
/**
*
*
* @param int $dictionary An PSpell\Dictionary instance.
* @param string $word The added word.
* @param int $dictionary
* @param string $word
* @throws PspellException
*
*/
@@ -41,9 +37,7 @@ function pspell_add_to_session(int $dictionary, string $word): void
/**
*
*
* @param int $dictionary An PSpell\Dictionary instance.
* @param int $dictionary
* @throws PspellException
*
*/
@@ -58,35 +52,11 @@ function pspell_clear_session(int $dictionary): void
/**
* Create a config used to open a dictionary.
*
* pspell_config_create has a very similar syntax to
* pspell_new. In fact, using
* pspell_config_create immediately followed by
* pspell_new_config will produce the exact same result.
* However, after creating a new config, you can also use
* pspell_config_* functions before calling
* pspell_new_config to take advantage of some
* advanced functionality.
*
* For more information and examples, check out inline manual pspell
* website:http://aspell.net/.
*
* @param string $language The language parameter is the language code which consists of the
* two letter ISO 639 language code and an optional two letter ISO
* 3166 country code after a dash or underscore.
* @param string $spelling The spelling parameter is the requested spelling for languages
* with more than one spelling such as English. Known values are
* 'american', 'british', and 'canadian'.
* @param string $jargon The jargon parameter contains extra information to distinguish
* two different words lists that have the same language and
* spelling parameters.
* @param string $encoding The encoding parameter is the encoding that words are expected to
* be in. Valid values are 'utf-8', 'iso8859-*', 'koi8-r',
* 'viscii', 'cp1252', 'machine unsigned 16', 'machine unsigned
* 32'. This parameter is largely untested, so be careful when
* using.
* @return int Returns an PSpell\Config instance on success.
* @param string $language
* @param string $spelling
* @param string $jargon
* @param string $encoding
* @return int
* @throws PspellException
*
*/
@@ -102,10 +72,6 @@ function pspell_config_create(string $language, string $spelling = "", string $j
/**
* This function is
* currently not documented; only its argument list is available.
*
*
* @param int $config
* @param string $directory
* @throws PspellException
@@ -122,10 +88,6 @@ function pspell_config_data_dir(int $config, string $directory): void
/**
* This function is
* currently not documented; only its argument list is available.
*
*
* @param int $config
* @param string $directory
* @throws PspellException
@@ -142,10 +104,8 @@ function pspell_config_dict_dir(int $config, string $directory): void
/**
*
*
* @param int $config An PSpell\Config instance.
* @param int $min_length Words less than min_length characters will be skipped.
* @param int $config
* @param int $min_length
* @throws PspellException
*
*/
@@ -160,30 +120,8 @@ function pspell_config_ignore(int $config, int $min_length): void
/**
*
*
* @param int $config An PSpell\Config instance.
* @param int $mode The mode parameter is the mode in which spellchecker will work.
* There are several modes available:
*
*
*
* PSPELL_FAST - Fast mode (least number of
* suggestions)
*
*
*
*
* PSPELL_NORMAL - Normal mode (more suggestions)
*
*
*
*
* PSPELL_BAD_SPELLERS - Slow mode (a lot of
* suggestions)
*
*
*
* @param int $config
* @param int $mode
* @throws PspellException
*
*/
@@ -198,17 +136,8 @@ function pspell_config_mode(int $config, int $mode): void
/**
* Set a file that contains personal wordlist. The personal wordlist will be
* loaded and used in addition to the standard one after you call
* pspell_new_config. The file is also the file where
* pspell_save_wordlist will save personal wordlist to.
*
* pspell_config_personal should be used on a config
* before calling pspell_new_config.
*
* @param int $config An PSpell\Config instance.
* @param string $filename The personal wordlist. If the file does not exist, it will be created.
* The file should be writable by whoever PHP runs as (e.g. nobody).
* @param int $config
* @param string $filename
* @throws PspellException
*
*/
@@ -223,19 +152,8 @@ function pspell_config_personal(int $config, string $filename): void
/**
* Set a file that contains replacement pairs.
*
* The replacement pairs improve the quality of the spellchecker. When a word
* is misspelled, and a proper suggestion was not found in the list,
* pspell_store_replacement can be used to store a
* replacement pair and then pspell_save_wordlist to
* save the wordlist along with the replacement pairs.
*
* pspell_config_repl should be used on a config
* before calling pspell_new_config.
*
* @param int $config An PSpell\Config instance.
* @param string $filename The file should be writable by whoever PHP runs as (e.g. nobody).
* @param int $config
* @param string $filename
* @throws PspellException
*
*/
@@ -250,18 +168,8 @@ function pspell_config_repl(int $config, string $filename): void
/**
* This function determines whether run-together words will be treated as
* legal compounds. That is, "thecat" will be a legal compound, although
* there should be a space between the two words. Changing this setting only
* affects the results returned by pspell_check;
* pspell_suggest will still return suggestions.
*
* pspell_config_runtogether should be used on a config
* before calling pspell_new_config.
*
* @param int $config An PSpell\Config instance.
* @param bool $allow TRUE if run-together words should be treated as legal compounds,
* FALSE otherwise.
* @param int $config
* @param bool $allow
* @throws PspellException
*
*/
@@ -276,19 +184,8 @@ function pspell_config_runtogether(int $config, bool $allow): void
/**
* pspell_config_save_repl determines whether
* pspell_save_wordlist will save the replacement pairs
* along with the wordlist. Usually there is no need to use this function
* because if pspell_config_repl is used, the
* replacement pairs will be saved by
* pspell_save_wordlist anyway, and if it is not,
* the replacement pairs will not be saved.
*
* pspell_config_save_repl should be used on a config
* before calling pspell_new_config.
*
* @param int $config An PSpell\Config instance.
* @param bool $save TRUE if replacement pairs should be saved, FALSE otherwise.
* @param int $config
* @param bool $save
* @throws PspellException
*
*/
@@ -303,11 +200,8 @@ function pspell_config_save_repl(int $config, bool $save): void
/**
*
*
* @param int $config The config parameter is the one returned by
* pspell_config_create when the config was created.
* @return int Returns an PSpell\Dictionary instance on success
* @param int $config
* @return int
* @throws PspellException
*
*/
@@ -323,61 +217,13 @@ function pspell_new_config(int $config): int
/**
* For more information and examples, check out inline manual pspell
* website:http://aspell.net/.
*
* @param string $filename The file where words added to the personal list will be stored.
* It should be an absolute filename beginning with '/' because otherwise
* it will be relative to $HOME, which is "/root" for most systems, and
* is probably not what you want.
* @param string $language The language code which consists of the two letter ISO 639 language
* code and an optional two letter ISO 3166 country code after a dash
* or underscore.
* @param string $spelling The requested spelling for languages with more than one spelling such
* as English. Known values are 'american', 'british', and 'canadian'.
* @param string $jargon Extra information to distinguish two different words lists that have
* the same language and spelling parameters.
* @param string $encoding The encoding that words are expected to be in. Valid values are
* utf-8, iso8859-*,
* koi8-r, viscii,
* cp1252, machine unsigned 16,
* machine unsigned 32.
* @param int $mode The mode in which spellchecker will work. There are several modes available:
*
*
*
* PSPELL_FAST - Fast mode (least number of
* suggestions)
*
*
*
*
* PSPELL_NORMAL - Normal mode (more suggestions)
*
*
*
*
* PSPELL_BAD_SPELLERS - Slow mode (a lot of
* suggestions)
*
*
*
*
* PSPELL_RUN_TOGETHER - Consider run-together words
* as legal compounds. That is, "thecat" will be a legal compound,
* although there should be a space between the two words. Changing this
* setting only affects the results returned by
* pspell_check; pspell_suggest
* will still return suggestions.
*
*
*
* Mode is a bitmask constructed from different constants listed above.
* However, PSPELL_FAST,
* PSPELL_NORMAL and
* PSPELL_BAD_SPELLERS are mutually exclusive, so you
* should select only one of them.
* @return int Returns an PSpell\Dictionary instance on success.
* @param string $filename
* @param string $language
* @param string $spelling
* @param string $jargon
* @param string $encoding
* @param int $mode
* @return int
* @throws PspellException
*
*/
@@ -393,64 +239,12 @@ function pspell_new_personal(string $filename, string $language, string $spellin
/**
* pspell_new opens up a new dictionary and
* returns an PSpell\Dictionary instance for use in other pspell
* functions.
*
* For more information and examples, check out inline manual pspell
* website:http://aspell.net/.
*
* @param string $language The language parameter is the language code which consists of the
* two letter ISO 639 language code and an optional two letter ISO
* 3166 country code after a dash or underscore.
* @param string $spelling The spelling parameter is the requested spelling for languages
* with more than one spelling such as English. Known values are
* 'american', 'british', and 'canadian'.
* @param string $jargon The jargon parameter contains extra information to distinguish
* two different words lists that have the same language and
* spelling parameters.
* @param string $encoding The encoding parameter is the encoding that words are expected to
* be in. Valid values are 'utf-8', 'iso8859-*', 'koi8-r',
* 'viscii', 'cp1252', 'machine unsigned 16', 'machine unsigned
* 32'. This parameter is largely untested, so be careful when
* using.
* @param int $mode The mode parameter is the mode in which spellchecker will work.
* There are several modes available:
*
*
*
* PSPELL_FAST - Fast mode (least number of
* suggestions)
*
*
*
*
* PSPELL_NORMAL - Normal mode (more suggestions)
*
*
*
*
* PSPELL_BAD_SPELLERS - Slow mode (a lot of
* suggestions)
*
*
*
*
* PSPELL_RUN_TOGETHER - Consider run-together words
* as legal compounds. That is, "thecat" will be a legal compound,
* although there should be a space between the two words. Changing this
* setting only affects the results returned by
* pspell_check; pspell_suggest
* will still return suggestions.
*
*
*
* Mode is a bitmask constructed from different constants listed above.
* However, PSPELL_FAST,
* PSPELL_NORMAL and
* PSPELL_BAD_SPELLERS are mutually exclusive, so you
* should select only one of them.
* @return int Returns an PSpell\Dictionary instance on success.
* @param string $language
* @param string $spelling
* @param string $jargon
* @param string $encoding
* @param int $mode
* @return int
* @throws PspellException
*
*/
@@ -466,9 +260,7 @@ function pspell_new(string $language, string $spelling = "", string $jargon = ""
/**
*
*
* @param int $dictionary An PSpell\Dictionary instance.
* @param int $dictionary
* @throws PspellException
*
*/
@@ -483,11 +275,9 @@ function pspell_save_wordlist(int $dictionary): void
/**
*
*
* @param int $dictionary An PSpell\Dictionary instance.
* @param string $misspelled The misspelled word.
* @param string $correct The fixed spelling for the misspelled word.
* @param int $dictionary
* @param string $misspelled
* @param string $correct
* @throws PspellException
*
*/

View File

@@ -5,9 +5,7 @@
use Safe\Exceptions\ReadlineException;
/**
* This function adds a line to the command line history.
*
* @param string $prompt The line to be added in the history.
* @param string $prompt
* @throws ReadlineException
*
*/
@@ -22,19 +20,8 @@ function readline_add_history(string $prompt): void
/**
* Sets up a readline callback interface then prints
* prompt and immediately returns.
* Calling this function twice without removing the previous
* callback interface will automatically and conveniently overwrite the old
* interface.
*
* The callback feature is useful when combined with
* stream_select as it allows interleaving of IO and
* user input, unlike readline.
*
* @param string $prompt The prompt message.
* @param callable $callback The callback function takes one parameter; the
* user input returned.
* @param string $prompt
* @param callable $callback
* @throws ReadlineException
*
*/
@@ -49,8 +36,6 @@ function readline_callback_handler_install(string $prompt, callable $callback):
/**
* This function clears the entire command line history.
*
* @throws ReadlineException
*
*/
@@ -65,11 +50,7 @@ function readline_clear_history(): void
/**
* This function registers a completion function. This is the same kind of
* functionality you'd get if you hit your tab key while using Bash.
*
* @param callable $callback You must supply the name of an existing function which accepts a
* partial command line and returns an array of possible matches.
* @param callable $callback
* @throws ReadlineException
*
*/
@@ -84,9 +65,7 @@ function readline_completion_function(callable $callback): void
/**
* This function reads a command history from a file.
*
* @param null|string $filename Path to the filename containing the command history.
* @param null|string $filename
* @throws ReadlineException
*
*/
@@ -105,9 +84,7 @@ function readline_read_history(?string $filename = null): void
/**
* This function writes the command history to a file.
*
* @param null|string $filename Path to the saved file.
* @param null|string $filename
* @throws ReadlineException
*
*/

View File

@@ -221,6 +221,7 @@
'ftp_pasv' => 'Safe\ftp_pasv',
'ftp_put' => 'Safe\ftp_put',
'ftp_pwd' => 'Safe\ftp_pwd',
'ftp_raw' => 'Safe\ftp_raw',
'ftp_rename' => 'Safe\ftp_rename',
'ftp_rmdir' => 'Safe\ftp_rmdir',
'ftp_site' => 'Safe\ftp_site',
@@ -272,6 +273,8 @@
'gztell' => 'Safe\gztell',
'gzuncompress' => 'Safe\gzuncompress',
'gzwrite' => 'Safe\gzwrite',
'hash_file' => 'Safe\hash_file',
'hash_hmac_file' => 'Safe\hash_hmac_file',
'hash_update_file' => 'Safe\hash_update_file',
'header_register_callback' => 'Safe\header_register_callback',
'hex2bin' => 'Safe\hex2bin',
@@ -692,6 +695,7 @@
'parse_ini_file' => 'Safe\parse_ini_file',
'parse_ini_string' => 'Safe\parse_ini_string',
'parse_url' => 'Safe\parse_url',
'passthru' => 'Safe\passthru',
'pclose' => 'Safe\pclose',
'pcntl_getpriority' => 'Safe\pcntl_getpriority',
'pcntl_setpriority' => 'Safe\pcntl_setpriority',
@@ -1056,6 +1060,7 @@
'unixtojd' => 'Safe\unixtojd',
'unlink' => 'Safe\unlink',
'unpack' => 'Safe\unpack',
'unserialize' => 'Safe\unserialize',
'uopz_extend' => 'Safe\uopz_extend',
'uopz_implement' => 'Safe\uopz_implement',
'variant_date_to_timestamp' => 'Safe\variant_date_to_timestamp',

View File

@@ -5,9 +5,7 @@
use Safe\Exceptions\RpminfoException;
/**
* Add an additional retrieved tag in subsequent queries.
*
* @param int $tag One of RPMTAG_* constant, see the rpminfo constants page.
* @param int $tag
* @throws RpminfoException
*
*/

View File

@@ -5,11 +5,8 @@
use Safe\Exceptions\RrdException;
/**
* Creates the rdd database file.
*
* @param string $filename Filename for newly created rrd file.
* @param array $options Options for rrd create - list of strings. See man page of rrd create
* for whole list of options.
* @param string $filename
* @param array $options
* @throws RrdException
*
*/
@@ -24,11 +21,9 @@ function rrd_create(string $filename, array $options): void
/**
* Returns the first data sample from the specified RRA of the RRD file.
*
* @param string $file RRD database file name.
* @param int $raaindex The index number of the RRA that is to be examined. Default value is 0.
* @return int Integer number of unix timestamp.
* @param string $file
* @param int $raaindex
* @return int
* @throws RrdException
*
*/
@@ -44,15 +39,9 @@ function rrd_first(string $file, int $raaindex = 0): int
/**
* Creates image for a particular data from RRD file.
*
* @param string $filename The filename to output the graph to. This will generally end in either
* .png, .svg or
* .eps, depending on the format you want to output.
* @param array $options Options for generating image. See man page of rrd graph for all
* possible options. All options (data definitions, variable definitions, etc.)
* are allowed.
* @return array Array with information about generated image is returned.
* @param string $filename
* @param array $options
* @return array
* @throws RrdException
*
*/
@@ -68,10 +57,8 @@ function rrd_graph(string $filename, array $options): array
/**
* Returns information about particular RRD database file.
*
* @param string $filename RRD database file name.
* @return array Array with information about requested RRD file.
* @param string $filename
* @return array
* @throws RrdException
*
*/
@@ -87,11 +74,8 @@ function rrd_info(string $filename): array
/**
* Gets array of the UNIX timestamp and the values stored for each date in the
* most recent update of the RRD database file.
*
* @param string $filename RRD database file name.
* @return array Array of information about last update.
* @param string $filename
* @return array
* @throws RrdException
*
*/
@@ -107,11 +91,9 @@ function rrd_lastupdate(string $filename): array
/**
* Restores the RRD file from the XML dump.
*
* @param string $xml_file XML filename with the dump of the original RRD database file.
* @param string $rrd_file Restored RRD database file name.
* @param array $options Array of options for restoring. See man page for rrd restore.
* @param string $xml_file
* @param string $rrd_file
* @param array $options
* @throws RrdException
*
*/
@@ -130,12 +112,8 @@ function rrd_restore(string $xml_file, string $rrd_file, ?array $options = null)
/**
* Change some options in the RRD dabase header file. E.g. renames the source for
* the data etc.
*
* @param string $filename RRD database file name.
* @param array $options Options with RRD database file properties which will be changed. See
* rrd tune man page for details.
* @param string $filename
* @param array $options
* @throws RrdException
*
*/
@@ -150,12 +128,8 @@ function rrd_tune(string $filename, array $options): void
/**
* Updates the RRD database file. The input data is time interpolated according to the
* properties of the RRD database file.
*
* @param string $filename RRD database file name. This database will be updated.
* @param array $options Options for updating the RRD database. This is list of strings. See man page of rrd update
* for whole list of options.
* @param string $filename
* @param array $options
* @throws RrdException
*
*/
@@ -170,12 +144,8 @@ function rrd_update(string $filename, array $options): void
/**
* Exports the information about RRD database file. This data can be converted
* to XML file via user space PHP script and then restored back as RRD database
* file.
*
* @param array $options Array of options for the export, see rrd xport man page.
* @return array Array with information about RRD database file.
* @param array $options
* @return array
* @throws RrdException
*
*/

View File

@@ -5,19 +5,9 @@
use Safe\Exceptions\SemException;
/**
* msg_get_queue returns an id that can be used to
* access the System V message queue with the given
* key. The first call creates the message queue with
* the optional permissions.
* A second call to msg_get_queue for the same
* key will return a different message queue
* identifier, but both identifiers access the same underlying message
* queue.
*
* @param int $key Message queue numeric ID
* @param int $permissions Queue permissions. Default to 0666. If the message queue already
* exists, the permissions will be ignored.
* @return \SysvMessageQueue Returns SysvMessageQueue instance that can be used to access the System V message queue.
* @param int $key
* @param int $permissions
* @return \SysvMessageQueue
* @throws SemException
*
*/
@@ -33,9 +23,7 @@ function msg_get_queue(int $key, int $permissions = 0666): \SysvMessageQueue
/**
* Checks whether the message queue key exists.
*
* @param int $key Queue key.
* @param int $key
* @throws SemException
*
*/
@@ -50,73 +38,14 @@ function msg_queue_exists(int $key): void
/**
* msg_receive will receive the first message from the
* specified queue of the type specified by
* desired_message_type.
*
* @param \SysvMessageQueue $queue The message queue.
* @param int $desired_message_type If desired_message_type is 0, the message from the front
* of the queue is returned. If desired_message_type is
* greater than 0, then the first message of that type is returned.
* If desired_message_type is less than 0, the first
* message on the queue with a type less than or equal to the
* absolute value of desired_message_type will be read.
* If no messages match the criteria, your script will wait until a suitable
* message arrives on the queue. You can prevent the script from blocking
* by specifying MSG_IPC_NOWAIT in the
* flags parameter.
* @param int|null $received_message_type The type of the message that was received will be stored in this
* parameter.
* @param int $max_message_size The maximum size of message to be accepted is specified by the
* max_message_size; if the message in the queue is larger
* than this size the function will fail (unless you set
* flags as described below).
* @param mixed $message The received message will be stored in message,
* unless there were errors receiving the message.
* @param bool $unserialize If set to
* TRUE, the message is treated as though it was serialized using the
* same mechanism as the session module. The message will be unserialized
* and then returned to your script. This allows you to easily receive
* arrays or complex object structures from other PHP scripts, or if you
* are using the WDDX serializer, from any WDDX compatible source.
*
* If unserialize is FALSE, the message will be
* returned as a binary-safe string.
* @param int $flags The optional flags allows you to pass flags to the
* low-level msgrcv system call. It defaults to 0, but you may specify one
* or more of the following values (by adding or ORing them together).
*
* Flag values for msg_receive
*
*
*
* MSG_IPC_NOWAIT
* If there are no messages of the
* desired_message_type, return immediately and do not
* wait. The function will fail and return an integer value
* corresponding to MSG_ENOMSG.
*
*
*
* MSG_EXCEPT
* Using this flag in combination with a
* desired_message_type greater than 0 will cause the
* function to receive the first message that is not equal to
* desired_message_type.
*
*
* MSG_NOERROR
*
* If the message is longer than max_message_size,
* setting this flag will truncate the message to
* max_message_size and will not signal an error.
*
*
*
*
*
* @param int|null $error_code If the function fails, the optional error_code
* will be set to the value of the system errno variable.
* @param \SysvMessageQueue $queue
* @param int $desired_message_type
* @param int|null $received_message_type
* @param int $max_message_size
* @param mixed $message
* @param bool $unserialize
* @param int $flags
* @param int|null $error_code
* @throws SemException
*
*/
@@ -131,12 +60,7 @@ function msg_receive(\SysvMessageQueue $queue, int $desired_message_type, ?int &
/**
* msg_remove_queue destroys the message queue specified
* by the queue. Only use this function when all
* processes have finished working with the message queue and you need to
* release the system resources held by it.
*
* @param \SysvMessageQueue $queue The message queue.
* @param \SysvMessageQueue $queue
* @throws SemException
*
*/
@@ -151,35 +75,12 @@ function msg_remove_queue(\SysvMessageQueue $queue): void
/**
* msg_send sends a message of type
* message_type (which MUST be greater than 0) to
* the message queue specified by queue.
*
* @param \SysvMessageQueue $queue The message queue.
* @param int $message_type The type of the message (MUST be greater than 0)
* @param mixed $message The body of the message.
*
* If serialize set to FALSE is supplied,
* MUST be of type: string, int, float
* or bool. In other case a warning will be issued.
* @param bool $serialize The optional serialize controls how the
* message is sent. serialize
* defaults to TRUE which means that the message is
* serialized using the same mechanism as the session module before being
* sent to the queue. This allows complex arrays and objects to be sent to
* other PHP scripts, or if you are using the WDDX serializer, to any WDDX
* compatible client.
* @param bool $blocking If the message is too large to fit in the queue, your script will wait
* until another process reads messages from the queue and frees enough
* space for your message to be sent.
* This is called blocking; you can prevent blocking by setting the
* optional blocking parameter to FALSE, in which
* case msg_send will immediately return FALSE if the
* message is too big for the queue, and set the optional
* error_code to MSG_EAGAIN,
* indicating that you should try to send your message again a little
* later on.
* @param int|null $error_code If the function fails, the optional errorcode will be set to the value of the system errno variable.
* @param \SysvMessageQueue $queue
* @param int $message_type
* @param mixed $message
* @param bool $serialize
* @param bool $blocking
* @param int|null $error_code
* @throws SemException
*
*/
@@ -194,19 +95,8 @@ function msg_send(\SysvMessageQueue $queue, int $message_type, $message, bool $s
/**
* msg_set_queue allows you to change the values of the
* msg_perm.uid, msg_perm.gid, msg_perm.mode and msg_qbytes fields of the
* underlying message queue data structure.
*
* Changing the data structure will require that PHP be running as the same
* user that created the queue, owns the queue (as determined by the
* existing msg_perm.xxx fields), or be running with root privileges.
* root privileges are required to raise the msg_qbytes values above the
* system defined limit.
*
* @param \SysvMessageQueue $queue The message queue.
* @param array $data You specify the values you require by setting the value of the keys
* that you require in the data array.
* @param \SysvMessageQueue $queue
* @param array $data
* @throws SemException
*
*/
@@ -221,85 +111,8 @@ function msg_set_queue(\SysvMessageQueue $queue, array $data): void
/**
* msg_stat_queue returns the message queue meta data
* for the message queue specified by the queue.
* This is useful, for example, to determine which process sent the message
* that was just received.
*
* @param \SysvMessageQueue $queue The message queue.
* @return array On success, the return value is an array whose keys and values have the following
* meanings:
*
* Array structure for msg_stat_queue
*
*
*
* msg_perm.uid
*
* The uid of the owner of the queue.
*
*
*
* msg_perm.gid
*
* The gid of the owner of the queue.
*
*
*
* msg_perm.mode
*
* The file access mode of the queue.
*
*
*
* msg_stime
*
* The time that the last message was sent to the queue.
*
*
*
* msg_rtime
*
* The time that the last message was received from the queue.
*
*
*
* msg_ctime
*
* The time that the queue was last changed.
*
*
*
* msg_qnum
*
* The number of messages waiting to be read from the queue.
*
*
*
* msg_qbytes
*
* The maximum number of bytes allowed in one message queue. On
* Linux, this value may be read and modified via
* /proc/sys/kernel/msgmnb.
*
*
*
* msg_lspid
*
* The pid of the process that sent the last message to the queue.
*
*
*
* msg_lrpid
*
* The pid of the process that received the last message from the queue.
*
*
*
*
*
*
* Returns FALSE on failure.
* @param \SysvMessageQueue $queue
* @return array
* @throws SemException
*
*/
@@ -315,21 +128,8 @@ function msg_stat_queue(\SysvMessageQueue $queue): array
/**
* sem_acquire by default blocks (if necessary) until the
* semaphore can be acquired. A process attempting to acquire a semaphore which
* it has already acquired will block forever if acquiring the semaphore would
* cause its maximum number of semaphore to be exceeded.
*
* After processing a request, any semaphores acquired by the process but not
* explicitly released will be released automatically and a warning will be
* generated.
*
* @param \SysvSemaphore $semaphore semaphore is a semaphore
* obtained from sem_get.
* @param bool $non_blocking Specifies if the process shouldn't wait for the semaphore to be acquired.
* If set to true, the call will return
* false immediately if a semaphore cannot be immediately
* acquired.
* @param \SysvSemaphore $semaphore
* @param bool $non_blocking
* @throws SemException
*
*/
@@ -344,25 +144,11 @@ function sem_acquire(\SysvSemaphore $semaphore, bool $non_blocking = false): voi
/**
* sem_get returns an id that can be used to
* access the System V semaphore with the given key.
*
* A second call to sem_get for the same key
* will return a different semaphore identifier, but both
* identifiers access the same underlying semaphore.
*
* If key is 0, a new private semaphore
* is created for each call to sem_get.
*
* @param int $key
* @param int $max_acquire The number of processes that can acquire the semaphore simultaneously
* is set to max_acquire.
* @param int $permissions The semaphore permissions. Actually this value is
* set only if the process finds it is the only process currently
* attached to the semaphore.
* @param bool $auto_release Specifies if the semaphore should be automatically released on request
* shutdown.
* @return \SysvSemaphore Returns a positive semaphore identifier on success.
* @param int $max_acquire
* @param int $permissions
* @param bool $auto_release
* @return \SysvSemaphore
* @throws SemException
*
*/
@@ -378,15 +164,7 @@ function sem_get(int $key, int $max_acquire = 1, int $permissions = 0666, bool $
/**
* sem_release releases the semaphore if it
* is currently acquired by the calling process, otherwise
* a warning is generated.
*
* After releasing the semaphore, sem_acquire
* may be called to re-acquire it.
*
* @param \SysvSemaphore $semaphore A Semaphore as returned by
* sem_get.
* @param \SysvSemaphore $semaphore
* @throws SemException
*
*/
@@ -401,12 +179,7 @@ function sem_release(\SysvSemaphore $semaphore): void
/**
* sem_remove removes the given semaphore.
*
* After removing the semaphore, it is no longer accessible.
*
* @param \SysvSemaphore $semaphore A semaphore as returned
* by sem_get.
* @param \SysvSemaphore $semaphore
* @throws SemException
*
*/
@@ -421,24 +194,10 @@ function sem_remove(\SysvSemaphore $semaphore): void
/**
* shm_attach returns an id that can be used to access
* the System V shared memory with the given key, the
* first call creates the shared memory segment with
* size and the optional perm-bits
* permissions.
*
* A second call to shm_attach for the same
* key will return a different SysvSharedMemory
* instance, but both instances access the same underlying
* shared memory. size and
* permissions will be ignored.
*
* @param int $key A numeric shared memory segment ID
* @param int|null $size The memory size. If not provided, default to the
* sysvshm.init_mem in the php.ini, otherwise 10000
* bytes.
* @param int $permissions The optional permission bits. Default to 0666.
* @return \SysvSharedMemory Returns a SysvSharedMemory instance on success.
* @param int $key
* @param int|null $size
* @param int $permissions
* @return \SysvSharedMemory
* @throws SemException
*
*/
@@ -460,12 +219,7 @@ function shm_attach(int $key, ?int $size = null, int $permissions = 0666): \Sysv
/**
* shm_detach disconnects from the shared memory given
* by the shm created by
* shm_attach. Remember, that shared memory still exist
* in the Unix system and the data is still present.
*
* @param \SysvSharedMemory $shm A shared memory segment obtained from shm_attach.
* @param \SysvSharedMemory $shm
* @throws SemException
*
*/
@@ -480,21 +234,9 @@ function shm_detach(\SysvSharedMemory $shm): void
/**
* shm_put_var inserts or updates the
* value with the given
* key.
*
* Warnings (E_WARNING level) will be issued if
* shm is not a valid SysV shared memory
* index or if there was not enough shared memory remaining to complete your
* request.
*
* @param \SysvSharedMemory $shm A shared memory segment obtained from shm_attach.
* @param int $key The variable key.
* @param mixed $value The variable. All variable types
* that serialize supports may be used: generally
* this means all types except for resources and some internal objects
* that cannot be serialized.
* @param \SysvSharedMemory $shm
* @param int $key
* @param mixed $value
* @throws SemException
*
*/
@@ -509,11 +251,8 @@ function shm_put_var(\SysvSharedMemory $shm, int $key, $value): void
/**
* Removes a variable with a given key
* and frees the occupied memory.
*
* @param \SysvSharedMemory $shm A shared memory segment obtained from shm_attach.
* @param int $key The variable key.
* @param \SysvSharedMemory $shm
* @param int $key
* @throws SemException
*
*/
@@ -528,10 +267,7 @@ function shm_remove_var(\SysvSharedMemory $shm, int $key): void
/**
* shm_remove removes the shared memory
* shm. All data will be destroyed.
*
* @param \SysvSharedMemory $shm A shared memory segment obtained from shm_attach.
* @param \SysvSharedMemory $shm
* @throws SemException
*
*/

View File

@@ -5,9 +5,6 @@
use Safe\Exceptions\SessionException;
/**
* session_abort finishes session without saving
* data. Thus the original values in session data are kept.
*
* @throws SessionException
*
*/
@@ -22,27 +19,8 @@ function session_abort(): void
/**
* session_cache_expire returns the current setting of
* session.cache_expire.
*
* The cache expire is reset to the default value of 180 stored in
* session.cache_expire
* at request startup time. Thus,
* you need to call session_cache_expire for every
* request (and before session_start is called).
*
* @param int|null $value If value is given and not NULL, the current cache
* expire is replaced with value.
*
*
*
* Setting value is of value only, if
* session.cache_limiter is set to a value
* different from nocache.
*
*
* @return int Returns the current setting of session.cache_expire.
* The value returned should be read in minutes, defaults to 180.
* @param int|null $value
* @return int
* @throws SessionException
*
*/
@@ -62,34 +40,8 @@ function session_cache_expire(?int $value = null): int
/**
* session_cache_limiter returns the name of the
* current cache limiter.
*
* The cache limiter defines which cache control HTTP headers are sent to
* the client. These headers determine the rules by which the page content
* may be cached by the client and intermediate proxies. Setting the cache
* limiter to nocache disallows any client/proxy caching.
* A value of public permits caching by proxies and the
* client, whereas private disallows caching by proxies
* and permits the client to cache the contents.
*
* In private mode, the Expire header sent to the client
* may cause confusion for some browsers, including Mozilla.
* You can avoid this problem by using private_no_expire mode. The
* Expire header is never sent to the client in this mode.
*
* Setting the cache limiter to '' will turn off automatic sending
* of cache headers entirely.
*
* The cache limiter is reset to the default value stored in
* session.cache_limiter
* at request startup time. Thus, you need to call
* session_cache_limiter for every
* request (and before session_start is called).
*
* @param null|string $value If value is specified and not NULL, the name of the
* current cache limiter is changed to the new value.
* @return string Returns the name of the current cache limiter.
* @param null|string $value
* @return string
* @throws SessionException
*
*/
@@ -109,27 +61,8 @@ function session_cache_limiter(?string $value = null): string
/**
* session_create_id is used to create new
* session id for the current session. It returns collision free
* session id.
*
* If session is not active, collision check is omitted.
*
* Session ID is created according to php.ini settings.
*
* It is important to use the same user ID of your web server for GC
* task script. Otherwise, you may have permission problems especially
* with files save handler.
*
* @param string $prefix If prefix is specified, new session id
* is prefixed by prefix. Not all
* characters are allowed within the session id. Characters in
* the range a-z A-Z 0-9 , (comma) and -
* (minus) are allowed.
* @return string session_create_id returns new collision free
* session id for the current session. If it is used without active
* session, it omits collision check.
* On failure, FALSE is returned.
* @param string $prefix
* @return string
* @throws SessionException
*
*/
@@ -145,14 +78,7 @@ function session_create_id(string $prefix = ""): string
/**
* session_decode decodes the serialized session data provided in
* $data, and populates the $_SESSION superglobal
* with the result.
*
* By default, the unserialization method used is internal to PHP, and is not the same as unserialize.
* The serialization method can be set using session.serialize_handler.
*
* @param string $data The encoded data to be stored.
* @param string $data
* @throws SessionException
*
*/
@@ -167,18 +93,6 @@ function session_decode(string $data): void
/**
* In order to kill the session altogether, the
* session ID must also be unset. If a cookie is used to propagate the
* session ID (default behavior), then the session cookie must be deleted.
* setcookie may be used for that.
*
* When session.use_strict_mode
* is enabled. You do not have to remove obsolete session ID cookie because
* session module will not accept session ID cookie when there is no
* data associated to the session ID and set new session ID cookie.
* Enabling session.use_strict_mode
* is recommended for all sites.
*
* @throws SessionException
*
*/
@@ -193,13 +107,7 @@ function session_destroy(): void
/**
* session_encode returns a serialized string of the
* contents of the current session data stored in the $_SESSION superglobal.
*
* By default, the serialization method used is internal to PHP, and is not the same as serialize.
* The serialization method can be set using session.serialize_handler.
*
* @return string Returns the contents of the current session encoded.
* @return string
* @throws SessionException
*
*/
@@ -215,28 +123,7 @@ function session_encode(): string
/**
* session_gc is used to perform session data
* GC(garbage collection). PHP does probability based session GC by
* default.
*
* Probability based GC works somewhat but it has few problems. 1) Low
* traffic sites' session data may not be deleted within the preferred
* duration. 2) High traffic sites' GC may be too frequent GC. 3) GC is
* performed on the user's request and the user will experience a GC
* delay.
*
* Therefore, it is recommended to execute GC periodically for
* production systems using, e.g., "cron" for UNIX-like systems.
* Make sure to disable probability based GC by setting
* session.gc_probability
* to 0.
*
* @return int session_gc returns number of deleted session
* data for success.
*
* Old save handlers do not return number of deleted session data, but
* only success/failure flag. If this is the case, number of deleted
* session data became 1 regardless of actually deleted data.
* @return int
* @throws SessionException
*
*/
@@ -252,24 +139,8 @@ function session_gc(): int
/**
* session_id is used to get or set the session id for
* the current session.
*
* The constant SID can also be used to
* retrieve the current name and session id as a string suitable for
* adding to URLs. See also Session
* handling.
*
* @param null|string $id If id is specified and not NULL, it will replace the current
* session id. session_id needs to be called before
* session_start for that purpose. Depending on the
* session handler, not all characters are allowed within the session id.
* For example, the file session handler only allows characters in the
* range a-z A-Z 0-9 , (comma) and - (minus)!
* @return string session_id returns the session id for the current
* session or the empty string ("") if there is no current
* session (no current session id exists).
* On failure, FALSE is returned.
* @param null|string $id
* @return string
* @throws SessionException
*
*/
@@ -289,16 +160,8 @@ function session_id(?string $id = null): string
/**
* session_module_name gets the name of the current
* session module, which is also known as
* session.save_handler.
*
* @param null|string $module If module is specified and not NULL, that module will be
* used instead.
* Passing "user" to this parameter is forbidden. Instead
* session_set_save_handler has to be called to set a user
* defined session handler.
* @return string Returns the name of the current session module.
* @param null|string $module
* @return string
* @throws SessionException
*
*/
@@ -318,44 +181,8 @@ function session_module_name(?string $module = null): string
/**
* session_name returns the name of the current
* session. If name is given,
* session_name will update the session name and return
* the old session name.
*
* If a new session name is
* supplied, session_name modifies the HTTP cookie
* (and output content when session.transid is
* enabled). Once the HTTP cookie is
* sent, session_name raises error.
* session_name must be called
* before session_start for the session to work
* properly.
*
* The session name is reset to the default value stored in
* session.name at request startup time. Thus, you need to
* call session_name for every request (and before
* session_start is called).
*
* @param null|string $name The session name references the name of the session, which is
* used in cookies and URLs (e.g. PHPSESSID). It
* should contain only alphanumeric characters; it should be short and
* descriptive (i.e. for users with enabled cookie warnings).
* If name is specified and not NULL, the name of the current
* session is changed to its value.
*
*
*
* The session name can't consist of digits only, at least one letter
* must be present. Otherwise a new session id is generated every time.
*
*
*
* The session name can't consist of digits only, at least one letter
* must be present. Otherwise a new session id is generated every time.
* @return non-falsy-string Returns the name of the current session. If name is given
* and function updates the session name, name of the old session
* is returned.
* @param null|string $name
* @return non-falsy-string
* @throws SessionException
*
*/
@@ -375,17 +202,7 @@ function session_name(?string $name = null): string
/**
* session_regenerate_id will replace the current
* session id with a new one, and keep the current session information.
*
* When session.use_trans_sid
* is enabled, output must be started after session_regenerate_id
* call. Otherwise, old session ID is used.
*
* @param bool $delete_old_session Whether to delete the old associated session file or not.
* You should not delete old session if you need to avoid
* races caused by deletion or detect/avoid session hijack
* attacks.
* @param bool $delete_old_session
* @throws SessionException
*
*/
@@ -400,10 +217,6 @@ function session_regenerate_id(bool $delete_old_session = false): void
/**
* session_reset reinitializes a session with
* original values stored in session storage. This function requires an active session and
* discards changes in $_SESSION.
*
* @throws SessionException
*
*/
@@ -418,25 +231,8 @@ function session_reset(): void
/**
* session_save_path returns the path of the current
* directory used to save session data.
*
* @param null|string $path Session data path. If specified and not NULL, the path to which data is saved will
* be changed. session_save_path needs to be called
* before session_start for that purpose.
*
*
*
* On some operating systems, you may want to specify a path on a
* filesystem that handles lots of small files efficiently. For example,
* on Linux, reiserfs may provide better performance than ext2fs.
*
*
*
* On some operating systems, you may want to specify a path on a
* filesystem that handles lots of small files efficiently. For example,
* on Linux, reiserfs may provide better performance than ext2fs.
* @return string Returns the path of the current directory used for data storage.
* @param null|string $path
* @return string
* @throws SessionException
*
*/
@@ -456,41 +252,7 @@ function session_save_path(?string $path = null): string
/**
* session_start creates a session or resumes the
* current one based on a session identifier passed via a GET or POST
* request, or passed via a cookie.
*
* When session_start is called or when a session auto starts,
* PHP will call the open and read session save handlers. These will either be a built-in
* save handler provided by default or by PHP extensions (such as SQLite or Memcached); or can be
* custom handler as defined by session_set_save_handler.
* The read callback will retrieve any existing session data (stored in a special serialized format)
* and will be unserialized and used to automatically populate the $_SESSION superglobal when the
* read callback returns the saved session data back to PHP session handling.
*
* To use a named session, call
* session_name before calling
* session_start.
*
* When session.use_trans_sid
* is enabled, the session_start function will
* register an internal output handler for URL rewriting.
*
* If a user uses ob_gzhandler or similar with
* ob_start, the function order is important for
* proper output. For example,
* ob_gzhandler must be registered before starting the session.
*
* @param array $options If provided, this is an associative array of options that will override
* the currently set
* session configuration directives.
* The keys should not include the session. prefix.
*
* In addition to the normal set of configuration directives, a
* read_and_close option may also be provided. If set to
* TRUE, this will result in the session being closed immediately after
* being read, thereby avoiding unnecessary locking if the session data
* won't be changed.
* @param array $options
* @throws SessionException
*
*/
@@ -505,9 +267,6 @@ function session_start(array $options = []): void
/**
* The session_unset function frees all session variables
* currently registered.
*
* @throws SessionException
*
*/
@@ -522,16 +281,6 @@ function session_unset(): void
/**
* End the current session and store session data.
*
* Session data is usually stored after your script terminated without the
* need to call session_write_close, but as session data
* is locked to prevent concurrent writes only one script may operate on a
* session at any time. When using framesets together with sessions you will
* experience the frames loading one by one due to this locking. You can
* reduce the time needed to load all the frames by ending the session as
* soon as all changes to session variables are done.
*
* @throws SessionException
*
*/

View File

@@ -5,10 +5,7 @@
use Safe\Exceptions\ShmopException;
/**
* shmop_delete is used to delete a shared memory block.
*
* @param \Shmop $shmop The shared memory block resource created by
* shmop_open
* @param \Shmop $shmop
* @throws ShmopException
*
*/
@@ -23,14 +20,10 @@ function shmop_delete(\Shmop $shmop): void
/**
* shmop_read will read a string from shared memory block.
*
* @param \Shmop $shmop The shared memory block identifier created by
* shmop_open
* @param int $offset Offset from which to start reading
* @param int $size The number of bytes to read.
* 0 reads shmop_size($shmid) - $start bytes.
* @return string Returns the data.
* @param \Shmop $shmop
* @param int $offset
* @param int $size
* @return string
* @throws ShmopException
*
*/

View File

@@ -5,32 +5,8 @@
use Safe\Exceptions\SocketsException;
/**
* After the socket socket has been created
* using socket_create, bound to a name with
* socket_bind, and told to listen for connections
* with socket_listen, this function will accept
* incoming connections on that socket. Once a successful connection
* is made, a new Socket instance is returned,
* which may be used for communication. If there are multiple connections
* queued on the socket, the first will be used. If there are no pending
* connections, socket_accept will block until
* a connection becomes present. If socket
* has been made non-blocking using
* socket_set_blocking or
* socket_set_nonblock, FALSE will be returned.
*
* The Socket instance returned by
* socket_accept may not be used to accept new
* connections. The original listening socket
* socket, however, remains open and may be
* reused.
*
* @param \Socket $socket A Socket instance created with socket_create.
* @return \Socket Returns a new Socket instance on success. The actual
* error code can be retrieved by calling
* socket_last_error. This error code may be passed to
* socket_strerror to get a textual explanation of the
* error.
* @param \Socket $socket
* @return \Socket
* @throws SocketsException
*
*/
@@ -46,11 +22,8 @@ function socket_accept(\Socket $socket): \Socket
/**
* Create a Socket instance, and bind it to the provided AddressInfo. The return
* value of this function may be used with socket_listen.
*
* @param \AddressInfo $address AddressInfo instance created from socket_addrinfo_lookup.
* @return \Socket Returns a Socket instance on success.
* @param \AddressInfo $address
* @return \Socket
* @throws SocketsException
*
*/
@@ -66,11 +39,8 @@ function socket_addrinfo_bind(\AddressInfo $address): \Socket
/**
* Create a Socket instance, and connect it to the provided AddressInfo instance. The return
* value of this function may be used with the rest of the socket functions.
*
* @param \AddressInfo $address AddressInfo instance created from socket_addrinfo_lookup
* @return \Socket Returns a Socket instance on success.
* @param \AddressInfo $address
* @return \Socket
* @throws SocketsException
*
*/
@@ -86,16 +56,10 @@ function socket_addrinfo_connect(\AddressInfo $address): \Socket
/**
* Lookup different ways we can connect to host. The returned array contains
* a set of AddressInfo instances that we can bind to using socket_addrinfo_bind.
*
* @param string $host Hostname to search.
* @param mixed $service The service to connect to. If service is a name, it is translated to the corresponding
* port number.
* @param array $hints Hints provide criteria for selecting addresses returned. You may specify the
* hints as defined by getadrinfo.
* @return \AddressInfo[] Returns an array of AddressInfo instances that can be used with the other socket_addrinfo functions.
* On failure, FALSE is returned.
* @param string $host
* @param mixed $service
* @param array $hints
* @return \AddressInfo[]
* @throws SocketsException
*
*/
@@ -117,22 +81,9 @@ function socket_addrinfo_lookup(string $host, $service = null, array $hints = []
/**
* Binds the name given in address to the socket
* described by socket. This has to be done before
* a connection is be established using socket_connect
* or socket_listen.
*
* @param \Socket $socket A Socket instance created with socket_create.
* @param string $address If the socket is of the AF_INET family, the
* address is an IP in dotted-quad notation
* (e.g. 127.0.0.1).
*
* If the socket is of the AF_UNIX family, the
* address is the path of a
* Unix-domain socket (e.g. /tmp/my.sock).
* @param int $port The port parameter is only used when
* binding an AF_INET socket, and designates
* the port on which to listen for connections.
* @param \Socket $socket
* @param string $address
* @param int $port
* @throws SocketsException
*
*/
@@ -147,23 +98,9 @@ function socket_bind(\Socket $socket, string $address, int $port = 0): void
/**
* Initiate a connection to address using the Socket instance
* socket, which must be Socket
* instance created with socket_create.
*
* @param \Socket $socket A Socket instance created with
* socket_create.
* @param string $address The address parameter is either an IPv4 address
* in dotted-quad notation (e.g. 127.0.0.1) if
* socket is AF_INET, a valid
* IPv6 address (e.g. ::1) if IPv6 support is enabled and
* socket is AF_INET6
* or the pathname of a Unix domain socket, if the socket family is
* AF_UNIX.
* @param int|null $port The port parameter is only used and is mandatory
* when connecting to an AF_INET or an
* AF_INET6 socket, and designates
* the port on the remote host to which a connection should be made.
* @param \Socket $socket
* @param string $address
* @param int|null $port
* @throws SocketsException
*
*/
@@ -182,24 +119,9 @@ function socket_connect(\Socket $socket, string $address, ?int $port = null): vo
/**
* socket_create_listen creates a new Socket instance of
* type AF_INET listening on all
* local interfaces on the given port waiting for new connections.
*
* This function is meant to ease the task of creating a new socket which
* only listens to accept new connections.
*
* @param int $port The port on which to listen on all interfaces.
* @param int $backlog The backlog parameter defines the maximum length
* the queue of pending connections may grow to.
* SOMAXCONN may be passed as
* backlog parameter, see
* socket_listen for more information.
* @return \Socket socket_create_listen returns a new Socket instance
* on success. The error code can be retrieved with
* socket_last_error. This code may be passed to
* socket_strerror to get a textual explanation of the
* error.
* @param int $port
* @param int $backlog
* @return \Socket
* @throws SocketsException
*
*/
@@ -215,27 +137,10 @@ function socket_create_listen(int $port, int $backlog = 128): \Socket
/**
* socket_create_pair creates two connected and
* indistinguishable sockets, and stores them in pair.
* This function is commonly used in IPC (InterProcess Communication).
*
* @param int $domain The domain parameter specifies the protocol
* family to be used by the socket. See socket_create
* for the full list.
* @param int $type The type parameter selects the type of communication
* to be used by the socket. See socket_create for the
* full list.
* @param int $protocol The protocol parameter sets the specific
* protocol within the specified domain to be used
* when communicating on the returned socket. The proper value can be retrieved by
* name by using getprotobyname. If
* the desired protocol is TCP, or UDP the corresponding constants
* SOL_TCP, and SOL_UDP
* can also be used.
*
* See socket_create for the full list of supported
* protocols.
* @param \Socket[]|null $pair Reference to an array in which the two Socket instances will be inserted.
* @param int $domain
* @param int $type
* @param int $protocol
* @param \Socket[]|null $pair
* @throws SocketsException
*
*/
@@ -250,25 +155,10 @@ function socket_create_pair(int $domain, int $type, int $protocol, ?array &$pair
/**
* Creates and returns a Socket instance, also referred to as an endpoint
* of communication. A typical network connection is made up of 2 sockets, one
* performing the role of the client, and another performing the role of the server.
*
* @param int $domain The domain parameter specifies the protocol
* family to be used by the socket.
* @param int $type The type parameter selects the type of communication
* to be used by the socket.
* @param int $protocol The protocol parameter sets the specific
* protocol within the specified domain to be used
* when communicating on the returned socket. The proper value can be
* retrieved by name by using getprotobyname. If
* the desired protocol is TCP, or UDP the corresponding constants
* SOL_TCP, and SOL_UDP
* can also be used.
* @return \Socket socket_create returns a Socket instance on success. The actual error code can be retrieved by calling
* socket_last_error. This error code may be passed to
* socket_strerror to get a textual explanation of the
* error.
* @param int $domain
* @param int $type
* @param int $protocol
* @return \Socket
* @throws SocketsException
*
*/
@@ -284,10 +174,8 @@ function socket_create(int $domain, int $type, int $protocol): \Socket
/**
*
*
* @param \Socket $socket
* @return resource Return resource.
* @return resource
* @throws SocketsException
*
*/
@@ -303,38 +191,10 @@ function socket_export_stream(\Socket $socket)
/**
* The socket_get_option function retrieves the value for
* the option specified by the option parameter for the
* specified socket.
*
* @param \Socket $socket A Socket instance created with socket_create
* or socket_accept.
* @param int $level The level parameter specifies the protocol
* level at which the option resides. For example, to retrieve options at
* the socket level, a level parameter of
* SOL_SOCKET would be used. Other levels, such as
* TCP, can be used by
* specifying the protocol number of that level. Protocol numbers can be
* found by using the getprotobyname function.
* @param int $option Reports whether the socket lingers on
* socket_close if data is present. By default,
* when the socket is closed, it attempts to send all unsent data.
* In the case of a connection-oriented socket,
* socket_close will wait for its peer to
* acknowledge the data.
*
* If l_onoff is non-zero and
* l_linger is zero, all the
* unsent data will be discarded and RST (reset) is sent to the
* peer in the case of a connection-oriented socket.
*
* On the other hand, if l_onoff is
* non-zero and l_linger is non-zero,
* socket_close will block until all the data
* is sent or the time specified in l_linger
* elapses. If the socket is non-blocking,
* socket_close will fail and return an error.
* @return mixed Returns the value of the given option.
* @param \Socket $socket
* @param int $level
* @param int $option
* @return mixed
* @throws SocketsException
*
*/
@@ -350,25 +210,9 @@ function socket_get_option(\Socket $socket, int $level, int $option)
/**
* Queries the remote side of the given socket which may either result in
* host/port or in a Unix filesystem path, dependent on its type.
*
* @param \Socket $socket A Socket instance created with socket_create
* or socket_accept.
* @param null|string $address If the given socket is of type AF_INET or
* AF_INET6, socket_getpeername
* will return the peers (remote) IP address in
* appropriate notation (e.g. 127.0.0.1 or
* fe80::1) in the address
* parameter and, if the optional port parameter is
* present, also the associated port.
*
* If the given socket is of type AF_UNIX,
* socket_getpeername will return the Unix filesystem
* path (e.g. /var/run/daemon.sock) in the
* address parameter.
* @param int|null $port If given, this will hold the port associated to
* address.
* @param \Socket $socket
* @param null|string $address
* @param int|null $port
* @throws SocketsException
*
*/
@@ -383,22 +227,9 @@ function socket_getpeername(\Socket $socket, ?string &$address, ?int &$port = nu
/**
*
*
* @param \Socket $socket A Socket instance created with socket_create
* or socket_accept.
* @param null|string $address If the given socket is of type AF_INET
* or AF_INET6, socket_getsockname
* will return the local IP address in appropriate notation (e.g.
* 127.0.0.1 or fe80::1) in the
* address parameter and, if the optional
* port parameter is present, also the associated port.
*
* If the given socket is of type AF_UNIX,
* socket_getsockname will return the Unix filesystem
* path (e.g. /var/run/daemon.sock) in the
* address parameter.
* @param int|null $port If provided, this will hold the associated port.
* @param \Socket $socket
* @param null|string $address
* @param int|null $port
* @throws SocketsException
*
*/
@@ -413,10 +244,8 @@ function socket_getsockname(\Socket $socket, ?string &$address, ?int &$port = nu
/**
* Imports a stream that encapsulates a socket into a socket extension resource.
*
* @param resource $stream The stream resource to import.
* @return \Socket Returns FALSE on failure.
* @param resource $stream
* @return \Socket
* @throws SocketsException
*
*/
@@ -432,30 +261,8 @@ function socket_import_stream($stream): \Socket
/**
* After the socket socket has been created
* using socket_create and bound to a name with
* socket_bind, it may be told to listen for incoming
* connections on socket.
*
* socket_listen is applicable only to sockets of
* type SOCK_STREAM or
* SOCK_SEQPACKET.
*
* @param \Socket $socket A Socket instance created with socket_create
* or socket_addrinfo_bind
* @param int $backlog A maximum of backlog incoming connections will be
* queued for processing. If a connection request arrives with the queue
* full the client may receive an error with an indication of
* ECONNREFUSED, or, if the underlying protocol supports
* retransmission, the request may be ignored so that retries may succeed.
*
* The maximum number passed to the backlog
* parameter highly depends on the underlying platform. On Linux, it is
* silently truncated to SOMAXCONN. On win32, if
* passed SOMAXCONN, the underlying service provider
* responsible for the socket will set the backlog to a maximum
* reasonable value. There is no standard provision to
* find out the actual backlog value on this platform.
* @param \Socket $socket
* @param int $backlog
* @throws SocketsException
*
*/
@@ -470,38 +277,10 @@ function socket_listen(\Socket $socket, int $backlog = 0): void
/**
* The function socket_read reads from the Socket instance
* socket created by the
* socket_create or
* socket_accept functions.
*
* @param \Socket $socket A Socket instance created with socket_create
* or socket_accept.
* @param int $length The maximum number of bytes read is specified by the
* length parameter. Otherwise you can use
* \r, \n,
* or \0 to end reading (depending on the mode
* parameter, see below).
* @param int $mode Optional mode parameter is a named constant:
*
*
*
* PHP_BINARY_READ (Default) - use the system
* recv() function. Safe for reading binary data.
*
*
*
*
* PHP_NORMAL_READ - reading stops at
* \n or \r.
*
*
*
* @return string socket_read returns the data as a string on success (including if the remote host has closed the
* connection). The error code can be retrieved with
* socket_last_error. This code may be passed to
* socket_strerror to get a textual representation of
* the error.
* @param \Socket $socket
* @param int $length
* @param int $mode
* @return string
* @throws SocketsException
*
*/
@@ -517,52 +296,11 @@ function socket_read(\Socket $socket, int $length, int $mode = PHP_BINARY_READ):
/**
* The function socket_send sends
* length bytes to the socket
* socket from data.
*
* @param \Socket $socket A Socket instance created with socket_create
* or socket_accept.
* @param string $data A buffer containing the data that will be sent to the remote host.
* @param int $length The number of bytes that will be sent to the remote host from
* data.
* @param int $flags The value of flags can be any combination of
* the following flags, joined with the binary OR (|)
* operator.
*
* Possible values for flags
*
*
*
* MSG_OOB
*
* Send OOB (out-of-band) data.
*
*
*
* MSG_EOR
*
* Indicate a record mark. The sent data completes the record.
*
*
*
* MSG_EOF
*
* Close the sender side of the socket and include an appropriate
* notification of this at the end of the sent data. The sent data
* completes the transaction.
*
*
*
* MSG_DONTROUTE
*
* Bypass routing, use direct interface.
*
*
*
*
*
* @return int socket_send returns the number of bytes sent.
* @param \Socket $socket
* @param string $data
* @param int $length
* @param int $flags
* @return int
* @throws SocketsException
*
*/
@@ -578,12 +316,10 @@ function socket_send(\Socket $socket, string $data, int $length, int $flags): in
/**
*
*
* @param \Socket $socket
* @param array $message
* @param int $flags
* @return int Returns the number of bytes sent.
* @return int
* @throws SocketsException
*
*/
@@ -599,56 +335,13 @@ function socket_sendmsg(\Socket $socket, array $message, int $flags = 0): int
/**
* The function socket_sendto sends
* length bytes from data
* through the socket socket to the
* port at the address address.
*
* @param \Socket $socket A Socket instance created using socket_create.
* @param string $data The sent data will be taken from buffer data.
* @param int $length length bytes from data will be
* sent.
* @param int $flags The value of flags can be any combination of
* the following flags, joined with the binary OR (|)
* operator.
*
* Possible values for flags
*
*
*
* MSG_OOB
*
* Send OOB (out-of-band) data.
*
*
*
* MSG_EOR
*
* Indicate a record mark. The sent data completes the record.
*
*
*
* MSG_EOF
*
* Close the sender side of the socket and include an appropriate
* notification of this at the end of the sent data. The sent data
* completes the transaction.
*
*
*
* MSG_DONTROUTE
*
* Bypass routing, use direct interface.
*
*
*
*
*
* @param string $address IP address of the remote host.
* @param int|null $port port is the remote port number at which the data
* will be sent.
* @return int socket_sendto returns the number of bytes sent to the
* remote host.
* @param \Socket $socket
* @param string $data
* @param int $length
* @param int $flags
* @param string $address
* @param int|null $port
* @return int
* @throws SocketsException
*
*/
@@ -668,16 +361,7 @@ function socket_sendto(\Socket $socket, string $data, int $length, int $flags, s
/**
* The socket_set_block function removes the
* O_NONBLOCK flag on the socket specified by the
* socket parameter.
*
* When an operation (e.g. receive, send, connect, accept, ...) is performed on
* a blocking socket, the script will pause its execution until it receives
* a signal or it can perform the operation.
*
* @param \Socket $socket A Socket instance created with socket_create
* or socket_accept.
* @param \Socket $socket
* @throws SocketsException
*
*/
@@ -692,17 +376,7 @@ function socket_set_block(\Socket $socket): void
/**
* The socket_set_nonblock function sets the
* O_NONBLOCK flag on the socket specified by
* the socket parameter.
*
* When an operation (e.g. receive, send, connect, accept, ...) is performed on
* a non-blocking socket, the script will not pause its execution until it receives a
* signal or it can perform the operation. Rather, if the operation would result
* in a block, the called function will fail.
*
* @param \Socket $socket A Socket instance created with socket_create
* or socket_accept.
* @param \Socket $socket
* @throws SocketsException
*
*/
@@ -717,24 +391,10 @@ function socket_set_nonblock(\Socket $socket): void
/**
* The socket_set_option function sets the option
* specified by the option parameter, at the
* specified protocol level, to the value pointed to
* by the value parameter for the
* socket.
*
* @param \Socket $socket A Socket instance created with socket_create
* or socket_accept.
* @param int $level The level parameter specifies the protocol
* level at which the option resides. For example, to retrieve options at
* the socket level, a level parameter of
* SOL_SOCKET would be used. Other levels, such as
* TCP, can be used by specifying the protocol number of that level.
* Protocol numbers can be found by using the
* getprotobyname function.
* @param int $option The available socket options are the same as those for the
* socket_get_option function.
* @param array|int|string $value The option value.
* @param \Socket $socket
* @param int $level
* @param int $option
* @param array|int|string $value
* @throws SocketsException
*
*/
@@ -749,37 +409,8 @@ function socket_set_option(\Socket $socket, int $level, int $option, $value): vo
/**
* The socket_shutdown function allows you to stop
* incoming, outgoing or all data (the default) from being sent through the
* socket
*
* @param \Socket $socket A Socket instance created with socket_create.
* @param int $mode The value of mode can be one of the following:
*
* possible values for mode
*
*
*
* 0
*
* Shutdown socket reading
*
*
*
* 1
*
* Shutdown socket writing
*
*
*
* 2
*
* Shutdown socket reading and writing
*
*
*
*
*
* @param \Socket $socket
* @param int $mode
* @throws SocketsException
*
*/
@@ -794,13 +425,9 @@ function socket_shutdown(\Socket $socket, int $mode = 2): void
/**
* Exports the WSAPROTOCOL_INFO structure into shared memory and returns
* an identifier to be used with socket_wsaprotocol_info_import. The
* exported ID is only valid for the given process_id.
*
* @param \Socket $socket A Socket instance.
* @param int $process_id The ID of the process which will import the socket.
* @return string Returns an identifier to be used for the import
* @param \Socket $socket
* @param int $process_id
* @return string
* @throws SocketsException
*
*/
@@ -816,11 +443,8 @@ function socket_wsaprotocol_info_export(\Socket $socket, int $process_id): strin
/**
* Imports a socket which has formerly been exported from another process.
*
* @param string $info_id The ID which has been returned by a former call to
* socket_wsaprotocol_info_export.
* @return \Socket Returns a Socket instance on success
* @param string $info_id
* @return \Socket
* @throws SocketsException
*
*/
@@ -836,10 +460,7 @@ function socket_wsaprotocol_info_import(string $info_id): \Socket
/**
* Releases the shared memory corresponding to the given info_id.
*
* @param string $info_id The ID which has been returned by a former call to
* socket_wsaprotocol_info_export.
* @param string $info_id
* @throws SocketsException
*
*/

View File

@@ -5,16 +5,11 @@
use Safe\Exceptions\SodiumException;
/**
* Verify then decrypt with AES-256-GCM.
* Only available if sodium_crypto_aead_aes256gcm_is_available returns TRUE.
*
* @param string $ciphertext Must be in the format provided by sodium_crypto_aead_aes256gcm_encrypt
* (ciphertext and tag, concatenated).
* @param string $additional_data Additional, authenticated data. This is used in the verification of the authentication tag
* appended to the ciphertext, but it is not encrypted or stored in the ciphertext.
* @param string $nonce A number that must be only used once, per message. 12 bytes long.
* @param string $key Encryption key (256-bit).
* @return string Returns the plaintext on success.
* @param string $ciphertext
* @param string $additional_data
* @param string $nonce
* @param string $key
* @return string
* @throws SodiumException
*
*/
@@ -30,15 +25,11 @@ function sodium_crypto_aead_aes256gcm_decrypt(string $ciphertext, string $additi
/**
* Verify then decrypt with ChaCha20-Poly1305.
*
* @param string $ciphertext Must be in the format provided by sodium_crypto_aead_chacha20poly1305_encrypt
* (ciphertext and tag, concatenated).
* @param string $additional_data Additional, authenticated data. This is used in the verification of the authentication tag
* appended to the ciphertext, but it is not encrypted or stored in the ciphertext.
* @param string $nonce A number that must be only used once, per message. 8 bytes long.
* @param string $key Encryption key (256-bit).
* @return string Returns the plaintext on success.
* @param string $ciphertext
* @param string $additional_data
* @param string $nonce
* @param string $key
* @return string
* @throws SodiumException
*
*/
@@ -54,14 +45,11 @@ function sodium_crypto_aead_chacha20poly1305_decrypt(string $ciphertext, string
/**
* Encrypt then authenticate with ChaCha20-Poly1305.
*
* @param string $message The plaintext message to encrypt.
* @param string $additional_data Additional, authenticated data. This is used in the verification of the authentication tag
* appended to the ciphertext, but it is not encrypted or stored in the ciphertext.
* @param string $nonce A number that must be only used once, per message. 8 bytes long.
* @param string $key Encryption key (256-bit).
* @return string Returns the ciphertext and tag on success.
* @param string $message
* @param string $additional_data
* @param string $nonce
* @param string $key
* @return string
* @throws SodiumException
*
*/
@@ -77,17 +65,11 @@ function sodium_crypto_aead_chacha20poly1305_encrypt(string $message, string $ad
/**
* Verify then decrypt with ChaCha20-Poly1305 (IETF variant).
*
* The IETF variant uses 96-bit nonces and 32-bit internal counters, instead of 64-bit for both.
*
* @param string $ciphertext Must be in the format provided by sodium_crypto_aead_chacha20poly1305_ietf_encrypt
* (ciphertext and tag, concatenated).
* @param string $additional_data Additional, authenticated data. This is used in the verification of the authentication tag
* appended to the ciphertext, but it is not encrypted or stored in the ciphertext.
* @param string $nonce A number that must be only used once, per message. 12 bytes long.
* @param string $key Encryption key (256-bit).
* @return string Returns the plaintext on success.
* @param string $ciphertext
* @param string $additional_data
* @param string $nonce
* @param string $key
* @return string
* @throws SodiumException
*
*/
@@ -103,16 +85,11 @@ function sodium_crypto_aead_chacha20poly1305_ietf_decrypt(string $ciphertext, st
/**
* Encrypt then authenticate with ChaCha20-Poly1305 (IETF variant).
*
* The IETF variant uses 96-bit nonces and 32-bit internal counters, instead of 64-bit for both.
*
* @param string $message The plaintext message to encrypt.
* @param string $additional_data Additional, authenticated data. This is used in the verification of the authentication tag
* appended to the ciphertext, but it is not encrypted or stored in the ciphertext.
* @param string $nonce A number that must be only used once, per message. 12 bytes long.
* @param string $key Encryption key (256-bit).
* @return string Returns the ciphertext and tag on success.
* @param string $message
* @param string $additional_data
* @param string $nonce
* @param string $key
* @return string
* @throws SodiumException
*
*/
@@ -128,18 +105,11 @@ function sodium_crypto_aead_chacha20poly1305_ietf_encrypt(string $message, strin
/**
* Verify then decrypt with ChaCha20-Poly1305 (eXtended-nonce variant).
*
* Generally, XChaCha20-Poly1305 is the best of the provided AEAD modes to use.
*
* @param string $ciphertext Must be in the format provided by sodium_crypto_aead_chacha20poly1305_ietf_encrypt
* (ciphertext and tag, concatenated).
* @param string $additional_data Additional, authenticated data. This is used in the verification of the authentication tag
* appended to the ciphertext, but it is not encrypted or stored in the ciphertext.
* @param string $nonce A number that must be only used once, per message. 24 bytes long.
* This is a large enough bound to generate randomly (i.e. random_bytes).
* @param string $key Encryption key (256-bit).
* @return string Returns the plaintext on success.
* @param string $ciphertext
* @param string $additional_data
* @param string $nonce
* @param string $key
* @return string
* @throws SodiumException
*
*/
@@ -155,17 +125,11 @@ function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt(string $ciphertext, s
/**
* Encrypt then authenticate with XChaCha20-Poly1305 (eXtended-nonce variant).
*
* Generally, XChaCha20-Poly1305 is the best of the provided AEAD modes to use.
*
* @param string $message The plaintext message to encrypt.
* @param string $additional_data Additional, authenticated data. This is used in the verification of the authentication tag
* appended to the ciphertext, but it is not encrypted or stored in the ciphertext.
* @param string $nonce A number that must be only used once, per message. 24 bytes long.
* This is a large enough bound to generate randomly (i.e. random_bytes).
* @param string $key Encryption key (256-bit).
* @return string Returns the ciphertext and tag on success.
* @param string $message
* @param string $additional_data
* @param string $nonce
* @param string $key
* @return string
* @throws SodiumException
*
*/
@@ -181,15 +145,9 @@ function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt(string $message, stri
/**
* Verify the authentication tag is valid for a given message and key.
*
* Unlike with digital signatures (e.g. sodium_crypto_sign_verify_detached),
* any party capable of verifying a message is also capable of authenticating
* their own messages. (Hence, symmetric authentication.)
*
* @param string $mac Authentication tag produced by sodium_crypto_auth
* @param string $message Message
* @param string $key Authentication key
* @param string $mac
* @param string $message
* @param string $key
* @throws SodiumException
*
*/
@@ -204,14 +162,10 @@ function sodium_crypto_auth_verify(string $mac, string $message, string $key): v
/**
* Decrypt a message using asymmetric (public key) cryptography.
*
* @param string $ciphertext The encrypted message to attempt to decrypt.
* @param string $nonce A number that must be only used once, per message. 24 bytes long.
* This is a large enough bound to generate randomly (i.e. random_bytes).
* @param string $key_pair See sodium_crypto_box_keypair_from_secretkey_and_publickey.
* This should include the sender's public key and the recipient's secret key.
* @return string Returns the plaintext message on success.
* @param string $ciphertext
* @param string $nonce
* @param string $key_pair
* @return string
* @throws SodiumException
*
*/
@@ -227,11 +181,9 @@ function sodium_crypto_box_open(string $ciphertext, string $nonce, string $key_p
/**
* Decrypt a message that was encrypted with sodium_crypto_box_seal
*
* @param string $ciphertext The encrypted message
* @param string $key_pair The keypair of the recipient. Must include the secret key.
* @return string The plaintext on success.
* @param string $ciphertext
* @param string $key_pair
* @return string
* @throws SodiumException
*
*/
@@ -247,10 +199,8 @@ function sodium_crypto_box_seal_open(string $ciphertext, string $key_pair): stri
/**
* Appends a message to the internal hash state.
*
* @param non-empty-string $state The return value of sodium_crypto_generichash_init.
* @param string $message Data to append to the hashing state.
* @param non-empty-string $state
* @param string $message
* @throws SodiumException
*
*/
@@ -265,14 +215,10 @@ function sodium_crypto_generichash_update(string &$state, string $message): void
/**
* Decrypt an encrypted message with a symmetric (shared) key.
*
* @param string $ciphertext Must be in the format provided by sodium_crypto_secretbox
* (ciphertext and tag, concatenated).
* @param string $nonce A number that must be only used once, per message. 24 bytes long.
* This is a large enough bound to generate randomly (i.e. random_bytes).
* @param string $key Encryption key (256-bit).
* @return string The decrypted string on success.
* @param string $ciphertext
* @param string $nonce
* @param string $key
* @return string
* @throws SodiumException
*
*/
@@ -288,11 +234,9 @@ function sodium_crypto_secretbox_open(string $ciphertext, string $nonce, string
/**
* Verify the signature attached to a message and return the message
*
* @param string $signed_message A message signed with sodium_crypto_sign
* @param non-empty-string $public_key An Ed25519 public key
* @return string Returns the original signed message on success.
* @param string $signed_message
* @param non-empty-string $public_key
* @return string
* @throws SodiumException
*
*/
@@ -308,11 +252,9 @@ function sodium_crypto_sign_open(string $signed_message, string $public_key): st
/**
* Verify signature for the message
*
* @param non-empty-string $signature The cryptographic signature obtained from sodium_crypto_sign_detached
* @param string $message The message being verified
* @param non-empty-string $public_key Ed25519 public key
* @param non-empty-string $signature
* @param string $message
* @param non-empty-string $public_key
* @throws SodiumException
*
*/

View File

@@ -5,9 +5,7 @@
use Safe\Exceptions\SolrException;
/**
* This function returns the current version of the extension as a string.
*
* @return string It returns a string on success.
* @return string
* @throws SolrException
*
*/

View File

@@ -5,12 +5,9 @@
use Safe\Exceptions\SplException;
/**
* This function returns an array with the names of the interfaces that the
* given object_or_class and its parents implement.
*
* @param object|string $object_or_class An object (class instance) or a string (class or interface name).
* @param bool $autoload Whether to call __autoload by default.
* @return array An array on success, or FALSE when the given class doesn't exist.
* @param object|string $object_or_class
* @param bool $autoload
* @return array
* @throws SplException
*
*/
@@ -26,12 +23,9 @@ function class_implements($object_or_class, bool $autoload = true): array
/**
* This function returns an array with the name of the parent classes of
* the given object_or_class.
*
* @param object|string $object_or_class An object (class instance) or a string (class name).
* @param bool $autoload Whether to call __autoload by default.
* @return array An array on success, or FALSE when the given class doesn't exist.
* @param object|string $object_or_class
* @param bool $autoload
* @return array
* @throws SplException
*
*/
@@ -47,13 +41,9 @@ function class_parents($object_or_class, bool $autoload = true): array
/**
* This function returns an array with the names of the traits that the
* given object_or_class uses. This does however not include
* any traits used by a parent class.
*
* @param object|string $object_or_class An object (class instance) or a string (class name).
* @param bool $autoload Whether to call __autoload by default.
* @return array An array on success, or FALSE when the given class doesn't exist.
* @param object|string $object_or_class
* @param bool $autoload
* @return array
* @throws SplException
*
*/
@@ -69,30 +59,9 @@ function class_uses($object_or_class, bool $autoload = true): array
/**
* Register a function with the spl provided __autoload queue. If the queue
* is not yet activated it will be activated.
*
* If your code has an existing __autoload function then
* this function must be explicitly registered on the __autoload queue. This
* is because spl_autoload_register will effectively
* replace the engine cache for the __autoload function
* by either spl_autoload or
* spl_autoload_call.
*
* If there must be multiple autoload functions, spl_autoload_register
* allows for this. It effectively creates a queue of autoload functions, and
* runs through each of them in the order they are defined. By contrast,
* __autoload may only be defined once.
*
* @param callable(string):void|null $callback The autoload function being registered.
* If NULL, then the default implementation of
* spl_autoload will be registered.
* @param bool $throw This parameter specifies whether
* spl_autoload_register should throw
* exceptions when the callback
* cannot be registered.
* @param bool $prepend If true, spl_autoload_register will prepend
* the autoloader on the autoload queue instead of appending it.
* @param callable(string):void|null $callback
* @param bool $throw
* @param bool $prepend
* @throws SplException
*
*/
@@ -115,14 +84,7 @@ function spl_autoload_register(?callable $callback = null, bool $throw = true, b
/**
* Removes a function from the autoload queue. If the queue
* is activated and empty after removing the given function then it will
* be deactivated.
*
* When this function results in the queue being deactivated, any
* __autoload function that previously existed will not be reactivated.
*
* @param mixed $callback The autoload function being unregistered.
* @param mixed $callback
* @throws SplException
*
*/

View File

@@ -5,16 +5,7 @@
use Safe\Exceptions\SqlsrvException;
/**
* The transaction begun by sqlsrv_begin_transaction includes
* all statements that were executed after the call to
* sqlsrv_begin_transaction and before calls to
* sqlsrv_rollback or sqlsrv_commit.
* Explicit transactions should be started and committed or rolled back using
* these functions instead of executing SQL statements that begin and commit/roll
* back transactions. For more information, see
* SQLSRV Transactions.
*
* @param resource $conn The connection resource returned by a call to sqlsrv_connect.
* @param resource $conn
* @throws SqlsrvException
*
*/
@@ -29,14 +20,7 @@ function sqlsrv_begin_transaction($conn): void
/**
* Cancels a statement. Any results associated with the statement that have not
* been consumed are deleted. After sqlsrv_cancel has been
* called, the specified statement can be re-executed if it was created with
* sqlsrv_prepare. Calling sqlsrv_cancel
* is not necessary if all the results associated with the statement have been
* consumed.
*
* @param resource $stmt The statement resource to be cancelled.
* @param resource $stmt
* @throws SqlsrvException
*
*/
@@ -51,39 +35,8 @@ function sqlsrv_cancel($stmt): void
/**
* Returns information about the client and specified connection
*
* @param resource $conn The connection about which information is returned.
* @return array Returns an associative array with keys described in the table below.
*
* Array returned by sqlsrv_client_info
*
*
*
* Key
* Description
*
*
*
*
* DriverDllName
* SQLNCLI10.DLL
*
*
* DriverODBCVer
* ODBC version (xx.yy)
*
*
* DriverVer
* SQL Server Native Client DLL version (10.5.xxx)
*
*
* ExtensionVer
* php_sqlsrv.dll version (2.0.xxx.x)
*
*
*
*
* @param resource $conn
* @return array
* @throws SqlsrvException
*
*/
@@ -99,9 +52,7 @@ function sqlsrv_client_info($conn): array
/**
* Closes an open connection and releases resourses associated with the connection.
*
* @param resource $conn The connection to be closed.
* @param resource $conn
* @throws SqlsrvException
*
*/
@@ -116,16 +67,7 @@ function sqlsrv_close($conn): void
/**
* Commits a transaction that was begun with sqlsrv_begin_transaction.
* The connection is returned to auto-commit mode after sqlsrv_commit
* is called. The transaction that is committed includes all statements that were
* executed after the call to sqlsrv_begin_transaction.
* Explicit transactions should be started and committed or rolled back using these
* functions instead of executing SQL statements that begin and commit/roll back
* transactions. For more information, see
* SQLSRV Transactions.
*
* @param resource $conn The connection on which the transaction is to be committed.
* @param resource $conn
* @throws SqlsrvException
*
*/
@@ -140,44 +82,8 @@ function sqlsrv_commit($conn): void
/**
* Changes the driver error handling and logging configurations.
*
* @param string $setting The name of the setting to set. The possible values are
* "WarningsReturnAsErrors", "LogSubsystems", and "LogSeverity".
* @param mixed $value The value of the specified setting. The following table shows possible values:
*
* Error and Logging Setting Options
*
*
*
* Setting
* Options
*
*
*
*
* WarningsReturnAsErrors
* 1 (TRUE) or 0 (FALSE)
*
*
* LogSubsystems
* SQLSRV_LOG_SYSTEM_ALL (-1)
* SQLSRV_LOG_SYSTEM_CONN (2)
* SQLSRV_LOG_SYSTEM_INIT (1)
* SQLSRV_LOG_SYSTEM_OFF (0)
* SQLSRV_LOG_SYSTEM_STMT (4)
* SQLSRV_LOG_SYSTEM_UTIL (8)
*
*
* LogSeverity
* SQLSRV_LOG_SEVERITY_ALL (-1)
* SQLSRV_LOG_SEVERITY_ERROR (1)
* SQLSRV_LOG_SEVERITY_NOTICE (4)
* SQLSRV_LOG_SEVERITY_WARNING (2)
*
*
*
*
* @param string $setting
* @param mixed $value
* @throws SqlsrvException
*
*/
@@ -192,11 +98,7 @@ function sqlsrv_configure(string $setting, $value): void
/**
* Executes a statement prepared with sqlsrv_prepare. This
* function is ideal for executing a prepared statement multiple times with
* different parameter values.
*
* @param resource $stmt A statement resource returned by sqlsrv_prepare.
* @param resource $stmt
* @throws SqlsrvException
*
*/
@@ -211,29 +113,11 @@ function sqlsrv_execute($stmt): void
/**
* Returns the next available row of data as an associative array, a numeric
* array, or both (the default).
*
* @param resource $stmt A statement resource returned by sqlsrv_query or sqlsrv_prepare.
* @param int $fetchType A predefined constant specifying the type of array to return. Possible
* values are SQLSRV_FETCH_ASSOC,
* SQLSRV_FETCH_NUMERIC, and
* SQLSRV_FETCH_BOTH (the default).
*
* A fetch type of SQLSRV_FETCH_ASSOC should not be used when consuming a
* result set with multiple columns of the same name.
* @param int $row Specifies the row to access in a result set that uses a scrollable cursor.
* Possible values are SQLSRV_SCROLL_NEXT,
* SQLSRV_SCROLL_PRIOR, SQLSRV_SCROLL_FIRST,
* SQLSRV_SCROLL_LAST, SQLSRV_SCROLL_ABSOLUTE and,
* SQLSRV_SCROLL_RELATIVE (the default). When this parameter
* is specified, the fetchType must be explicitly defined.
* @param int $offset Specifies the row to be accessed if the row parameter is set to
* SQLSRV_SCROLL_ABSOLUTE or
* SQLSRV_SCROLL_RELATIVE. Note that the first row in
* a result set has index 0.
* @return array|null Returns an array on success, NULL if there are no more rows to return, and
* FALSE if an error occurs.
* @param resource $stmt
* @param int $fetchType
* @param int $row
* @param int $offset
* @return array|null
* @throws SqlsrvException
*
*/
@@ -257,34 +141,12 @@ function sqlsrv_fetch_array($stmt, ?int $fetchType = null, ?int $row = null, ?in
/**
* Retrieves the next row of data in a result set as an instance of the specified
* class with properties that match the row field names and values that correspond
* to the row field values.
*
* @param resource $stmt A statement resource created by sqlsrv_query or
* sqlsrv_execute.
* @param string $className The name of the class to instantiate. If no class name is specified,
* stdClass is instantiated.
* @param array $ctorParams Values passed to the constructor of the specified class. If the constructor
* of the specified class takes parameters, the ctorParams array must be
* supplied.
* @param int $row The row to be accessed. This parameter can only be used if the specified
* statement was prepared with a scrollable cursor. In that case, this parameter
* can take on one of the following values:
*
* SQLSRV_SCROLL_NEXT
* SQLSRV_SCROLL_PRIOR
* SQLSRV_SCROLL_FIRST
* SQLSRV_SCROLL_LAST
* SQLSRV_SCROLL_ABSOLUTE
* SQLSRV_SCROLL_RELATIVE
*
* @param int $offset Specifies the row to be accessed if the row parameter is set to
* SQLSRV_SCROLL_ABSOLUTE or
* SQLSRV_SCROLL_RELATIVE. Note that the first row in
* a result set has index 0.
* @return null|object Returns an object on success, NULL if there are no more rows to return,
* and FALSE if an error occurs or if the specified class does not exist.
* @param resource $stmt
* @param string $className
* @param array $ctorParams
* @param int $row
* @param int $offset
* @return null|object
* @throws SqlsrvException
*
*/
@@ -310,28 +172,10 @@ function sqlsrv_fetch_object($stmt, ?string $className = null, ?array $ctorParam
/**
* Makes the next row in a result set available for reading. Use
* sqlsrv_get_field to read the fields of the row.
*
* @param resource $stmt A statement resource created by executing sqlsrv_query
* or sqlsrv_execute.
* @param int $row The row to be accessed. This parameter can only be used if the specified
* statement was prepared with a scrollable cursor. In that case, this parameter
* can take on one of the following values:
*
* SQLSRV_SCROLL_NEXT
* SQLSRV_SCROLL_PRIOR
* SQLSRV_SCROLL_FIRST
* SQLSRV_SCROLL_LAST
* SQLSRV_SCROLL_ABSOLUTE
* SQLSRV_SCROLL_RELATIVE
*
* @param int $offset Specifies the row to be accessed if the row parameter is set to
* SQLSRV_SCROLL_ABSOLUTE or
* SQLSRV_SCROLL_RELATIVE. Note that the first row in
* a result set has index 0.
* @return bool|null Returns TRUE if the next row of a result set was successfully retrieved,
* FALSE if an error occurs, and NULL if there are no more rows in the result set.
* @param resource $stmt
* @param int $row
* @param int $offset
* @return bool|null
* @throws SqlsrvException
*
*/
@@ -353,15 +197,7 @@ function sqlsrv_fetch($stmt, ?int $row = null, ?int $offset = null): ?bool
/**
* Frees all resources for the specified statement. The statement cannot be used
* after sqlsrv_free_stmt has been called on it. If
* sqlsrv_free_stmt is called on an in-progress statement
* that alters server state, statement execution is terminated and the statement
* is rolled back.
*
* @param resource $stmt The statement for which resources are freed.
* Note that NULL is a valid parameter value. This allows the function to be
* called multiple times in a script.
* @param resource $stmt
* @throws SqlsrvException
*
*/
@@ -376,20 +212,10 @@ function sqlsrv_free_stmt($stmt): void
/**
* Gets field data from the currently selected row. Fields must be accessed in
* order. Field indices start at 0.
*
* @param resource $stmt A statement resource returned by sqlsrv_query or
* sqlsrv_execute.
* @param int $fieldIndex The index of the field to be retrieved. Field indices start at 0. Fields
* must be accessed in order. i.e. If you access field index 1, then field
* index 0 will not be available.
* @param int $getAsType The PHP data type for the returned field data. If this parameter is not
* set, the field data will be returned as its default PHP data type.
* For information about default PHP data types, see
* Default PHP Data Types
* in the Microsoft SQLSRV documentation.
* @return mixed Returns data from the specified field on success.
* @param resource $stmt
* @param int $fieldIndex
* @param int $getAsType
* @return mixed
* @throws SqlsrvException
*
*/
@@ -409,12 +235,8 @@ function sqlsrv_get_field($stmt, int $fieldIndex, ?int $getAsType = null)
/**
* Makes the next result of the specified statement active. Results include result
* sets, row counts, and output parameters.
*
* @param resource $stmt The statement on which the next result is being called.
* @return bool|null Returns TRUE if the next result was successfully retrieved, FALSE if an error
* occurred, and NULL if there are no more results to retrieve.
* @param resource $stmt
* @return bool|null
* @throws SqlsrvException
*
*/
@@ -430,12 +252,8 @@ function sqlsrv_next_result($stmt): ?bool
/**
* Retrieves the number of fields (columns) on a statement.
*
* @param resource $stmt The statement for which the number of fields is returned.
* sqlsrv_num_fields can be called on a statement before
* or after statement execution.
* @return int Returns the number of fields on success.
* @param resource $stmt
* @return int
* @throws SqlsrvException
*
*/
@@ -451,19 +269,8 @@ function sqlsrv_num_fields($stmt): int
/**
* Retrieves the number of rows in a result set. This function requires that the
* statement resource be created with a static or keyset cursor. For more information,
* see sqlsrv_query, sqlsrv_prepare,
* or Specifying a Cursor Type and Selecting Rows
* in the Microsoft SQLSRV documentation.
*
* @param resource $stmt The statement for which the row count is returned. The statement resource
* must be created with a static or keyset cursor. For more information, see
* sqlsrv_query, sqlsrv_prepare, or
* Specifying a Cursor Type and Selecting Rows
* in the Microsoft SQLSRV documentation.
* @return int Returns the number of rows retrieved on success.
* If a forward cursor (the default) or dynamic cursor is used, FALSE is returned.
* @param resource $stmt
* @return int
* @throws SqlsrvException
*
*/
@@ -479,23 +286,11 @@ function sqlsrv_num_rows($stmt): int
/**
* Prepares a query for execution. This function is ideal for preparing a query
* that will be executed multiple times with different parameter values.
*
* @param resource $conn A connection resource returned by sqlsrv_connect.
* @param string $sql The string that defines the query to be prepared and executed.
* @param array $params An array specifying parameter information when executing a parameterized
* query. Array elements can be any of the following:
*
* A literal value
* A PHP variable
* An array with this structure:
* array($value [, $direction [, $phpType [, $sqlType]]])
*
* The following table describes the elements in the array structure above:
* @param array $options An array specifying query property options. The supported keys are described
* in the following table:
* @return mixed Returns a statement resource on success.
* @param resource $conn
* @param string $sql
* @param array $params
* @param array $options
* @return mixed
* @throws SqlsrvException
*
*/
@@ -517,22 +312,11 @@ function sqlsrv_prepare($conn, string $sql, ?array $params = null, ?array $optio
/**
* Prepares and executes a query.
*
* @param resource $conn A connection resource returned by sqlsrv_connect.
* @param string $sql The string that defines the query to be prepared and executed.
* @param array $params An array specifying parameter information when executing a parameterized query.
* Array elements can be any of the following:
*
* A literal value
* A PHP variable
* An array with this structure:
* array($value [, $direction [, $phpType [, $sqlType]]])
*
* The following table describes the elements in the array structure above:
* @param array $options An array specifying query property options. The supported keys are described
* in the following table:
* @return mixed Returns a statement resource on success.
* @param resource $conn
* @param string $sql
* @param array $params
* @param array $options
* @return mixed
* @throws SqlsrvException
*
*/
@@ -554,10 +338,7 @@ function sqlsrv_query($conn, string $sql, ?array $params = null, ?array $options
/**
* Rolls back a transaction that was begun with sqlsrv_begin_transaction
* and returns the connection to auto-commit mode.
*
* @param resource $conn The connection resource returned by a call to sqlsrv_connect.
* @param resource $conn
* @throws SqlsrvException
*
*/

View File

@@ -5,14 +5,9 @@
use Safe\Exceptions\SsdeepException;
/**
* Calculates the match score between signature1
* and signature2 using
* context-triggered piecewise hashing, and returns the match
* score.
*
* @param string $signature1 The first fuzzy hash signature string.
* @param string $signature2 The second fuzzy hash signature string.
* @return int Returns an integer from 0 to 100 on success.
* @param string $signature1
* @param string $signature2
* @return int
* @throws SsdeepException
*
*/
@@ -28,13 +23,8 @@ function ssdeep_fuzzy_compare(string $signature1, string $signature2): int
/**
* ssdeep_fuzzy_hash_filename calculates the hash
* of the file specified by file_name using
* context-triggered piecewise
* hashing, and returns that hash.
*
* @param string $file_name The filename of the file to hash.
* @return string Returns a string on success.
* @param string $file_name
* @return string
* @throws SsdeepException
*
*/
@@ -50,12 +40,8 @@ function ssdeep_fuzzy_hash_filename(string $file_name): string
/**
* ssdeep_fuzzy_hash calculates the hash of
* to_hash using
* context-triggered piecewise hashing, and returns that hash.
*
* @param string $to_hash The input string.
* @return string Returns a string on success.
* @param string $to_hash
* @return string
* @throws SsdeepException
*
*/

View File

@@ -5,11 +5,8 @@
use Safe\Exceptions\Ssh2Exception;
/**
* Authenticate over SSH using the ssh agent
*
* @param resource $session An SSH connection link identifier, obtained from a call to
* ssh2_connect.
* @param string $username Remote user name.
* @param resource $session
* @param string $username
* @throws Ssh2Exception
*
*/
@@ -24,18 +21,13 @@ function ssh2_auth_agent($session, string $username): void
/**
* Authenticate using a public hostkey read from a file.
*
* @param resource $session An SSH connection link identifier, obtained from a call to
* ssh2_connect.
* @param resource $session
* @param string $username
* @param string $hostname
* @param string $pubkeyfile
* @param string $privkeyfile
* @param string $passphrase If privkeyfile is encrypted (which it should
* be), the passphrase must be provided.
* @param string $local_username If local_username is omitted, then the value
* for username will be used for it.
* @param string $passphrase
* @param string $local_username
* @throws Ssh2Exception
*
*/
@@ -56,13 +48,9 @@ function ssh2_auth_hostbased_file($session, string $username, string $hostname,
/**
* Authenticate over SSH using a plain password. Since version 0.12 this function
* also supports keyboard_interactive method.
*
* @param resource $session An SSH connection link identifier, obtained from a call to
* ssh2_connect.
* @param string $username Remote user name.
* @param string $password Password for username
* @param resource $session
* @param string $username
* @param string $password
* @throws Ssh2Exception
*
*/
@@ -77,17 +65,11 @@ function ssh2_auth_password($session, string $username, string $password): void
/**
* Authenticate using a public key read from a file.
*
* @param resource $session An SSH connection link identifier, obtained from a call to
* ssh2_connect.
* @param resource $session
* @param string $username
* @param string $pubkeyfile The public key file needs to be in OpenSSH's format. It should look something like:
*
* ssh-rsa AAAAB3NzaC1yc2EAAA....NX6sqSnHA8= rsa-key-20121110
* @param string $pubkeyfile
* @param string $privkeyfile
* @param string $passphrase If privkeyfile is encrypted (which it should
* be), the passphrase must be provided.
* @param string $passphrase
* @throws Ssh2Exception
*
*/
@@ -106,201 +88,11 @@ function ssh2_auth_pubkey_file($session, string $username, string $pubkeyfile, s
/**
* Establish a connection to a remote SSH server.
*
* Once connected, the client should verify the server's hostkey using
* ssh2_fingerprint, then authenticate using either
* password or public key.
*
* @param string $host
* @param int $port
* @param array $methods methods may be an associative array with up to four parameters
* as described below.
*
*
* methods may be an associative array
* with any or all of the following parameters.
*
*
*
* Index
* Meaning
* Supported Values*
*
*
*
*
* kex
*
* List of key exchange methods to advertise, comma separated
* in order of preference.
*
*
* diffie-hellman-group1-sha1,
* diffie-hellman-group14-sha1, and
* diffie-hellman-group-exchange-sha1
*
*
*
* hostkey
*
* List of hostkey methods to advertise, comma separated
* in order of preference.
*
*
* ssh-rsa and
* ssh-dss
*
*
*
* client_to_server
*
* Associative array containing crypt, compression, and
* message authentication code (MAC) method preferences
* for messages sent from client to server.
*
*
*
*
* server_to_client
*
* Associative array containing crypt, compression, and
* message authentication code (MAC) method preferences
* for messages sent from server to client.
*
*
*
*
*
*
*
* * - Supported Values are dependent on methods supported by underlying library.
* See libssh2 documentation for additional
* information.
*
*
*
* client_to_server and
* server_to_client may be an associative array
* with any or all of the following parameters.
*
*
*
*
* Index
* Meaning
* Supported Values*
*
*
*
*
* crypt
* List of crypto methods to advertise, comma separated
* in order of preference.
*
* rijndael-cbc@lysator.liu.se,
* aes256-cbc,
* aes192-cbc,
* aes128-cbc,
* 3des-cbc,
* blowfish-cbc,
* cast128-cbc,
* arcfour, and
* none**
*
*
*
* comp
* List of compression methods to advertise, comma separated
* in order of preference.
*
* zlib and
* none
*
*
*
* mac
* List of MAC methods to advertise, comma separated
* in order of preference.
*
* hmac-sha1,
* hmac-sha1-96,
* hmac-ripemd160,
* hmac-ripemd160@openssh.com, and
* none**
*
*
*
*
*
*
*
* Crypt and MAC method "none"
*
* For security reasons, none is disabled by the underlying
* libssh2 library unless explicitly enabled
* during build time by using the appropriate ./configure options. See documentation
* for the underlying library for more information.
*
*
*
* For security reasons, none is disabled by the underlying
* libssh2 library unless explicitly enabled
* during build time by using the appropriate ./configure options. See documentation
* for the underlying library for more information.
* @param array $callbacks callbacks may be an associative array with any
* or all of the following parameters.
*
*
* Callbacks parameters
*
*
*
*
* Index
* Meaning
* Prototype
*
*
*
*
* ignore
*
* Name of function to call when an
* SSH2_MSG_IGNORE packet is received
*
* void ignore_cb($message)
*
*
* debug
*
* Name of function to call when an
* SSH2_MSG_DEBUG packet is received
*
* void debug_cb($message, $language, $always_display)
*
*
* macerror
*
* Name of function to call when a packet is received but the
* message authentication code failed. If the callback returns
* TRUE, the mismatch will be ignored, otherwise the connection
* will be terminated.
*
* bool macerror_cb($packet)
*
*
* disconnect
*
* Name of function to call when an
* SSH2_MSG_DISCONNECT packet is received
*
* void disconnect_cb($reason, $message, $language)
*
*
*
*
* @return resource Returns a resource on success.
* @param array $methods
* @param array $callbacks
* @return resource
* @throws Ssh2Exception
*
*/
@@ -322,10 +114,7 @@ function ssh2_connect(string $host, int $port = 22, ?array $methods = null, ?arr
/**
* Close a connection to a remote SSH server.
*
* @param resource $session An SSH connection link identifier, obtained from a call to
* ssh2_connect.
* @param resource $session
* @throws Ssh2Exception
*
*/
@@ -340,20 +129,14 @@ function ssh2_disconnect($session): void
/**
* Execute a command at the remote end and allocate a channel for it.
*
* @param resource $session An SSH connection link identifier, obtained from a call to
* ssh2_connect.
* @param resource $session
* @param string $command
* @param string $pty
* @param array $env env may be passed as an associative array of
* name/value pairs to set in the target environment.
* @param int $width Width of the virtual terminal.
* @param int $height Height of the virtual terminal.
* @param int $width_height_type width_height_type should be one of
* SSH2_TERM_UNIT_CHARS or
* SSH2_TERM_UNIT_PIXELS.
* @return resource Returns a stream on success.
* @param array $env
* @param int $width
* @param int $height
* @param int $width_height_type
* @return resource
* @throws Ssh2Exception
*
*/
@@ -381,10 +164,8 @@ function ssh2_exec($session, string $command, ?string $pty = null, ?array $env =
/**
* Accepts a connection created by a listener.
*
* @param resource $listener An SSH2 Listener resource, obtained from a call to ssh2_forward_listen.
* @return resource Returns a stream resource.
* @param resource $listener
* @return resource
* @throws Ssh2Exception
*
*/
@@ -400,13 +181,11 @@ function ssh2_forward_accept($listener)
/**
* Binds a port on the remote server and listen for connections.
*
* @param resource $session An SSH Session resource, obtained from a call to ssh2_connect.
* @param int $port The port of the remote server.
* @param resource $session
* @param int $port
* @param string $host
* @param int $max_connections
* @return resource Returns an SSH2 Listener.
* @return resource
* @throws Ssh2Exception
*
*/
@@ -428,17 +207,11 @@ function ssh2_forward_listen($session, int $port, ?string $host = null, int $max
/**
*
*
* @param resource $pkey Publickey Subsystem resource created by ssh2_publickey_init.
* @param string $algoname Publickey algorithm (e.g.): ssh-dss, ssh-rsa
* @param string $blob Publickey blob as raw binary data
* @param bool $overwrite If the specified key already exists, should it be overwritten?
* @param array $attributes Associative array of attributes to assign to this public key.
* Refer to ietf-secsh-publickey-subsystem for a list of supported attributes.
* To mark an attribute as mandatory, precede its name with an asterisk.
* If the server is unable to support an attribute marked mandatory,
* it will abort the add process.
* @param resource $pkey
* @param string $algoname
* @param string $blob
* @param bool $overwrite
* @param array $attributes
* @throws Ssh2Exception
*
*/
@@ -457,17 +230,8 @@ function ssh2_publickey_add($pkey, string $algoname, string $blob, bool $overwri
/**
* Request the Publickey subsystem from an already connected SSH2 server.
*
* The publickey subsystem allows an already connected and authenticated
* client to manage the list of authorized public keys stored on the
* target server in an implementation agnostic manner.
* If the remote server does not support the publickey subsystem,
* the ssh2_publickey_init function will return FALSE.
*
* @param resource $session
* @return resource Returns an SSH2 Publickey Subsystem resource for use
* with all other ssh2_publickey_*() methods.
* @return resource
* @throws Ssh2Exception
*
*/
@@ -483,11 +247,9 @@ function ssh2_publickey_init($session)
/**
* Removes an authorized publickey.
*
* @param resource $pkey Publickey Subsystem Resource
* @param string $algoname Publickey algorithm (e.g.): ssh-dss, ssh-rsa
* @param string $blob Publickey blob as raw binary data
* @param resource $pkey
* @param string $algoname
* @param string $blob
* @throws Ssh2Exception
*
*/
@@ -502,12 +264,9 @@ function ssh2_publickey_remove($pkey, string $algoname, string $blob): void
/**
* Copy a file from the remote server to the local filesystem using the SCP protocol.
*
* @param resource $session An SSH connection link identifier, obtained from a call to
* ssh2_connect.
* @param string $remote_file Path to the remote file.
* @param string $local_file Path to the local file.
* @param resource $session
* @param string $remote_file
* @param string $local_file
* @throws Ssh2Exception
*
*/
@@ -522,14 +281,10 @@ function ssh2_scp_recv($session, string $remote_file, string $local_file): void
/**
* Copy a file from the local filesystem to the remote server using the SCP protocol.
*
* @param resource $session An SSH connection link identifier, obtained from a call to
* ssh2_connect.
* @param string $local_file Path to the local file.
* @param string $remote_file Path to the remote file.
* @param int $create_mode The file will be created with the mode specified by
* create_mode.
* @param resource $session
* @param string $local_file
* @param string $remote_file
* @param int $create_mode
* @throws Ssh2Exception
*
*/
@@ -544,13 +299,7 @@ function ssh2_scp_send($session, string $local_file, string $remote_file, int $c
/**
* Sends an EOF to the stream; this is typically used to close standard input,
* while keeping output and error alive. For example, one can send a remote
* process some data over standard input, close it to start processing, and
* still be able to read out the results without creating additional files.
*
* @param resource $channel An SSH stream; can be acquired through functions like ssh2_fetch_stream
* or ssh2_connect.
* @param resource $channel
* @throws Ssh2Exception
*
*/
@@ -565,12 +314,9 @@ function ssh2_send_eof($channel): void
/**
* Attempts to change the mode of the specified file to that given in
* mode.
*
* @param resource $sftp An SSH2 SFTP resource opened by ssh2_sftp.
* @param string $filename Path to the file.
* @param int $mode Permissions on the file. See the chmod for more details on this parameter.
* @param resource $sftp
* @param string $filename
* @param int $mode
* @throws Ssh2Exception
*
*/
@@ -585,18 +331,10 @@ function ssh2_sftp_chmod($sftp, string $filename, int $mode): void
/**
* Creates a directory on the remote file server with permissions set to
* mode.
*
* This function is similar to using mkdir with the
* ssh2.sftp:// wrapper.
*
* @param resource $sftp An SSH2 SFTP resource opened by ssh2_sftp.
* @param string $dirname Path of the new directory.
* @param int $mode Permissions on the new directory.
* The actual mode is affected by the current umask.
* @param bool $recursive If recursive is TRUE any parent directories
* required for dirname will be automatically created as well.
* @param resource $sftp
* @param string $dirname
* @param int $mode
* @param bool $recursive
* @throws Ssh2Exception
*
*/
@@ -611,11 +349,9 @@ function ssh2_sftp_mkdir($sftp, string $dirname, int $mode = 0777, bool $recursi
/**
* Renames a file on the remote filesystem.
*
* @param resource $sftp An SSH2 SFTP resource opened by ssh2_sftp.
* @param string $from The current file that is being renamed.
* @param string $to The new file name that replaces from.
* @param resource $sftp
* @param string $from
* @param string $to
* @throws Ssh2Exception
*
*/
@@ -630,12 +366,7 @@ function ssh2_sftp_rename($sftp, string $from, string $to): void
/**
* Removes a directory from the remote file server.
*
* This function is similar to using rmdir with the
* ssh2.sftp:// wrapper.
*
* @param resource $sftp An SSH2 SFTP resource opened by ssh2_sftp.
* @param resource $sftp
* @param string $dirname
* @throws Ssh2Exception
*
@@ -651,11 +382,8 @@ function ssh2_sftp_rmdir($sftp, string $dirname): void
/**
* Creates a symbolic link named link on the remote
* filesystem pointing to target.
*
* @param resource $sftp An SSH2 SFTP resource opened by ssh2_sftp.
* @param string $target Target of the symbolic link.
* @param resource $sftp
* @param string $target
* @param string $link
* @throws Ssh2Exception
*
@@ -671,9 +399,7 @@ function ssh2_sftp_symlink($sftp, string $target, string $link): void
/**
* Deletes a file on the remote filesystem.
*
* @param resource $sftp An SSH2 SFTP resource opened by ssh2_sftp.
* @param resource $sftp
* @param string $filename
* @throws Ssh2Exception
*
@@ -689,13 +415,8 @@ function ssh2_sftp_unlink($sftp, string $filename): void
/**
* Request the SFTP subsystem from an already connected SSH2 server.
*
* @param resource $session An SSH connection link identifier, obtained from a call to
* ssh2_connect.
* @return resource This method returns an SSH2 SFTP resource for use with
* all other ssh2_sftp_*() methods and the
* ssh2.sftp:// fopen wrapper.
* @param resource $session
* @return resource
* @throws Ssh2Exception
*
*/
@@ -711,20 +432,13 @@ function ssh2_sftp($session)
/**
* Open a shell at the remote end and allocate a stream for it.
*
* @param resource $session An SSH connection link identifier, obtained from a call to
* ssh2_connect.
* @param string $term_type term_type should correspond to one of the
* entries in the target system's /etc/termcap file.
* @param array|null $env env may be passed as an associative array of
* name/value pairs to set in the target environment.
* @param int $width Width of the virtual terminal.
* @param int $height Height of the virtual terminal.
* @param int $width_height_type width_height_type should be one of
* SSH2_TERM_UNIT_CHARS or
* SSH2_TERM_UNIT_PIXELS.
* @return resource Returns a stream resource on success.
* @param resource $session
* @param string $term_type
* @param array|null $env
* @param int $width
* @param int $height
* @param int $width_height_type
* @return resource
* @throws Ssh2Exception
*
*/

View File

@@ -5,11 +5,8 @@
use Safe\Exceptions\StreamException;
/**
* Sets parameters on the specified context.
*
* @param resource $context The stream or context to apply the parameters too.
* @param array $params An associative array of parameters to be set in the following format:
* $params['paramname'] = "paramvalue";.
* @param resource $context
* @param array $params
* @throws StreamException
*
*/
@@ -24,18 +21,11 @@ function stream_context_set_params($context, array $params): void
/**
* Makes a copy of up to length bytes
* of data from the current position (or from the
* offset position, if specified) in
* from to to. If
* length is NULL, all remaining content in
* from will be copied.
*
* @param resource $from The source stream
* @param resource $to The destination stream
* @param int|null $length Maximum bytes to copy. By default all bytes left are copied.
* @param int $offset The offset where to start to copy data
* @return int Returns the total count of bytes copied.
* @param resource $from
* @param resource $to
* @param int|null $length
* @param int $offset
* @return int
* @throws StreamException
*
*/
@@ -57,33 +47,11 @@ function stream_copy_to_stream($from, $to, ?int $length = null, int $offset = 0)
/**
* Adds filtername to the list of filters
* attached to stream.
*
* @param resource $stream The target stream.
* @param string $filtername The filter name.
* @param int $read_write By default, stream_filter_append will
* attach the filter to the read filter chain
* if the file was opened for reading (i.e. File Mode:
* r, and/or +). The filter
* will also be attached to the write filter chain
* if the file was opened for writing (i.e. File Mode:
* w, a, and/or +).
* STREAM_FILTER_READ,
* STREAM_FILTER_WRITE, and/or
* STREAM_FILTER_ALL can also be passed to the
* read_write parameter to override this behavior.
* @param mixed $params This filter will be added with the specified
* params to the end of
* the list and will therefore be called last during stream operations.
* To add a filter to the beginning of the list, use
* stream_filter_prepend.
* @return resource Returns a resource on success. The resource can be
* used to refer to this filter instance during a call to
* stream_filter_remove.
*
* FALSE is returned if stream is not a resource or
* if filtername cannot be located.
* @param resource $stream
* @param string $filtername
* @param int $read_write
* @param mixed $params
* @return resource
* @throws StreamException
*
*/
@@ -105,34 +73,11 @@ function stream_filter_append($stream, string $filtername, ?int $read_write = nu
/**
* Adds filtername to the list of filters
* attached to stream.
*
* @param resource $stream The target stream.
* @param string $filtername The filter name.
* @param int $read_write By default, stream_filter_prepend will
* attach the filter to the read filter chain
* if the file was opened for reading (i.e. File Mode:
* r, and/or +). The filter
* will also be attached to the write filter chain
* if the file was opened for writing (i.e. File Mode:
* w, a, and/or +).
* STREAM_FILTER_READ,
* STREAM_FILTER_WRITE, and/or
* STREAM_FILTER_ALL can also be passed to the
* read_write parameter to override this behavior.
* See stream_filter_append for an example of
* using this parameter.
* @param mixed $params This filter will be added with the specified params
* to the beginning of the list and will therefore be
* called first during stream operations. To add a filter to the end of the
* list, use stream_filter_append.
* @return resource Returns a resource on success. The resource can be
* used to refer to this filter instance during a call to
* stream_filter_remove.
*
* FALSE is returned if stream is not a resource or
* if filtername cannot be located.
* @param resource $stream
* @param string $filtername
* @param int $read_write
* @param mixed $params
* @return resource
* @throws StreamException
*
*/
@@ -154,20 +99,8 @@ function stream_filter_prepend($stream, string $filtername, ?int $read_write = n
/**
* stream_filter_register allows you to implement
* your own filter on any registered stream used with all the other
* filesystem functions (such as fopen,
* fread etc.).
*
* @param string $filter_name The filter name to be registered.
* @param string $class To implement a filter, you need to define a class as an extension of
* php_user_filter with a number of member
* functions. When performing read/write operations on the stream
* to which your filter is attached, PHP will pass the data through your
* filter (and any other filters attached to that stream) so that the
* data may be modified as desired. You must implement the methods
* exactly as described in php_user_filter - doing
* otherwise will lead to undefined behaviour.
* @param string $filter_name
* @param string $class
* @throws StreamException
*
*/
@@ -182,13 +115,7 @@ function stream_filter_register(string $filter_name, string $class): void
/**
* Removes a stream filter previously added to a stream with
* stream_filter_prepend or
* stream_filter_append. Any data remaining in the
* filter's internal buffer will be flushed through to the next filter before
* removing it.
*
* @param resource $stream_filter The stream filter to be removed.
* @param resource $stream_filter
* @throws StreamException
*
*/
@@ -203,18 +130,10 @@ function stream_filter_remove($stream_filter): void
/**
* Identical to file_get_contents, except that
* stream_get_contents operates on an already open
* stream resource and returns the remaining contents in a string, up to
* maxlength bytes and starting at the specified
* offset.
*
* @param resource $handle A stream resource (e.g. returned from fopen)
* @param int $maxlength The maximum bytes to read. Defaults to -1 (read all the remaining
* buffer).
* @param int $offset Seek to the specified offset before reading. If this number is negative,
* no seeking will occur and reading will start from the current position.
* @return string Returns a string.
* @param resource $handle
* @param int $maxlength
* @param int $offset
* @return string
* @throws StreamException
*
*/
@@ -230,27 +149,10 @@ function stream_get_contents($handle, int $maxlength = -1, int $offset = -1): st
/**
* Gets a line from the given handle.
*
* Reading ends when length bytes have been read, when
* the non-empty string specified by ending is found (which is
* not included in the return value), or on EOF
* (whichever comes first).
*
* This function is nearly identical to fgets except in
* that it allows end of line delimiters other than the standard \n, \r, and
* \r\n, and does not return the delimiter itself.
*
* @param resource $handle A valid file handle.
* @param int $length The maximum number of bytes to read from the handle.
* Negative values are not supported.
* Zero (0) means the default socket chunk size,
* i.e. 8192 bytes.
* @param string $ending An optional string delimiter.
* @return string Returns a string of up to length bytes read from the file
* pointed to by handle.
*
* If an error occurs, returns FALSE.
* @param resource $handle
* @param int $length
* @param string $ending
* @return string
* @throws StreamException
*
*/
@@ -266,9 +168,6 @@ function stream_get_line($handle, int $length, string $ending = ""): string
/**
* Determines if stream stream refers to a valid terminal type device.
* This is a more portable version of posix_isatty, since it works on Windows systems too.
*
* @param resource $stream
* @throws StreamException
*
@@ -284,10 +183,8 @@ function stream_isatty($stream): void
/**
* Resolve filename against the include path according to the same rules as fopen/include.
*
* @param string $filename The filename to resolve.
* @return string Returns a string containing the resolved absolute filename.
* @param string $filename
* @return string
* @throws StreamException
*
*/
@@ -303,20 +200,8 @@ function stream_resolve_include_path(string $filename): string
/**
* Sets blocking or non-blocking mode on a stream.
*
* This function works for any stream that supports non-blocking mode
* (currently, regular files and socket streams).
*
* @param resource $stream The stream.
* @param bool $enable If enable is FALSE, the given stream
* will be switched to non-blocking mode, and if TRUE, it
* will be switched to blocking mode. This affects calls like
* fgets and fread
* that read from the stream. In non-blocking mode an
* fgets call will always return right away
* while in blocking mode it will wait for data to become available
* on the stream.
* @param resource $stream
* @param bool $enable
* @throws StreamException
*
*/
@@ -331,17 +216,9 @@ function stream_set_blocking($stream, bool $enable): void
/**
* Sets the timeout value on stream,
* expressed in the sum of seconds and
* microseconds.
*
* When the stream times out, the 'timed_out' key of the array returned by
* stream_get_meta_data is set to TRUE, although no
* error/warning is generated.
*
* @param resource $stream The target stream.
* @param int $seconds The seconds part of the timeout to be set.
* @param int $microseconds The microseconds part of the timeout to be set.
* @param resource $stream
* @param int $seconds
* @param int $microseconds
* @throws StreamException
*
*/
@@ -356,18 +233,10 @@ function stream_set_timeout($stream, int $seconds, int $microseconds = 0): void
/**
* Accept a connection on a socket previously created by
* stream_socket_server.
*
* @param resource $server_socket The server socket to accept a connection from.
* @param float $timeout Override the default socket accept timeout. Time should be given in
* seconds.
* @param null|string $peername Will be set to the name (address) of the client which connected, if
* included and available from the selected transport.
*
* Can also be determined later using
* stream_socket_get_name.
* @return resource Returns a stream to the accepted socket connection.
* @param resource $server_socket
* @param float $timeout
* @param null|string $peername
* @return resource
* @throws StreamException
*
*/
@@ -389,51 +258,13 @@ function stream_socket_accept($server_socket, ?float $timeout = null, ?string &$
/**
* Initiates a stream or datagram connection to the destination specified
* by remote_socket. The type of socket created
* is determined by the transport specified using standard URL formatting:
* transport://target. For Internet Domain sockets
* (AF_INET) such as TCP and UDP, the target portion
* of the remote_socket parameter should consist of
* a hostname or IP address followed by a colon and a port number. For Unix
* domain sockets, the target portion should point
* to the socket file on the filesystem.
*
* @param string $remote_socket Address to the socket to connect to.
* @param int|null $errno Will be set to the system level error number if connection fails.
* @param null|string $errstr Will be set to the system level error message if the connection fails.
* @param float $timeout Number of seconds until the connect() system call
* should timeout.
*
*
* This parameter only applies when not making asynchronous
* connection attempts.
*
*
*
*
* To set a timeout for reading/writing data over the socket, use the
* stream_set_timeout, as the
* timeout only applies while making connecting
* the socket.
*
*
*
* To set a timeout for reading/writing data over the socket, use the
* stream_set_timeout, as the
* timeout only applies while making connecting
* the socket.
* @param int-mask $flags Bitmask field which may be set to any combination of connection flags.
* Currently the select of connection flags is limited to
* STREAM_CLIENT_CONNECT (default),
* STREAM_CLIENT_ASYNC_CONNECT and
* STREAM_CLIENT_PERSISTENT.
* @param resource $context A valid context resource created with stream_context_create.
* @return resource On success a stream resource is returned which may
* be used together with the other file functions (such as
* fgets, fgetss,
* fwrite, fclose, and
* feof).
* @param string $remote_socket
* @param int|null $errno
* @param null|string $errstr
* @param float $timeout
* @param int-mask $flags
* @param resource $context
* @return resource
* @throws StreamException
*
*/
@@ -457,12 +288,9 @@ function stream_socket_client(string $remote_socket, ?int &$errno = null, ?strin
/**
* Returns the local or remote name of a given socket connection.
*
* @param resource $handle The socket to get the name of.
* @param bool $want_peer If set to TRUE the remote socket name will be returned, if set
* to FALSE the local socket name will be returned.
* @return string The name of the socket.
* @param resource $handle
* @param bool $want_peer
* @return string
* @throws StreamException
*
*/
@@ -478,25 +306,10 @@ function stream_socket_get_name($handle, bool $want_peer): string
/**
* stream_socket_pair creates a pair of connected,
* indistinguishable socket streams. This function is commonly used in IPC
* (Inter-Process Communication).
*
* @param int $domain The protocol family to be used: STREAM_PF_INET,
* STREAM_PF_INET6 or
* STREAM_PF_UNIX
* @param int $type The type of communication to be used:
* STREAM_SOCK_DGRAM,
* STREAM_SOCK_RAW,
* STREAM_SOCK_RDM,
* STREAM_SOCK_SEQPACKET or
* STREAM_SOCK_STREAM
* @param int $protocol The protocol to be used: STREAM_IPPROTO_ICMP,
* STREAM_IPPROTO_IP,
* STREAM_IPPROTO_RAW,
* STREAM_IPPROTO_TCP or
* STREAM_IPPROTO_UDP
* @return resource[] Returns an array with the two socket resources on success.
* @param int $domain
* @param int $type
* @param int $protocol
* @return resource[]
* @throws StreamException
*
*/
@@ -512,44 +325,12 @@ function stream_socket_pair(int $domain, int $type, int $protocol): array
/**
* Creates a stream or datagram socket on the specified
* local_socket.
*
* This function only creates a socket, to begin accepting connections
* use stream_socket_accept.
*
* @param string $local_socket The type of socket created is determined by the transport specified
* using standard URL formatting: transport://target.
*
* For Internet Domain sockets (AF_INET) such as TCP and UDP, the
* target portion of the
* remote_socket parameter should consist of a
* hostname or IP address followed by a colon and a port number. For
* Unix domain sockets, the target portion should
* point to the socket file on the filesystem.
*
* Depending on the environment, Unix domain sockets may not be available.
* A list of available transports can be retrieved using
* stream_get_transports. See
* for a list of bulitin transports.
* @param int|null $errno If the optional errno and errstr
* arguments are present they will be set to indicate the actual system
* level error that occurred in the system-level socket(),
* bind(), and listen() calls. If
* the value returned in errno is
* 0 and the function returned FALSE, it is an
* indication that the error occurred before the bind()
* call. This is most likely due to a problem initializing the socket.
* Note that the errno and
* errstr arguments will always be passed by reference.
* @param null|string $errstr See errno description.
* @param int $flags A bitmask field which may be set to any combination of socket creation
* flags.
*
* For UDP sockets, you must use STREAM_SERVER_BIND as
* the flags parameter.
* @param string $local_socket
* @param int|null $errno
* @param null|string $errstr
* @param int $flags
* @param resource $context
* @return resource Returns the created stream.
* @return resource
* @throws StreamException
*
*/
@@ -569,15 +350,8 @@ function stream_socket_server(string $local_socket, ?int &$errno = null, ?string
/**
* Shutdowns (partially or not) a full-duplex connection.
*
* @param resource $stream An open stream (opened with stream_socket_client,
* for example)
* @param int $mode One of the following constants: STREAM_SHUT_RD
* (disable further receptions), STREAM_SHUT_WR
* (disable further transmissions) or
* STREAM_SHUT_RDWR (disable further receptions and
* transmissions).
* @param resource $stream
* @param int $mode
* @throws StreamException
*
*/
@@ -592,10 +366,7 @@ function stream_socket_shutdown($stream, int $mode): void
/**
* Tells whether the stream supports locking through
* flock.
*
* @param resource $stream The stream to check.
* @param resource $stream
* @throws StreamException
*
*/
@@ -610,16 +381,9 @@ function stream_supports_lock($stream): void
/**
* Allows you to implement your own protocol handlers and streams for use
* with all the other filesystem functions (such as fopen,
* fread etc.).
*
* @param string $protocol The wrapper name to be registered.
* Valid protocol names must contain alphanumerics, dots (.), plusses (+), or hyphens (-) only.
* @param string $class The classname which implements the protocol.
* @param int $flags Should be set to STREAM_IS_URL if
* protocol is a URL protocol. Default is 0, local
* stream.
* @param string $protocol
* @param string $class
* @param int $flags
* @throws StreamException
*
*/
@@ -634,9 +398,6 @@ function stream_wrapper_register(string $protocol, string $class, int $flags = 0
/**
* Restores a built-in wrapper previously unregistered with
* stream_wrapper_unregister.
*
* @param string $protocol
* @throws StreamException
*
@@ -652,11 +413,6 @@ function stream_wrapper_restore(string $protocol): void
/**
* Allows you to disable an already defined stream wrapper. Once the wrapper
* has been disabled you may override it with a user-defined wrapper using
* stream_wrapper_register or reenable it later on with
* stream_wrapper_restore.
*
* @param string $protocol
* @throws StreamException
*

View File

@@ -5,10 +5,8 @@
use Safe\Exceptions\StringsException;
/**
* convert_uudecode decodes a uuencoded string.
*
* @param string $string The uuencoded data.
* @return string Returns the decoded data as a string.
* @param string $string
* @return string
* @throws StringsException
*
*/
@@ -24,10 +22,8 @@ function convert_uudecode(string $string): string
/**
* Decodes a hexadecimally encoded binary string.
*
* @param string $string Hexadecimal representation of data.
* @return string Returns the binary representation of the given data.
* @param string $string
* @return string
* @throws StringsException
*
*/
@@ -43,16 +39,9 @@ function hex2bin(string $string): string
/**
* Calculates the MD5 hash of the file specified by the
* filename parameter using the
* RSA Data Security, Inc.
* MD5 Message-Digest Algorithm, and returns that hash.
* The hash is a 32-character hexadecimal number.
*
* @param string $filename The filename
* @param bool $binary When TRUE, returns the digest in raw binary format with a length of
* 16.
* @return non-falsy-string&lowercase-string Returns a string on success.
* @param string $filename
* @param bool $binary
* @return non-falsy-string&lowercase-string
* @throws StringsException
*
*/
@@ -68,12 +57,9 @@ function md5_file(string $filename, bool $binary = false): string
/**
*
*
* @param string $filename The filename of the file to hash.
* @param bool $binary When TRUE, returns the digest in raw binary format with a length of
* 20.
* @return non-falsy-string&lowercase-string Returns a string on success.
* @param string $filename
* @param bool $binary
* @return non-falsy-string&lowercase-string
* @throws StringsException
*
*/

View File

@@ -5,12 +5,8 @@
use Safe\Exceptions\SwooleException;
/**
*
*
* @param string $hostname The host name.
* @param callable $callback The host name.
*
* The IP address.
* @param string $hostname
* @param callable $callback
* @throws SwooleException
*
*/
@@ -25,12 +21,8 @@ function swoole_async_dns_lookup(string $hostname, callable $callback): void
/**
*
*
* @param string $filename The filename of the file being read.
* @param string $callback The name of the file.
*
* The content read from the file.
* @param string $filename
* @param string $callback
* @throws SwooleException
*
*/
@@ -45,11 +37,9 @@ function swoole_async_readfile(string $filename, string $callback): void
/**
*
*
* @param string $filename The filename being written.
* @param string $content The content writing to the file.
* @param int $offset The offset.
* @param string $filename
* @param string $content
* @param int $offset
* @param callable $callback
* @throws SwooleException
*
@@ -71,10 +61,8 @@ function swoole_async_write(string $filename, string $content, ?int $offset = nu
/**
*
*
* @param string $filename The filename being written.
* @param string $content The content writing to the file.
* @param string $filename
* @param string $content
* @param callable $callback
* @param int $flags
* @throws SwooleException
@@ -97,8 +85,6 @@ function swoole_async_writefile(string $filename, string $content, ?callable $ca
/**
*
*
* @param callable $callback
* @throws SwooleException
*
@@ -114,8 +100,6 @@ function swoole_event_defer(callable $callback): void
/**
*
*
* @param int $fd
* @throws SwooleException
*
@@ -131,8 +115,6 @@ function swoole_event_del(int $fd): void
/**
*
*
* @param int $fd
* @param string $data
* @throws SwooleException

File diff suppressed because it is too large Load Diff

View File

@@ -5,10 +5,8 @@
use Safe\Exceptions\UopzException;
/**
* Makes class extend parent
*
* @param string $class The name of the class to extend
* @param string $parent The name of the class to inherit
* @param string $class
* @param string $parent
* @throws UopzException
*
*/
@@ -23,8 +21,6 @@ function uopz_extend(string $class, string $parent): void
/**
* Makes class implement interface
*
* @param string $class
* @param string $interface
* @throws UopzException

View File

@@ -5,15 +5,9 @@
use Safe\Exceptions\UrlException;
/**
* Decodes a base64 encoded string.
*
* @param string $string The encoded data.
* @param bool $strict If the strict parameter is set to TRUE
* then the base64_decode function will return
* FALSE if the input contains character from outside the base64
* alphabet. Otherwise invalid characters will be silently discarded.
* @return string Returns the decoded data. The returned data may be
* binary.
* @param string $string
* @param bool $strict
* @return string
* @throws UrlException
*
*/
@@ -29,16 +23,10 @@ function base64_decode(string $string, bool $strict = false): string
/**
* get_headers returns an array with the headers sent
* by the server in response to a HTTP request.
*
* @param string $url The target URL.
* @param bool $associative If the optional associative parameter is set to true,
* get_headers parses the response and sets the
* array's keys.
* @param null|resource $context A valid context resource created with
* stream_context_create.
* @return array Returns an indexed or associative array with the headers.
* @param string $url
* @param bool $associative
* @param null|resource $context
* @return array
* @throws UrlException
*
*/
@@ -58,40 +46,9 @@ function get_headers(string $url, bool $associative = false, $context = null): a
/**
* Opens filename and parses it line by line for
* <meta> tags in the file. The parsing stops at
* </head>.
*
* @param string $filename The path to the HTML file, as a string. This can be a local file or an
* URL.
*
*
* What get_meta_tags parses
*
*
*
*
*
*
* ]]>
*
*
* (pay attention to line endings - PHP uses a native function to
* parse the input, so a Mac file won't work on Unix).
* @param bool $use_include_path Setting use_include_path to TRUE will result
* in PHP trying to open the file along the standard include path as per
* the include_path directive.
* This is used for local files, not URLs.
* @return array Returns an array with all the parsed meta tags.
*
* The value of the name property becomes the key, the value of the content
* property becomes the value of the returned array, so you can easily use
* standard array functions to traverse it or access single values.
* Special characters in the value of the name property are substituted with
* '_', the rest is converted to lower case. If two meta tags have the same
* name, only the last one is returned.
*
* Returns FALSE on failure.
* @param string $filename
* @param bool $use_include_path
* @return array
* @throws UrlException
*
*/
@@ -107,90 +64,9 @@ function get_meta_tags(string $filename, bool $use_include_path = false): array
/**
* This function parses a URL and returns an associative array containing any
* of the various components of the URL that are present.
* The values of the array elements are not URL decoded.
*
* This function is not meant to validate
* the given URL, it only breaks it up into the above listed parts. Partial and invalid
* URLs are also accepted, parse_url tries its best to
* parse them correctly.
*
* @param string $url The URL to parse.
* @param int $component Specify one of PHP_URL_SCHEME,
* PHP_URL_HOST, PHP_URL_PORT,
* PHP_URL_USER, PHP_URL_PASS,
* PHP_URL_PATH, PHP_URL_QUERY
* or PHP_URL_FRAGMENT to retrieve just a specific
* URL component as a string (except when
* PHP_URL_PORT is given, in which case the return
* value will be an int).
* @return array|int|null|string On seriously malformed URLs, parse_url.
*
* If the component parameter is omitted, an
* associative array is returned. At least one element will be
* present within the array. Potential keys within this array are:
*
*
*
* scheme - e.g. http
*
*
*
*
* host
*
*
*
*
* port
*
*
*
*
* user
*
*
*
*
* pass
*
*
*
*
* path
*
*
*
*
* query - after the question mark ?
*
*
*
*
* fragment - after the hashmark #
*
*
*
*
* If the component parameter is specified,
* parse_url returns a string (or an
* int, in the case of PHP_URL_PORT)
* instead of an array. If the requested component doesn't exist
* within the given URL, NULL will be returned.
* As of PHP 8.0.0, parse_url distinguishes absent and empty
* queries and fragments:
*
*
*
*
*
*
*
* Previously all cases resulted in query and fragment being NULL.
*
* Note that control characters (cf. ctype_cntrl) in the
* components are replaced with underscores (_).
* @param string $url
* @param int $component
* @return array|int|null|string
* @throws UrlException
*
*/

View File

@@ -5,48 +5,8 @@
use Safe\Exceptions\VarException;
/**
* Set the type of variable var to
* type.
*
* @param mixed $var The variable being converted.
* @param string $type Possibles values of type are:
*
*
*
* "boolean" or "bool"
*
*
*
*
* "integer" or "int"
*
*
*
*
* "float" or "double"
*
*
*
*
* "string"
*
*
*
*
* "array"
*
*
*
*
* "object"
*
*
*
*
* "null"
*
*
*
* @param mixed $var
* @param string $type
* @throws VarException
*
*/

View File

@@ -5,14 +5,9 @@
use Safe\Exceptions\XdiffException;
/**
* Makes a binary diff of two files and stores the result in a patch file.
* This function works with both text and binary files. Resulting patch
* file can be later applied using xdiff_file_bpatch/xdiff_string_bpatch.
*
* @param string $old_file Path to the first file. This file acts as "old" file.
* @param string $new_file Path to the second file. This file acts as "new" file.
* @param string $dest Path of the resulting patch file. Resulting file contains differences
* between "old" and "new" files. It is in binary format and is human-unreadable.
* @param string $old_file
* @param string $new_file
* @param string $dest
* @throws XdiffException
*
*/
@@ -27,14 +22,9 @@ function xdiff_file_bdiff(string $old_file, string $new_file, string $dest): voi
/**
* Patches a file with a binary
* patch and stores the result in a file dest.
* This function accepts patches created both via xdiff_file_bdiff
* and xdiff_file_rabdiff functions or their string counterparts.
*
* @param string $file The original file.
* @param string $patch The binary patch file.
* @param string $dest Path of the resulting file.
* @param string $file
* @param string $patch
* @param string $dest
* @throws XdiffException
*
*/
@@ -49,16 +39,9 @@ function xdiff_file_bpatch(string $file, string $patch, string $dest): void
/**
* Makes a binary diff of two files and stores the result in a patch file.
* This function works with both text and binary files. Resulting patch
* file can be later applied using xdiff_file_bpatch.
*
* Starting with version 1.5.0 this function is an alias of xdiff_file_bdiff.
*
* @param string $old_file Path to the first file. This file acts as "old" file.
* @param string $new_file Path to the second file. This file acts as "new" file.
* @param string $dest Path of the resulting patch file. Resulting file contains differences
* between "old" and "new" files. It is in binary format and is human-unreadable.
* @param string $old_file
* @param string $new_file
* @param string $dest
* @throws XdiffException
*
*/
@@ -73,20 +56,11 @@ function xdiff_file_diff_binary(string $old_file, string $new_file, string $dest
/**
* Makes an unified diff containing differences between old_file and
* new_file and stores it in dest file. The
* resulting file is human-readable. An optional context parameter
* specifies how many lines of context should be added around each change.
* Setting minimal parameter to true will result in outputting the shortest
* patch file possible (can take a long time).
*
* @param string $old_file Path to the first file. This file acts as "old" file.
* @param string $new_file Path to the second file. This file acts as "new" file.
* @param string $dest Path of the resulting patch file.
* @param int $context Indicates how many lines of context you want to include in diff
* result.
* @param bool $minimal Set this parameter to TRUE if you want to minimalize size of the result
* (can take a long time).
* @param string $old_file
* @param string $new_file
* @param string $dest
* @param int $context
* @param bool $minimal
* @throws XdiffException
*
*/
@@ -101,16 +75,9 @@ function xdiff_file_diff(string $old_file, string $new_file, string $dest, int $
/**
* Patches a file with a binary
* patch and stores the result in a file dest.
* This function accepts patches created both via xdiff_file_bdiff
* or xdiff_file_rabdiff functions or their string counterparts.
*
* Starting with version 1.5.0 this function is an alias of xdiff_file_bpatch.
*
* @param string $file The original file.
* @param string $patch The binary patch file.
* @param string $dest Path of the resulting file.
* @param string $file
* @param string $patch
* @param string $dest
* @throws XdiffException
*
*/
@@ -125,19 +92,9 @@ function xdiff_file_patch_binary(string $file, string $patch, string $dest): voi
/**
* Makes a binary diff of two files and stores the result in a patch file.
* The difference between this function and xdiff_file_bdiff is different
* algorithm used which should result in faster execution and smaller diff produced.
* This function works with both text and binary files. Resulting patch
* file can be later applied using xdiff_file_bpatch/xdiff_string_bpatch.
*
* For more details about differences between algorithm used please check libxdiff
* website.
*
* @param string $old_file Path to the first file. This file acts as "old" file.
* @param string $new_file Path to the second file. This file acts as "new" file.
* @param string $dest Path of the resulting patch file. Resulting file contains differences
* between "old" and "new" files. It is in binary format and is human-unreadable.
* @param string $old_file
* @param string $new_file
* @param string $dest
* @throws XdiffException
*
*/
@@ -152,13 +109,9 @@ function xdiff_file_rabdiff(string $old_file, string $new_file, string $dest): v
/**
* Patches a string str with a binary patch.
* This function accepts patches created both via xdiff_string_bdiff
* and xdiff_string_rabdiff functions or their file counterparts.
*
* @param string $str The original binary string.
* @param string $patch The binary patch string.
* @return string Returns the patched string.
* @param string $str
* @param string $patch
* @return string
* @throws XdiffException
*
*/
@@ -174,15 +127,9 @@ function xdiff_string_bpatch(string $str, string $patch): string
/**
* Patches a string str with a binary patch.
* This function accepts patches created both via xdiff_string_bdiff
* and xdiff_string_rabdiff functions or their file counterparts.
*
* Starting with version 1.5.0 this function is an alias of xdiff_string_bpatch.
*
* @param string $str The original binary string.
* @param string $patch The binary patch string.
* @return string Returns the patched string.
* @param string $str
* @param string $patch
* @return string
* @throws XdiffException
*
*/
@@ -198,24 +145,11 @@ function xdiff_string_patch_binary(string $str, string $patch): string
/**
* Patches a str string with an unified patch in patch parameter
* and returns the result. patch has to be an unified diff created by
* xdiff_file_diff/xdiff_string_diff function.
* An optional flags parameter specifies mode of operation. Any
* rejected parts of the patch will be stored inside error variable if
* it is provided.
*
* @param string $str The original string.
* @param string $patch The unified patch string. It has to be created using xdiff_string_diff,
* xdiff_file_diff functions or compatible tools.
* @param int $flags flags can be either
* XDIFF_PATCH_NORMAL (default mode, normal patch)
* or XDIFF_PATCH_REVERSE (reversed patch).
*
* Starting from version 1.5.0, you can also use binary OR to enable
* XDIFF_PATCH_IGNORESPACE flag.
* @param null|string $error If provided then rejected parts are stored inside this variable.
* @return string Returns the patched string.
* @param string $str
* @param string $patch
* @param int $flags
* @param null|string $error
* @return string
* @throws XdiffException
*
*/

View File

@@ -5,8 +5,6 @@
use Safe\Exceptions\XmlException;
/**
* Frees the given XML parser.
*
* @param \XMLParser $parser
* @throws XmlException
*
@@ -22,48 +20,8 @@ function xml_parser_free(\XMLParser $parser): void
/**
* Sets the character data handler function for the XML parser
* parser.
*
* @param \XMLParser $parser A reference to the XML parser to set up character data handler function.
* @param callable $handler handler is a string containing the name of a
* function that must exist when xml_parse is called
* for parser.
*
* The function named by handler must accept
* two parameters:
*
* handler
* XMLParserparser
* stringdata
*
*
*
* parser
*
*
* The first parameter, parser, is a
* reference to the XML parser calling the handler.
*
*
*
*
* data
*
*
* The second parameter, data, contains
* the character data as a string.
*
*
*
*
*
* Character data handler is called for every piece of a text in the XML
* document. It can be called multiple times inside each fragment (e.g.
* for non-ASCII strings).
*
* If a handler function is set to an empty string, or FALSE, the handler
* in question is disabled.
* @param \XMLParser $parser
* @param callable $handler
* @throws XmlException
*
*/
@@ -78,50 +36,8 @@ function xml_set_character_data_handler(\XMLParser $parser, callable $handler):
/**
* Sets the default handler function for the XML parser
* parser.
*
* @param \XMLParser $parser A reference to the XML parser to set up default handler function.
* @param callable $handler handler is a string containing the name of a
* function that must exist when xml_parse is called
* for parser.
*
* The function named by handler must accept
* two parameters:
*
* handler
* XMLParserparser
* stringdata
*
*
*
*
* parser
*
*
*
* The first parameter, parser, is a
* reference to the XML parser calling the handler.
*
*
*
*
*
* data
*
*
*
* The second parameter, data, contains
* the character data.This may be the XML declaration,
* document type declaration, entities or other data for which
* no other handler exists.
*
*
*
*
*
* If a handler function is set to an empty string, or FALSE, the handler
* in question is disabled.
* @param \XMLParser $parser
* @param callable $handler
* @throws XmlException
*
*/
@@ -136,61 +52,8 @@ function xml_set_default_handler(\XMLParser $parser, callable $handler): void
/**
* Sets the element handler functions for the XML parser.
* start_handler and
* end_handler are strings containing
* the names of functions that must exist when xml_parse
* is called for parser.
*
* @param \XMLParser $parser A reference to the XML parser to set up start and end element handler functions.
* @param callable $start_handler The function named by start_handler
* must accept three parameters:
*
* start_element_handler
* XMLParserparser
* stringname
* arrayattribs
*
*
*
* parser
*
*
* The first parameter, parser, is a
* reference to the XML parser calling the handler.
*
*
*
*
* name
*
*
* The second parameter, name, contains the name
* of the element for which this handler is called.If case-folding is in effect for this
* parser, the element name will be in uppercase letters.
*
*
*
*
* attribs
*
*
* The third parameter, attribs, contains an
* associative array with the element's attributes (if any).The keys
* of this array are the attribute names, the values are the attribute
* values.Attribute names are case-folded on the same criteria as
* element names.Attribute values are not
* case-folded.
*
*
* The original order of the attributes can be retrieved by walking
* through attribs the normal way, using
* each.The first key in the array was the first
* attribute, and so on.
*
*
*
*
* @param \XMLParser $parser
* @param callable $start_handler
* @param callable $end_handler
* @throws XmlException
*
@@ -206,49 +69,8 @@ function xml_set_element_handler(\XMLParser $parser, callable $start_handler, ca
/**
* Set a handler to be called when leaving the scope of a namespace
* declaration. This will be called, for each namespace declaration, after
* the handler for the end tag of the element in which the namespace was
* declared.
*
* @param \XMLParser $parser A reference to the XML parser.
* @param callable $handler handler is a string containing the name of a
* function that must exist when xml_parse is called
* for parser.
*
* The function named by handler must accept
* two parameters, and should return an integer value. If the
* value returned from the handler is FALSE (which it will be if no
* value is returned), the XML parser will stop parsing and
* xml_get_error_code will return
* XML_ERROR_EXTERNAL_ENTITY_HANDLING.
*
* handler
* XMLParserparser
* stringprefix
*
*
*
* parser
*
*
* The first parameter, parser, is a
* reference to the XML parser calling the handler.
*
*
*
*
* prefix
*
*
* The prefix is a string used to reference the namespace within an XML object.
*
*
*
*
*
* If a handler function is set to an empty string, or FALSE, the handler
* in question is disabled.
* @param \XMLParser $parser
* @param callable $handler
* @throws XmlException
*
*/
@@ -263,84 +85,8 @@ function xml_set_end_namespace_decl_handler(\XMLParser $parser, callable $handle
/**
* Sets the external entity reference handler function for the XML parser
* parser.
*
* @param \XMLParser $parser A reference to the XML parser to set up external entity reference handler function.
* @param callable $handler handler is a string containing the name of a
* function that must exist when xml_parse is called
* for parser.
*
* The function named by handler must accept
* five parameters, and should return an integer value.If the
* value returned from the handler is FALSE (which it will be if no
* value is returned), the XML parser will stop parsing and
* xml_get_error_code will return
* XML_ERROR_EXTERNAL_ENTITY_HANDLING.
*
* handler
* XMLParserparser
* stringopen_entity_names
* stringbase
* stringsystem_id
* stringpublic_id
*
*
*
* parser
*
*
* The first parameter, parser, is a
* reference to the XML parser calling the handler.
*
*
*
*
* open_entity_names
*
*
* The second parameter, open_entity_names, is a
* space-separated list of the names of the entities that are open for
* the parse of this entity (including the name of the referenced
* entity).
*
*
*
*
* base
*
*
* This is the base for resolving the system identifier
* (system_id) of the external entity.Currently
* this parameter will always be set to an empty string.
*
*
*
*
* system_id
*
*
* The fourth parameter, system_id, is the
* system identifier as specified in the entity declaration.
*
*
*
*
* public_id
*
*
* The fifth parameter, public_id, is the
* public identifier as specified in the entity declaration, or
* an empty string if none was specified; the whitespace in the
* public identifier will have been normalized as required by
* the XML spec.
*
*
*
*
*
* If a handler function is set to an empty string, or FALSE, the handler
* in question is disabled.
* @param \XMLParser $parser
* @param callable $handler
* @throws XmlException
*
*/
@@ -355,89 +101,8 @@ function xml_set_external_entity_ref_handler(\XMLParser $parser, callable $handl
/**
* Sets the notation declaration handler function for the XML parser
* parser.
*
* A notation declaration is part of the document's DTD and has the
* following format:
*
* name
* { systemId | publicId?>
* ]]>
*
* See section 4.7 of the XML 1.0
* spec for the definition of notation declarations.
*
* @param \XMLParser $parser A reference to the XML parser to set up notation declaration handler function.
* @param callable $handler handler is a string containing the name of a
* function that must exist when xml_parse is called
* for parser.
*
* The function named by handler must accept
* five parameters:
*
* handler
* XMLParserparser
* stringnotation_name
* stringbase
* stringsystem_id
* stringpublic_id
*
*
*
*
* parser
*
*
*
* The first parameter, parser, is a
* reference to the XML parser calling the handler.
*
*
*
*
* notation_name
*
*
* This is the notation's name, as per
* the notation format described above.
*
*
*
*
*
* base
*
*
*
* This is the base for resolving the system identifier
* (system_id) of the notation declaration.
* Currently this parameter will always be set to an empty string.
*
*
*
*
* system_id
*
*
* System identifier of the external notation declaration.
*
*
*
*
*
* public_id
*
*
*
* Public identifier of the external notation declaration.
*
*
*
*
*
* If a handler function is set to an empty string, or FALSE, the handler
* in question is disabled.
* @param \XMLParser $parser
* @param callable $handler
* @throws XmlException
*
*/
@@ -452,13 +117,8 @@ function xml_set_notation_decl_handler(\XMLParser $parser, callable $handler): v
/**
* This function allows to use parser inside
* object. All callback functions could be set with
* xml_set_element_handler etc and assumed to be
* methods of object.
*
* @param \XMLParser $parser A reference to the XML parser to use inside the object.
* @param object $object The object where to use the XML parser.
* @param \XMLParser $parser
* @param object $object
* @throws XmlException
*
*/
@@ -473,66 +133,8 @@ function xml_set_object(\XMLParser $parser, object $object): void
/**
* Sets the processing instruction (PI) handler function for the XML parser
* parser.
*
* A processing instruction has the following format:
*
* <?target
* data?>
*
*
* You can put PHP code into such a tag, but be aware of one limitation: in
* an XML PI, the PI end tag (?>) can not be quoted,
* so this character sequence should not appear in the PHP code you embed
* with PIs in XML documents.If it does, the rest of the PHP code, as well
* as the "real" PI end tag, will be treated as character data.
*
* @param \XMLParser $parser A reference to the XML parser to set up processing instruction (PI) handler function.
* @param callable $handler handler is a string containing the name of a
* function that must exist when xml_parse is called
* for parser.
*
* The function named by handler must accept
* three parameters:
*
* handler
* XMLParserparser
* stringtarget
* stringdata
*
*
*
* parser
*
*
* The first parameter, parser, is a
* reference to the XML parser calling the handler.
*
*
*
*
* target
*
*
* The second parameter, target, contains the PI
* target.
*
*
*
*
* data
*
*
* The third parameter, data, contains the PI
* data.
*
*
*
*
*
* If a handler function is set to an empty string, or FALSE, the handler
* in question is disabled.
* @param \XMLParser $parser
* @param callable $handler
* @throws XmlException
*
*/
@@ -547,58 +149,8 @@ function xml_set_processing_instruction_handler(\XMLParser $parser, callable $ha
/**
* Set a handler to be called when a namespace is declared. Namespace
* declarations occur inside start tags. But the namespace declaration start
* handler is called before the start tag handler for each namespace declared
* in that start tag.
*
* @param \XMLParser $parser A reference to the XML parser.
* @param callable $handler handler is a string containing the name of a
* function that must exist when xml_parse is called
* for parser.
*
* The function named by handler must accept
* three parameters, and should return an integer value. If the
* value returned from the handler is FALSE (which it will be if no
* value is returned), the XML parser will stop parsing and
* xml_get_error_code will return
* XML_ERROR_EXTERNAL_ENTITY_HANDLING.
*
* handler
* XMLParserparser
* stringprefix
* stringuri
*
*
*
* parser
*
*
* The first parameter, parser, is a
* reference to the XML parser calling the handler.
*
*
*
*
* prefix
*
*
* The prefix is a string used to reference the namespace within an XML object.
*
*
*
*
* uri
*
*
* Uniform Resource Identifier (URI) of namespace.
*
*
*
*
*
* If a handler function is set to an empty string, or FALSE, the handler
* in question is disabled.
* @param \XMLParser $parser
* @param callable $handler
* @throws XmlException
*
*/
@@ -613,96 +165,8 @@ function xml_set_start_namespace_decl_handler(\XMLParser $parser, callable $hand
/**
* Sets the unparsed entity declaration handler function for the XML parser
* parser.
*
* The handler will be called if the XML parser
* encounters an external entity declaration with an NDATA declaration, like
* the following:
*
* name {publicId | systemId}
* NDATA notationName
* ]]>
*
*
* See section 4.2.2 of
* the XML 1.0 spec for the definition of notation declared
* external entities.
*
* @param \XMLParser $parser A reference to the XML parser to set up unparsed entity declaration handler function.
* @param callable $handler handler is a string containing the name of a
* function that must exist when xml_parse is called
* for parser.
*
* The function named by handler must accept six
* parameters:
*
* handler
* XMLParserparser
* stringentity_name
* stringbase
* stringsystem_id
* stringpublic_id
* stringnotation_name
*
*
*
* parser
*
*
* The first parameter, parser, is a
* reference to the XML parser calling the
* handler.
*
*
*
*
* entity_name
*
*
* The name of the entity that is about to be defined.
*
*
*
*
* base
*
*
* This is the base for resolving the system identifier
* (systemId) of the external entity.Currently
* this parameter will always be set to an empty string.
*
*
*
*
* system_id
*
*
* System identifier for the external entity.
*
*
*
*
* public_id
*
*
* Public identifier for the external entity.
*
*
*
*
* notation_name
*
*
* Name of the notation of this entity (see
* xml_set_notation_decl_handler).
*
*
*
*
*
* If a handler function is set to an empty string, or FALSE, the handler
* in question is disabled.
* @param \XMLParser $parser
* @param callable $handler
* @throws XmlException
*
*/

View File

@@ -5,10 +5,8 @@
use Safe\Exceptions\XmlrpcException;
/**
* Sets xmlrpc type, base64 or datetime, for a PHP string value.
*
* @param \DateTime|string $value Value to set the type
* @param string $type 'base64' or 'datetime'
* @param \DateTime|string $value
* @param string $type
* @throws XmlrpcException
*
*/

View File

@@ -5,21 +5,11 @@
use Safe\Exceptions\YamlException;
/**
* Convert all or part of a YAML document stream read from a file to a PHP variable.
*
* @param string $filename Path to the file.
* @param int $pos Document to extract from stream (-1 for all
* documents, 0 for first document, ...).
* @param int|null $ndocs If ndocs is provided, then it is filled with the
* number of documents found in stream.
* @param array|null $callbacks Content handlers for YAML nodes. Associative array of YAML
* tag => callable mappings. See
* parse callbacks for more
* details.
* @return mixed Returns the value encoded in input in appropriate
* PHP type. If pos is -1 an
* array will be returned with one entry for each document found
* in the stream.
* @param string $filename
* @param int $pos
* @param int|null $ndocs
* @param array|null $callbacks
* @return mixed
* @throws YamlException
*
*/
@@ -39,24 +29,11 @@ function yaml_parse_file(string $filename, int $pos = 0, ?int &$ndocs = null, ?a
/**
* Convert all or part of a YAML document stream read from a URL to a PHP variable.
*
* @param string $url url should be of the form "scheme://...". PHP
* will search for a protocol handler (also known as a wrapper) for that
* scheme. If no wrappers for that protocol are registered, PHP will emit
* a notice to help you track potential problems in your script and then
* continue as though filename specifies a regular file.
* @param int $pos Document to extract from stream (-1 for all
* documents, 0 for first document, ...).
* @param int|null $ndocs If ndocs is provided, then it is filled with the
* number of documents found in stream.
* @param array|null $callbacks Content handlers for YAML nodes. Associative array of YAML
* tag => callable mappings. See
* parse callbacks for more
* @return mixed Returns the value encoded in input in appropriate
* PHP type. If pos is
* -1 an array will be returned with one entry
* for each document found in the stream.
* @param string $url
* @param int $pos
* @param int|null $ndocs
* @param array|null $callbacks
* @return mixed
* @throws YamlException
*
*/
@@ -76,21 +53,11 @@ function yaml_parse_url(string $url, int $pos = 0, ?int &$ndocs = null, ?array $
/**
* Convert all or part of a YAML document stream to a PHP variable.
*
* @param string $input The string to parse as a YAML document stream.
* @param int $pos Document to extract from stream (-1 for all
* documents, 0 for first document, ...).
* @param int|null $ndocs If ndocs is provided, then it is filled with the
* number of documents found in stream.
* @param array|null $callbacks Content handlers for YAML nodes. Associative array of YAML
* tag => callable mappings. See
* parse callbacks for more
* details.
* @return mixed Returns the value encoded in input in appropriate
* PHP type. If pos is -1 an
* array will be returned with one entry for each document found
* in the stream.
* @param string $input
* @param int $pos
* @param int|null $ndocs
* @param array|null $callbacks
* @return mixed
* @throws YamlException
*
*/

View File

@@ -5,45 +5,9 @@
use Safe\Exceptions\YazException;
/**
* This function invokes a CCL parser. It converts a given CCL FIND query to
* an RPN query which may be passed to the yaz_search
* function to perform a search.
*
* To define a set of valid CCL fields call yaz_ccl_conf
* prior to this function.
*
* @param resource $id The connection resource returned by yaz_connect.
* @param string $query The CCL FIND query.
* @param array|null $result If the function was executed successfully, this will be an array
* containing the valid RPN query under the key rpn.
*
* Upon failure, three indexes are set in this array to indicate the cause
* of failure:
*
*
*
* errorcode - the CCL error code (integer)
*
*
*
*
* errorstring - the CCL error string
*
*
*
*
* errorpos - approximate position in query of failure
* (integer is character position)
*
*
*
*
* errorcode - the CCL error code (integer)
*
* errorstring - the CCL error string
*
* errorpos - approximate position in query of failure
* (integer is character position)
* @param resource $id
* @param string $query
* @param array|null $result
* @throws YazException
*
*/
@@ -58,9 +22,7 @@ function yaz_ccl_parse($id, string $query, ?array &$result): void
/**
* Closes the connection given by parameter id.
*
* @param resource $id The connection resource returned by yaz_connect.
* @param resource $id
* @throws YazException
*
*/
@@ -75,193 +37,9 @@ function yaz_close($id): void
/**
* This function returns a connection resource on success, zero on
* failure.
*
* yaz_connect prepares for a connection to a
* Z39.50 server.
* This function is non-blocking and does not attempt to establish
* a connection - it merely prepares a connect to be performed later when
* yaz_wait is called.
*
* @param string $zurl A string that takes the form host[:port][/database].
* If port is omitted, port 210 is used. If database is omitted
* Default is used.
* @param mixed $options If given as a string, it is treated as the Z39.50 V2 authentication
* string (OpenAuth).
*
* If given as an array, the contents of the array serves as options.
*
*
* user
*
*
* Username for authentication.
*
*
*
*
* group
*
*
* Group for authentication.
*
*
*
*
* password
*
*
* Password for authentication.
*
*
*
*
* cookie
*
*
* Cookie for session (YAZ proxy).
*
*
*
*
* proxy
*
*
* Proxy for connection (YAZ proxy).
*
*
*
*
* persistent
*
*
* A boolean. If TRUE the connection is persistent; If FALSE the
* connection is not persistent. By default connections are persistent.
*
*
*
* If you open a persistent connection, you won't be able to close
* it later with yaz_close.
*
*
*
*
*
* piggyback
*
*
* A boolean. If TRUE piggyback is enabled for searches; If FALSE
* piggyback is disabled. By default piggyback is enabled.
*
*
* Enabling piggyback is more efficient and usually saves a
* network-round-trip for first time fetches of records. However, a
* few Z39.50 servers do not support piggyback or they ignore element
* set names. For those, piggyback should be disabled.
*
*
*
*
* charset
*
*
* A string that specifies character set to be used in Z39.50
* language and character set negotiation. Use strings such as:
* ISO-8859-1, UTF-8,
* UTF-16.
*
*
* Most Z39.50 servers do not support this feature (and thus, this is
* ignored). Many servers use the ISO-8859-1 encoding for queries and
* messages. MARC21/USMARC records are not affected by this setting.
*
*
*
*
*
* preferredMessageSize
*
*
* An integer that specifies the maximum byte size of all records
* to be returned by a target during retrieval. See the
* Z39.50 standard for more
* information.
*
*
*
* This option is supported in PECL YAZ 1.0.5 or later.
*
*
*
*
*
*
* maximumRecordSize
*
*
* An integer that specifies the maximum byte size of a single record
* to be returned by a target during retrieval. This
* entity is referred to as Exceptional-record-size in the
* Z39.50 standard.
*
*
*
* This option is supported in PECL YAZ 1.0.5 or later.
*
*
*
*
*
*
*
* Username for authentication.
*
* Group for authentication.
*
* Password for authentication.
*
* Cookie for session (YAZ proxy).
*
* Proxy for connection (YAZ proxy).
*
* A boolean. If TRUE the connection is persistent; If FALSE the
* connection is not persistent. By default connections are persistent.
*
* If you open a persistent connection, you won't be able to close
* it later with yaz_close.
*
* A boolean. If TRUE piggyback is enabled for searches; If FALSE
* piggyback is disabled. By default piggyback is enabled.
*
* Enabling piggyback is more efficient and usually saves a
* network-round-trip for first time fetches of records. However, a
* few Z39.50 servers do not support piggyback or they ignore element
* set names. For those, piggyback should be disabled.
*
* A string that specifies character set to be used in Z39.50
* language and character set negotiation. Use strings such as:
* ISO-8859-1, UTF-8,
* UTF-16.
*
* Most Z39.50 servers do not support this feature (and thus, this is
* ignored). Many servers use the ISO-8859-1 encoding for queries and
* messages. MARC21/USMARC records are not affected by this setting.
*
* An integer that specifies the maximum byte size of all records
* to be returned by a target during retrieval. See the
* Z39.50 standard for more
* information.
*
* This option is supported in PECL YAZ 1.0.5 or later.
*
* An integer that specifies the maximum byte size of a single record
* to be returned by a target during retrieval. This
* entity is referred to as Exceptional-record-size in the
* Z39.50 standard.
*
* This option is supported in PECL YAZ 1.0.5 or later.
* @return mixed A connection resource on success, FALSE on error.
* @param string $zurl
* @param mixed $options
* @return mixed
* @throws YazException
*
*/
@@ -281,14 +59,8 @@ function yaz_connect(string $zurl, $options = null)
/**
* This function allows you to change databases within a session by
* specifying one or more databases to be used in search, retrieval, etc.
* - overriding databases specified in call to
* yaz_connect.
*
* @param resource $id The connection resource returned by yaz_connect.
* @param string $databases A string containing one or more databases. Multiple databases are
* separated by a plus sign +.
* @param resource $id
* @param string $databases
* @throws YazException
*
*/
@@ -303,15 +75,8 @@ function yaz_database($id, string $databases): void
/**
* This function sets the element set name for retrieval.
*
* Call this function before yaz_search or
* yaz_present to specify the element set name for
* records to be retrieved.
*
* @param resource $id The connection resource returned by yaz_connect.
* @param string $elementset Most servers support F (for full records) and
* B (for brief records).
* @param resource $id
* @param string $elementset
* @throws YazException
*
*/
@@ -326,12 +91,7 @@ function yaz_element($id, string $elementset): void
/**
* This function prepares for retrieval of records after a successful search.
*
* The yaz_range function should be called prior to this
* function to specify the range of records to be retrieved.
*
* @param resource $id The connection resource returned by yaz_connect.
* @param resource $id
* @throws YazException
*
*/
@@ -346,32 +106,9 @@ function yaz_present($id): void
/**
* yaz_search prepares for a search on the given
* connection.
*
* Like yaz_connect this function is non-blocking and
* only prepares for a search to be executed later when
* yaz_wait is called.
*
* @param resource $id The connection resource returned by yaz_connect.
* @param string $type This parameter represents the query type - only "rpn"
* is supported now in which case the third argument specifies a Type-1
* query in prefix query notation.
* @param string $query The RPN query is a textual representation of the Type-1 query as
* defined by the Z39.50 standard. However, in the text representation
* as used by YAZ a prefix notation is used, that is the operator
* precedes the operands. The query string is a sequence of tokens where
* white space is ignored unless surrounded by double quotes. Tokens beginning
* with an at-character (@) are considered operators,
* otherwise they are treated as search terms.
*
* You can find information about attributes at the
* Z39.50 Maintenance Agency
* site.
*
* If you would like to use a more friendly notation,
* use the CCL parser - functions yaz_ccl_conf and
* yaz_ccl_parse.
* @param resource $id
* @param string $type
* @param string $query
* @throws YazException
*
*/
@@ -386,44 +123,8 @@ function yaz_search($id, string $type, string $query): void
/**
* This function carries out networked (blocked) activity for outstanding
* requests which have been prepared by the functions
* yaz_connect, yaz_search,
* yaz_present, yaz_scan and
* yaz_itemorder.
*
* yaz_wait returns when all servers have either
* completed all requests or aborted (in case of errors).
*
* @param array $options An associative array of options:
*
*
* timeout
*
*
* Sets timeout in seconds. If a server has not responded within the
* timeout it is considered dead and yaz_wait
* returns. The default value for timeout is 15 seconds.
*
*
*
*
* event
*
*
* A boolean.
*
*
*
*
*
* Sets timeout in seconds. If a server has not responded within the
* timeout it is considered dead and yaz_wait
* returns. The default value for timeout is 15 seconds.
*
* A boolean.
* @return mixed Returns TRUE on success.
* In event mode, returns resource.
* @param array $options
* @return mixed
* @throws YazException
*
*/

View File

@@ -5,9 +5,7 @@
use Safe\Exceptions\ZipException;
/**
* Closes the specified directory entry.
*
* @param resource $zip_entry A directory entry previously opened zip_entry_open.
* @param resource $zip_entry
* @throws ZipException
*
*/
@@ -22,10 +20,8 @@ function zip_entry_close($zip_entry): void
/**
* Returns the compressed size of the specified directory entry.
*
* @param resource $zip_entry A directory entry returned by zip_read.
* @return int The compressed size.
* @param resource $zip_entry
* @return int
* @throws ZipException
*
*/
@@ -41,11 +37,8 @@ function zip_entry_compressedsize($zip_entry): int
/**
* Returns the compression method of the directory entry specified
* by zip_entry.
*
* @param resource $zip_entry A directory entry returned by zip_read.
* @return string The compression method.
* @param resource $zip_entry
* @return string
* @throws ZipException
*
*/
@@ -61,10 +54,8 @@ function zip_entry_compressionmethod($zip_entry): string
/**
* Returns the actual size of the specified directory entry.
*
* @param resource $zip_entry A directory entry returned by zip_read.
* @return int The size of the directory entry.
* @param resource $zip_entry
* @return int
* @throws ZipException
*
*/
@@ -80,10 +71,8 @@ function zip_entry_filesize($zip_entry): int
/**
* Returns the name of the specified directory entry.
*
* @param resource $zip_entry A directory entry returned by zip_read.
* @return string The name of the directory entry.
* @param resource $zip_entry
* @return string
* @throws ZipException
*
*/
@@ -99,16 +88,9 @@ function zip_entry_name($zip_entry): string
/**
* Opens a directory entry in a zip file for reading.
*
* @param resource $zip_dp A valid resource handle returned by zip_open.
* @param resource $zip_entry A directory entry returned by zip_read.
* @param string $mode Any of the modes specified in the documentation of
* fopen.
*
* Currently, mode is ignored and is always
* "rb". This is due to the fact that zip support
* in PHP is read only access.
* @param resource $zip_dp
* @param resource $zip_entry
* @param string $mode
* @throws ZipException
*
*/
@@ -123,13 +105,9 @@ function zip_entry_open($zip_dp, $zip_entry, string $mode = "rb"): void
/**
* Reads from an open directory entry.
*
* @param resource $zip_entry A directory entry returned by zip_read.
* @param int $len The number of bytes to return.
*
* This should be the uncompressed length you wish to read.
* @return string Returns the data read, empty string on end of a file.
* @param resource $zip_entry
* @param int $len
* @return string
* @throws ZipException
*
*/

View File

@@ -5,20 +5,10 @@
use Safe\Exceptions\ZlibException;
/**
* Incrementally deflates data in the specified context.
*
* @param \DeflateContext $context A context created with deflate_init.
* @param string $data A chunk of data to compress.
* @param int $flush_mode One of ZLIB_BLOCK,
* ZLIB_NO_FLUSH,
* ZLIB_PARTIAL_FLUSH,
* ZLIB_SYNC_FLUSH (default),
* ZLIB_FULL_FLUSH, ZLIB_FINISH.
* Normally you will want to set ZLIB_NO_FLUSH to
* maximize compression, and ZLIB_FINISH to terminate
* with the last chunk of data. See the zlib manual for a
* detailed description of these constants.
* @return string Returns a chunk of compressed data.
* @param \DeflateContext $context
* @param string $data
* @param int $flush_mode
* @return string
* @throws ZlibException
*
*/
@@ -34,92 +24,9 @@ function deflate_add(\DeflateContext $context, string $data, int $flush_mode = Z
/**
* Initializes an incremental deflate context using the specified
* encoding.
*
* Note that the window option here only sets the window size
* of the algorithm, differently from the zlib filters where the same parameter
* also sets the encoding to use; the encoding must be set with the
* encoding parameter.
*
* Limitation: there is currently no way to set the header information on a GZIP
* compressed stream, which are set as follows: GZIP signature
* (\x1f\x8B); compression method (\x08
* == DEFLATE); 6 zero bytes; the operating system set to the current system
* (\x00 = Windows, \x03 = Unix, etc.)
*
* @param int $encoding One of the ZLIB_ENCODING_* constants.
* @param array $options An associative array which may contain the following elements:
*
*
* level
*
*
* The compression level in range -1..9; defaults to -1.
*
*
*
*
* memory
*
*
* The compression memory level in range 1..9; defaults to 8.
*
*
*
*
* window
*
*
* The zlib window size (logarithmic) in range 8..15;
* defaults to 15.
* zlib changes a window size of 8 to 9,
* and as of zlib 1.2.8 fails with a warning, if a window size of 8
* is requested for ZLIB_ENCODING_RAW or ZLIB_ENCODING_GZIP.
*
*
*
*
* strategy
*
*
* One of ZLIB_FILTERED,
* ZLIB_HUFFMAN_ONLY, ZLIB_RLE,
* ZLIB_FIXED or
* ZLIB_DEFAULT_STRATEGY (the default).
*
*
*
*
* dictionary
*
*
* A string or an array of strings
* of the preset dictionary (default: no preset dictionary).
*
*
*
*
*
* The compression level in range -1..9; defaults to -1.
*
* The compression memory level in range 1..9; defaults to 8.
*
* The zlib window size (logarithmic) in range 8..15;
* defaults to 15.
* zlib changes a window size of 8 to 9,
* and as of zlib 1.2.8 fails with a warning, if a window size of 8
* is requested for ZLIB_ENCODING_RAW or ZLIB_ENCODING_GZIP.
*
* One of ZLIB_FILTERED,
* ZLIB_HUFFMAN_ONLY, ZLIB_RLE,
* ZLIB_FIXED or
* ZLIB_DEFAULT_STRATEGY (the default).
*
* A string or an array of strings
* of the preset dictionary (default: no preset dictionary).
* @return \DeflateContext Returns a deflate context resource (zlib.deflate) on
* success.
* @param int $encoding
* @param array $options
* @return \DeflateContext
* @throws ZlibException
*
*/
@@ -135,10 +42,7 @@ function deflate_init(int $encoding, array $options = []): \DeflateContext
/**
* Closes the given gz-file pointer.
*
* @param resource $stream The gz-file pointer. It must be valid, and must point to a file
* successfully opened by gzopen.
* @param resource $stream
* @throws ZlibException
*
*/
@@ -153,20 +57,10 @@ function gzclose($stream): void
/**
* This function compresses the given string using the ZLIB
* data format.
*
* For details on the ZLIB compression algorithm see the document
* "ZLIB Compressed Data Format
* Specification version 3.3" (RFC 1950).
*
* @param string $data The data to compress.
* @param int $level The level of compression. Can be given as 0 for no compression up to 9
* for maximum compression.
*
* If -1 is used, the default compression of the zlib library is used which is 6.
* @param int $encoding One of ZLIB_ENCODING_* constants.
* @return string The compressed string.
* @param string $data
* @param int $level
* @param int $encoding
* @return string
* @throws ZlibException
*
*/
@@ -182,12 +76,9 @@ function gzcompress(string $data, int $level = -1, int $encoding = ZLIB_ENCODING
/**
* This function returns a decoded version of the input
* data.
*
* @param string $data The data to decode, encoded by gzencode.
* @param int $max_length The maximum length of data to decode.
* @return string The decoded string.
* @param string $data
* @param int $max_length
* @return string
* @throws ZlibException
*
*/
@@ -203,19 +94,10 @@ function gzdecode(string $data, int $max_length = 0): string
/**
* This function compresses the given string using the DEFLATE
* data format.
*
* For details on the DEFLATE compression algorithm see the document
* "DEFLATE Compressed Data Format
* Specification version 1.3" (RFC 1951).
*
* @param string $data The data to deflate.
* @param int $level The level of compression. Can be given as 0 for no compression up to 9
* for maximum compression. If not given, the default compression level will
* be the default compression level of the zlib library.
* @param int $encoding One of ZLIB_ENCODING_* constants.
* @return string The deflated string.
* @param string $data
* @param int $level
* @param int $encoding
* @return string
* @throws ZlibException
*
*/
@@ -231,25 +113,10 @@ function gzdeflate(string $data, int $level = -1, int $encoding = ZLIB_ENCODING_
/**
* This function returns a compressed version of the input
* data compatible with the output of the
* gzip program.
*
* For more information on the GZIP file format, see the document:
* GZIP file format specification
* version 4.3 (RFC 1952).
*
* @param string $data The data to encode.
* @param int $level The level of compression. Can be given as 0 for no compression up to 9
* for maximum compression. If not given, the default compression level will
* be the default compression level of the zlib library.
* @param int $encoding The encoding mode. Can be FORCE_GZIP (the default)
* or FORCE_DEFLATE.
*
* FORCE_DEFLATE generates
* RFC 1950 compliant output, consisting of a zlib header, the deflated
* data, and an Adler checksum.
* @return string The encoded string.
* @param string $data
* @param int $level
* @param int $encoding
* @return string
* @throws ZlibException
*
*/
@@ -265,17 +132,13 @@ function gzencode(string $data, int $level = -1, int $encoding = ZLIB_ENCODING_G
/**
* This function is identical to readgzfile, except that
* it returns the file in an array.
*
* @param string $filename The file name.
* @param int $use_include_path You can set this optional parameter to 1, if you
* want to search for the file in the include_path too.
* @return list An array containing the file, one line per cell, empty lines included, and with newlines still attached.
* @param string $filename
* @param $use_include_path
* @return list
* @throws ZlibException
*
*/
function gzfile(string $filename, int $use_include_path = 0): array
function gzfile(string $filename, $use_include_path = 0): array
{
error_clear_last();
$safeResult = \gzfile($filename, $use_include_path);
@@ -287,14 +150,9 @@ function gzfile(string $filename, int $use_include_path = 0): array
/**
* Gets a (uncompressed) string of up to length - 1 bytes read from the given
* file pointer. Reading ends when length - 1 bytes have been read, on a
* newline, or on EOF (whichever comes first).
*
* @param resource $stream The gz-file pointer. It must be valid, and must point to a file
* successfully opened by gzopen.
* @param int|null $length The length of data to get.
* @return string The uncompressed string.
* @param resource $stream
* @param int|null $length
* @return string
* @throws ZlibException
*
*/
@@ -314,15 +172,9 @@ function gzgets($stream, ?int $length = null): string
/**
* This function inflates a deflated string.
*
* @param string $data The data compressed by gzdeflate.
* @param int $max_length The maximum length of data to decode.
* @return string The original uncompressed data.
*
* The function will return an error if the uncompressed data is more than
* 32768 times the length of the compressed input data
* or more than the optional parameter max_length.
* @param string $data
* @param int $max_length
* @return string
* @throws ZlibException
*
*/
@@ -338,32 +190,14 @@ function gzinflate(string $data, int $max_length = 0): string
/**
* Opens a gzip (.gz) file for reading or writing.
*
* gzopen can be used to read a file which is
* not in gzip format; in this case gzread will
* directly read from the file without decompression.
*
* @param string $filename The file name.
* @param string $mode As in fopen (rb or
* wb) but can also include a compression level
* (wb9) or a strategy: f for
* filtered data as in wb6f, h for
* Huffman only compression as in wb1h.
* (See the description of deflateInit2
* in zlib.h for
* more information about the strategy parameter.)
* @param int $use_include_path You can set this optional parameter to 1, if you
* want to search for the file in the include_path too.
* @return resource Returns a file pointer to the file opened, after that, everything you read
* from this file descriptor will be transparently decompressed and what you
* write gets compressed.
*
* If the open fails, the function returns FALSE.
* @param string $filename
* @param string $mode
* @param $use_include_path
* @return resource
* @throws ZlibException
*
*/
function gzopen(string $filename, string $mode, int $use_include_path = 0)
function gzopen(string $filename, string $mode, $use_include_path = 0)
{
error_clear_last();
$safeResult = \gzopen($filename, $mode, $use_include_path);
@@ -375,13 +209,8 @@ function gzopen(string $filename, string $mode, int $use_include_path = 0)
/**
* Reads to EOF on the given gz-file pointer from the current position and
* writes the (uncompressed) results to standard output.
*
* @param resource $stream The gz-file pointer. It must be valid, and must point to a file
* successfully opened by gzopen.
* @return int The number of uncompressed characters read from gz
* and passed through to the input.
* @param resource $stream
* @return int
* @throws ZlibException
*
*/
@@ -397,15 +226,9 @@ function gzpassthru($stream): int
/**
* gzread reads up to length bytes
* from the given gz-file pointer. Reading stops when
* length (uncompressed) bytes have been read
* or EOF is reached, whichever comes first.
*
* @param resource $stream The gz-file pointer. It must be valid, and must point to a file
* successfully opened by gzopen.
* @param int $length The number of bytes to read.
* @return string The data that have been read.
* @param resource $stream
* @param int $length
* @return string
* @throws ZlibException
*
*/
@@ -421,11 +244,7 @@ function gzread($stream, int $length): string
/**
* Sets the file position indicator of the given gz-file pointer to the
* beginning of the file stream.
*
* @param resource $stream The gz-file pointer. It must be valid, and must point to a file
* successfully opened by gzopen.
* @param resource $stream
* @throws ZlibException
*
*/
@@ -440,12 +259,8 @@ function gzrewind($stream): void
/**
* Gets the position of the given file pointer; i.e., its offset into the
* uncompressed file stream.
*
* @param resource $stream The gz-file pointer. It must be valid, and must point to a file
* successfully opened by gzopen.
* @return int The position of the file pointer or FALSE if an error occurs.
* @param resource $stream
* @return int
* @throws ZlibException
*
*/
@@ -461,15 +276,9 @@ function gztell($stream): int
/**
* This function uncompress a compressed string.
*
* @param string $data The data compressed by gzcompress.
* @param int $max_length The maximum length of data to decode.
* @return string The original uncompressed data.
*
* The function will return an error if the uncompressed data is more than
* 32768 times the length of the compressed input data
* or more than the optional parameter max_length.
* @param string $data
* @param int $max_length
* @return string
* @throws ZlibException
*
*/
@@ -485,18 +294,10 @@ function gzuncompress(string $data, int $max_length = 0): string
/**
* gzwrite writes the contents of
* data to the given gz-file.
*
* @param resource $stream The gz-file pointer. It must be valid, and must point to a file
* successfully opened by gzopen.
* @param string $data The string to write.
* @param int|null $length The number of uncompressed bytes to write. 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 (uncompressed) bytes written to the given gz-file
* stream.
* @param resource $stream
* @param string $data
* @param int|null $length
* @return int
* @throws ZlibException
*
*/
@@ -516,10 +317,8 @@ function gzwrite($stream, string $data, ?int $length = null): int
/**
*
*
* @param \InflateContext $context
* @return int Returns number of bytes read so far.
* @return int
* @throws ZlibException
*
*/
@@ -535,10 +334,8 @@ function inflate_get_read_len(\InflateContext $context): int
/**
* Usually returns either ZLIB_OK or ZLIB_STREAM_END.
*
* @param \InflateContext $context
* @return int Returns decompression status.
* @return int
* @throws ZlibException
*
*/
@@ -554,23 +351,10 @@ function inflate_get_status(\InflateContext $context): int
/**
* Incrementally inflates encoded data in the specified context.
*
* Limitation: header information from GZIP compressed data are not made
* available.
*
* @param \InflateContext $context A context created with inflate_init.
* @param string $data A chunk of compressed data.
* @param int $flush_mode One of ZLIB_BLOCK,
* ZLIB_NO_FLUSH,
* ZLIB_PARTIAL_FLUSH,
* ZLIB_SYNC_FLUSH (default),
* ZLIB_FULL_FLUSH, ZLIB_FINISH.
* Normally you will want to set ZLIB_NO_FLUSH to
* maximize compression, and ZLIB_FINISH to terminate
* with the last chunk of data. See the zlib manual for a
* detailed description of these constants.
* @return string Returns a chunk of uncompressed data.
* @param \InflateContext $context
* @param string $data
* @param int $flush_mode
* @return string
* @throws ZlibException
*
*/
@@ -586,73 +370,9 @@ function inflate_add(\InflateContext $context, string $data, int $flush_mode = Z
/**
* Initialize an incremental inflate context with the specified
* encoding.
*
* @param int $encoding One of the ZLIB_ENCODING_* constants.
* @param array $options An associative array which may contain the following elements:
*
*
* level
*
*
* The compression level in range -1..9; defaults to -1.
*
*
*
*
* memory
*
*
* The compression memory level in range 1..9; defaults to 8.
*
*
*
*
* window
*
*
* The zlib window size (logarithmic) in range 8..15; defaults to 15.
*
*
*
*
* strategy
*
*
* One of ZLIB_FILTERED,
* ZLIB_HUFFMAN_ONLY, ZLIB_RLE,
* ZLIB_FIXED or
* ZLIB_DEFAULT_STRATEGY (the default).
*
*
*
*
* dictionary
*
*
* A string or an array of strings
* of the preset dictionary (default: no preset dictionary).
*
*
*
*
*
* The compression level in range -1..9; defaults to -1.
*
* The compression memory level in range 1..9; defaults to 8.
*
* The zlib window size (logarithmic) in range 8..15; defaults to 15.
*
* One of ZLIB_FILTERED,
* ZLIB_HUFFMAN_ONLY, ZLIB_RLE,
* ZLIB_FIXED or
* ZLIB_DEFAULT_STRATEGY (the default).
*
* A string or an array of strings
* of the preset dictionary (default: no preset dictionary).
* @return \InflateContext Returns an inflate context resource (zlib.inflate) on
* success.
* @param int $encoding
* @param array $options
* @return \InflateContext
* @throws ZlibException
*
*/
@@ -668,21 +388,13 @@ function inflate_init(int $encoding, array $options = []): \InflateContext
/**
* Reads a file, decompresses it and writes it to standard output.
*
* readgzfile can be used to read a file which is not in
* gzip format; in this case readgzfile will directly
* read from the file without decompression.
*
* @param string $filename The file name. This file will be opened from the filesystem and its
* contents written to standard output.
* @param int $use_include_path You can set this optional parameter to 1, if you
* want to search for the file in the include_path too.
* @return 0|positive-int Returns the number of (uncompressed) bytes read from the file on success
* @param string $filename
* @param $use_include_path
* @return 0|positive-int
* @throws ZlibException
*
*/
function readgzfile(string $filename, int $use_include_path = 0): int
function readgzfile(string $filename, $use_include_path = 0): int
{
error_clear_last();
$safeResult = \readgzfile($filename, $use_include_path);
@@ -694,11 +406,9 @@ function readgzfile(string $filename, int $use_include_path = 0): int
/**
* Uncompress any raw/gzip/zlib encoded data.
*
* @param string $data
* @param int $max_length
* @return string Returns the uncompressed data.
* @return string
* @throws ZlibException
*
*/

View File

@@ -1,199 +0,0 @@
<?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 &lt;!--#include virtual...--&gt; 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();
}
}

View File

@@ -1,112 +0,0 @@
<?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;
}

View File

@@ -5,14 +5,9 @@
use Safe\Exceptions\ArrayException;
/**
* 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.
* @param array $keys
* @param array $values
* @return array
*
*/
function array_combine(array $keys, array $values): array
@@ -24,21 +19,8 @@ function array_combine(array $keys, array $values): array
/**
* 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 int 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.
* @param array $array
* @return array
*
*/
function array_flip(array $array): array
@@ -50,27 +32,9 @@ function array_flip(array $array): array
/**
* 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.
* @param array $array
* @param array $replacements
* @return array
*
*/
function array_replace_recursive(array $array, array ...$replacements): array
@@ -86,22 +50,9 @@ function array_replace_recursive(array $array, array ...$replacements): array
/**
* 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.
* @param array $array
* @param array $replacements
* @return array
*
*/
function array_replace(array $array, array ...$replacements): array
@@ -117,24 +68,9 @@ function array_replace(array $array, array ...$replacements): array
/**
* 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.
* @param array|object $array
* @param callable $callback
* @param mixed $arg
* @throws ArrayException
*
*/
@@ -153,9 +89,7 @@ function array_walk_recursive(&$array, callable $callback, $arg = null): void
/**
* This function shuffles (randomizes the order of the elements in) an array.
*
* @param array $array The array.
* @param array $array
* @throws ArrayException
*
*/

View File

@@ -1,120 +0,0 @@
<?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();
}
}
/**
* bzopen opens a bzip2 (.bz2) file for reading or
* writing.
*
* @param resource|string $file The name of the file to open, or an existing stream resource.
* @param string $mode The modes 'r' (read), and 'w' (write) are supported.
* Everything else will cause bzopen to return FALSE.
* @return resource If the open fails, bzopen returns FALSE, otherwise
* it returns a pointer to the newly opened file.
* @throws Bzip2Exception
*
*/
function bzopen($file, string $mode)
{
error_clear_last();
$safeResult = \bzopen($file, $mode);
if ($safeResult === false) {
throw Bzip2Exception::createFromPhpError();
}
return $safeResult;
}
/**
* 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|null $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;
}

View File

@@ -1,30 +0,0 @@
<?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|null $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;
}

View File

@@ -1,25 +0,0 @@
<?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();
}
}

View File

@@ -1,196 +0,0 @@
<?php
namespace Safe;
use Safe\Exceptions\ComException;
/**
* Generates a Globally Unique Identifier (GUID).
*
* A GUID is generated in the same way as DCE UUID's, except that the
* Microsoft convention is to enclose a GUID in curly braces.
*
* @return string Returns the GUID as a string.
* @throws ComException
*
*/
function com_create_guid(): string
{
error_clear_last();
$safeResult = \com_create_guid();
if ($safeResult === false) {
throw ComException::createFromPhpError();
}
return $safeResult;
}
/**
* Instructs COM to sink events generated by
* variant into the PHP object
* sink_object.
*
* Be careful how you use this feature; if you are doing something similar
* to the example below, then it doesn't really make sense to run it in a
* web server context.
*
* @param object $variant
* @param object $sink_object sink_object should be an instance of a class with
* methods named after those of the desired dispinterface; you may use
* com_print_typeinfo to help generate a template class
* for this purpose.
* @param mixed $sink_interface PHP will attempt to use the default dispinterface type specified by
* the typelibrary associated with variant, but
* you may override this choice by setting
* sink_interface to the name of the dispinterface
* that you want to use.
* @throws ComException
*
*/
function com_event_sink(object $variant, object $sink_object, $sink_interface = null): void
{
error_clear_last();
if ($sink_interface !== null) {
$safeResult = \com_event_sink($variant, $sink_object, $sink_interface);
} else {
$safeResult = \com_event_sink($variant, $sink_object);
}
if ($safeResult === false) {
throw ComException::createFromPhpError();
}
}
/**
* Loads a type-library and registers its constants in the engine, as though
* they were defined using define.
*
* Note that it is much more efficient to use the com.typelib-file php.ini setting to pre-load and
* register the constants, although not so flexible.
*
* If com.autoregister-typelib is turned on, then
* PHP will attempt to automatically register the constants associated with a
* COM object when you instantiate it. This depends on the interfaces
* provided by the COM object itself, and may not always be possible.
*
* @param string $typelib typelib can be one of the following:
*
*
*
* The filename of a .tlb file or the executable module
* that contains the type library.
*
*
*
*
* The type library GUID, followed by its version number, for example
* {00000200-0000-0010-8000-00AA006D2EA4},2,0.
*
*
*
*
* The type library name, e.g. Microsoft OLE DB ActiveX Data
* Objects 1.0 Library.
*
*
*
* PHP will attempt to resolve the type library in this order, as the
* process gets more and more expensive as you progress down the list;
* searching for the type library by name is handled by physically
* enumerating the registry until we find a match.
*
* The filename of a .tlb file or the executable module
* that contains the type library.
*
* The type library GUID, followed by its version number, for example
* {00000200-0000-0010-8000-00AA006D2EA4},2,0.
*
* The type library name, e.g. Microsoft OLE DB ActiveX Data
* Objects 1.0 Library.
* @param bool $case_insensitive The case_insensitive behaves inversely to
* the parameter $case_insensitive in the define
* function.
* @throws ComException
*
*/
function com_load_typelib(string $typelib, bool $case_insensitive = true): void
{
error_clear_last();
$safeResult = \com_load_typelib($typelib, $case_insensitive);
if ($safeResult === false) {
throw ComException::createFromPhpError();
}
}
/**
* The purpose of this function is to help generate a skeleton class for use
* as an event sink. You may also use it to generate a dump of any COM
* object, provided that it supports enough of the introspection interfaces,
* and that you know the name of the interface you want to display.
*
* @param object $variant variant should be either an instance of a COM
* object, or be the name of a typelibrary (which will be resolved according
* to the rules set out in com_load_typelib).
* @param null|string $dispatch_interface The name of an IDispatch descendant interface that you want to display.
* @param bool $display_sink If set to TRUE, the corresponding sink interface will be displayed
* instead.
* @throws ComException
*
*/
function com_print_typeinfo(object $variant, ?string $dispatch_interface = null, bool $display_sink = false): void
{
error_clear_last();
if ($display_sink !== false) {
$safeResult = \com_print_typeinfo($variant, $dispatch_interface, $display_sink);
} elseif ($dispatch_interface !== null) {
$safeResult = \com_print_typeinfo($variant, $dispatch_interface);
} else {
$safeResult = \com_print_typeinfo($variant);
}
if ($safeResult === false) {
throw ComException::createFromPhpError();
}
}
/**
* Converts variant from a VT_DATE
* (or similar) value into a Unix timestamp. This allows easier
* interopability between the Unix-ish parts of PHP and COM.
*
* @param object $variant The variant.
* @return int Returns a unix timestamp.
* @throws ComException
*
*/
function variant_date_to_timestamp(object $variant): int
{
error_clear_last();
$safeResult = \variant_date_to_timestamp($variant);
if ($safeResult === null) {
throw ComException::createFromPhpError();
}
return $safeResult;
}
/**
* Returns the value of value rounded to
* decimals decimal places.
*
* @param mixed $value The variant.
* @param int $decimals Number of decimal places.
* @return mixed Returns the rounded value.
* @throws ComException
*
*/
function variant_round($value, int $decimals)
{
error_clear_last();
$safeResult = \variant_round($value, $decimals);
if ($safeResult === null) {
throw ComException::createFromPhpError();
}
return $safeResult;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,160 +0,0 @@
<?php
namespace Safe;
use Safe\Exceptions\DirException;
/**
* Changes PHP's current directory to
* directory.
*
* @param string $directory The new current directory
* @throws DirException
*
*/
function chdir(string $directory): void
{
error_clear_last();
$safeResult = \chdir($directory);
if ($safeResult === false) {
throw DirException::createFromPhpError();
}
}
/**
* Changes the root directory of the current process to
* directory, and changes the current
* working directory to "/".
*
* This function is only available to GNU and BSD systems, and
* only when using the CLI, CGI or Embed SAPI. Also, this function
* requires root privileges.
*
* Calling this function does not change the values of the __DIR__
* and __FILE__ magic constants.
*
* @param string $directory The path to change the root directory to.
* @throws DirException
*
*/
function chroot(string $directory): void
{
error_clear_last();
$safeResult = \chroot($directory);
if ($safeResult === false) {
throw DirException::createFromPhpError();
}
}
/**
* A pseudo-object-oriented mechanism for reading a directory. The
* given directory is opened.
*
* @param string $directory Directory to open
* @param null|resource $context A context stream
* resource.
* @return \Directory Returns an instance of Directory, or FALSE in case of error.
* @throws DirException
*
*/
function dir(string $directory, $context = null): \Directory
{
error_clear_last();
if ($context !== null) {
$safeResult = \dir($directory, $context);
} else {
$safeResult = \dir($directory);
}
if ($safeResult === false) {
throw DirException::createFromPhpError();
}
return $safeResult;
}
/**
* Gets the current working directory.
*
* @return non-empty-string Returns the current working directory on success.
*
* On some Unix variants, getcwd will return
* FALSE if any one of the parent directories does not have the
* readable or search mode set, even if the current directory
* does. See chmod for more information on
* modes and permissions.
* @throws DirException
*
*/
function getcwd(): string
{
error_clear_last();
$safeResult = \getcwd();
if ($safeResult === false) {
throw DirException::createFromPhpError();
}
return $safeResult;
}
/**
* Opens up a directory handle to be used in subsequent
* closedir, readdir, and
* rewinddir calls.
*
* @param string $directory The directory path that is to be opened
* @param null|resource $context For a description of the context parameter,
* refer to the streams section of
* the manual.
* @return resource Returns a directory handle resource on success
* @throws DirException
*
*/
function opendir(string $directory, $context = null)
{
error_clear_last();
if ($context !== null) {
$safeResult = \opendir($directory, $context);
} else {
$safeResult = \opendir($directory);
}
if ($safeResult === false) {
throw DirException::createFromPhpError();
}
return $safeResult;
}
/**
* Returns an array of files and directories from the
* directory.
*
* @param string $directory The directory that will be scanned.
* @param SCANDIR_SORT_ASCENDING|SCANDIR_SORT_DESCENDING|SCANDIR_SORT_NONE $sorting_order By default, the sorted order is alphabetical in ascending order. If
* the optional sorting_order is set to
* SCANDIR_SORT_DESCENDING, then the sort order is
* alphabetical in descending order. If it is set to
* SCANDIR_SORT_NONE then the result is unsorted.
* @param null|resource $context For a description of the context parameter,
* refer to the streams section of
* the manual.
* @return list Returns an array of filenames on success. If directory is not a directory, then
* boolean FALSE is returned, and an error of level
* E_WARNING is generated.
* @throws DirException
*
*/
function scandir(string $directory, int $sorting_order = SCANDIR_SORT_ASCENDING, $context = null): array
{
error_clear_last();
if ($context !== null) {
$safeResult = \scandir($directory, $sorting_order, $context);
} else {
$safeResult = \scandir($directory, $sorting_order);
}
if ($safeResult === false) {
throw DirException::createFromPhpError();
}
return $safeResult;
}

File diff suppressed because it is too large Load Diff

View File

@@ -5,64 +5,10 @@
use Safe\Exceptions\ErrorfuncException;
/**
* Sends an error message to the web server's error log or to a file.
*
* @param string $message The error message that should be logged.
* @param 0|1|2|3|4 $message_type Says where the error should go. The possible message types are as
* follows:
*
*
* error_log log types
*
*
*
* 0
*
* message is sent to PHP's system logger, using
* the Operating System's system logging mechanism or a file, depending
* on what the error_log
* configuration directive is set to. This is the default option.
*
*
*
* 1
*
* message is sent by email to the address in
* the destination parameter. This is the only
* message type where the fourth parameter,
* additional_headers is used.
*
*
*
* 2
*
* No longer an option.
*
*
*
* 3
*
* message is appended to the file
* destination. A newline is not automatically
* added to the end of the message string.
*
*
*
* 4
*
* message is sent directly to the SAPI logging
* handler.
*
*
*
*
*
* @param null|string $destination The destination. Its meaning depends on the
* message_type parameter as described above.
* @param null|string $additional_headers The extra headers. It's used when the message_type
* parameter is set to 1.
* This message type uses the same internal function as
* mail does.
* @param string $message
* @param 0|1|2|3|4 $message_type
* @param null|string $destination
* @param null|string $additional_headers
* @throws ErrorfuncException
*
*/

View File

@@ -5,30 +5,10 @@
use Safe\Exceptions\ExecException;
/**
* exec executes the given
* command.
*
* @param string $command The command that will be executed.
* @param array|null $output If the output argument is present, then the
* specified array will be filled with every line of output from the
* command. Trailing whitespace, such as \n, is not
* included in this array. Note that if the array already contains some
* elements, exec will append to the end of the array.
* If you do not want the function to append elements, call
* unset on the array before passing it to
* exec.
* @param int|null $result_code If the result_code argument is present
* along with the output argument, then the
* return status of the executed command will be written to this
* variable.
* @return string The last line from the result of the command. If you need to execute a
* command and have all the data from the command passed directly back without
* any interference, use the passthru function.
*
* Returns FALSE on failure.
*
* To get the output of the executed command, be sure to set and use the
* output parameter.
* @param string $command
* @param array|null $output
* @param int|null $result_code
* @return string
* @throws ExecException
*
*/
@@ -44,47 +24,8 @@ function exec(string $command, ?array &$output = null, ?int &$result_code = null
/**
* The passthru function is similar to the
* exec function in that it executes a
* command. This function
* should be used in place of exec or
* system when the output from the Unix command
* is binary data which needs to be passed directly back to the
* browser. A common use for this is to execute something like the
* pbmplus utilities that can output an image stream directly. By
* setting the Content-type to image/gif and
* then calling a pbmplus program to output a gif, you can create
* PHP scripts that output images directly.
*
* @param string $command The command that will be executed.
* @param int|null $result_code If the result_code argument is present, the
* return status of the Unix command will be placed here.
* @throws ExecException
*
*/
function passthru(string $command, ?int &$result_code = null): void
{
error_clear_last();
$safeResult = \passthru($command, $result_code);
if ($safeResult === false) {
throw ExecException::createFromPhpError();
}
}
/**
* proc_close is similar to pclose
* except that it only works on processes opened by
* proc_open.
* proc_close waits for the process to terminate, and
* returns its exit code. Open pipes to that process are closed
* when this function is called, in
* order to avoid a deadlock - the child process may not be able to exit
* while the pipes are open.
*
* @param resource $process The proc_open resource that will
* be closed.
* @return int Returns the termination status of the process that was run.
* @param resource $process
* @return int
* @throws ExecException
*
*/
@@ -100,22 +41,7 @@ function proc_close($process): int
/**
* proc_nice changes the priority of the current
* process by the amount specified in priority. A
* positive priority will lower the priority of the
* current process, whereas a negative priority
* will raise the priority.
*
* proc_nice is not related to
* proc_open and its associated functions in any way.
*
* @param int $priority The new priority value, the value of this may differ on platforms.
*
* On Unix, a low value, such as -20 means high priority
* whereas positive values have a lower priority.
*
* For Windows the priority parameter has the
* following meaning:
* @param int $priority
* @throws ExecException
*
*/
@@ -130,81 +56,13 @@ function proc_nice(int $priority): void
/**
* proc_open is similar to popen
* but provides a much greater degree of control over the program execution.
*
* @param string $command The commandline to execute as string. Special characters have to be properly escaped,
* and proper quoting has to be applied.
*
* As of PHP 7.4.0, command may be passed as array of command parameters.
* In this case the process will be opened directly (without going through a shell)
* and PHP will take care of any necessary argument escaping.
*
* On Windows, the argument escaping of the array elements assumes that the
* command line parsing of the executed command is compatible with the parsing
* of command line arguments done by the VC runtime.
* @param array $descriptor_spec An indexed array where the key represents the descriptor number and the
* value represents how PHP will pass that descriptor to the child
* process. 0 is stdin, 1 is stdout, while 2 is stderr.
*
* Each element can be:
*
* An array describing the pipe to pass to the process. The first
* element is the descriptor type and the second element is an option for
* the given type. Valid types are pipe (the second
* element is either r to pass the read end of the pipe
* to the process, or w to pass the write end) and
* file (the second element is a filename).
* Note that anything else than w is treated like r.
*
*
* A stream resource representing a real file descriptor (e.g. opened file,
* a socket, STDIN).
*
*
*
* The file descriptor numbers are not limited to 0, 1 and 2 - you may
* specify any valid file descriptor number and it will be passed to the
* child process. This allows your script to interoperate with other
* scripts that run as "co-processes". In particular, this is useful for
* passing passphrases to programs like PGP, GPG and openssl in a more
* secure manner. It is also useful for reading status information
* provided by those programs on auxiliary file descriptors.
* @param null|resource[] $pipes Will be set to an indexed array of file pointers that correspond to
* PHP's end of any pipes that are created.
* @param null|string $cwd The initial working dir for the command. This must be an
* absolute directory path, or NULL
* if you want to use the default value (the working dir of the current
* PHP process)
* @param array|null $env_vars An array with the environment variables for the command that will be
* run, or NULL to use the same environment as the current PHP process
* @param array|null $options Allows you to specify additional options. Currently supported options
* include:
*
*
* suppress_errors (windows only): suppresses errors
* generated by this function when it's set to TRUE
*
*
* bypass_shell (windows only): bypass
* cmd.exe shell when set to TRUE
*
*
* blocking_pipes (windows only): force
* blocking pipes when set to TRUE
*
*
* create_process_group (windows only): allow the
* child process to handle CTRL events when set to TRUE
*
*
* create_new_console (windows only): the new process
* has a new console, instead of inheriting its parent's console
*
*
* @return resource Returns a resource representing the process, which should be freed using
* proc_close when you are finished with it. On failure
* returns FALSE.
* @param string $command
* @param array $descriptor_spec
* @param null|resource[] $pipes
* @param null|string $cwd
* @param array|null $env_vars
* @param array|null $options
* @return resource
* @throws ExecException
*
*/
@@ -228,10 +86,8 @@ function proc_open(string $command, array $descriptor_spec, ?array &$pipes, ?str
/**
* This function is identical to the backtick operator.
*
* @param string $command The command that will be executed.
* @return null|string A string containing the output from the executed command or NULL if an error occurs or the command produces no output.
* @param string $command
* @return null|string
* @throws ExecException
*
*/
@@ -247,23 +103,9 @@ function shell_exec(string $command): ?string
/**
* system is just like the C version of the
* function in that it executes the given
* command and outputs the result.
*
* The system call also tries to automatically
* flush the web server's output buffer after each line of output if
* PHP is running as a server module.
*
* If you need to execute a command and have all the data from the
* command passed directly back without any interference, use the
* passthru function.
*
* @param string $command The command that will be executed.
* @param int|null $result_code If the result_code argument is present, then the
* return status of the executed command will be written to this
* variable.
* @return string Returns the last line of the command output on success.
* @param string $command
* @param int|null $result_code
* @return string
* @throws ExecException
*
*/

View File

@@ -1,79 +0,0 @@
<?php
namespace Safe;
use Safe\Exceptions\FileinfoException;
/**
* This function closes the instance opened by finfo_open.
*
* @param \finfo $finfo An finfo instance, returned by finfo_open.
* @throws FileinfoException
*
*/
function finfo_close(\finfo $finfo): void
{
error_clear_last();
$safeResult = \finfo_close($finfo);
if ($safeResult === false) {
throw FileinfoException::createFromPhpError();
}
}
/**
* Procedural style
*
* Object-oriented style (constructor):
*
* This function opens a magic database and returns its instance.
*
* @param int $flags One or disjunction of more Fileinfo
* constants.
* @param null|string $magic_database Name of a magic database file, usually something like
* /path/to/magic.mime. If not specified, the
* MAGIC environment variable is used. If the
* environment variable isn't set, then PHP's bundled magic database will
* be used.
*
* Passing NULL or an empty string will be equivalent to the default
* value.
* @return \finfo (Procedural style only)
* Returns an finfo instance on success.
* @throws FileinfoException
*
*/
function finfo_open(int $flags = FILEINFO_NONE, ?string $magic_database = null): \finfo
{
error_clear_last();
if ($magic_database !== null) {
$safeResult = \finfo_open($flags, $magic_database);
} else {
$safeResult = \finfo_open($flags);
}
if ($safeResult === false) {
throw FileinfoException::createFromPhpError();
}
return $safeResult;
}
/**
* Returns the MIME content type for a file as determined by using
* information from the magic.mime file.
*
* @param resource|string $filename Path to the tested file.
* @return string Returns the content type in MIME format, like
* text/plain or application/octet-stream.
* @throws FileinfoException
*
*/
function mime_content_type($filename): string
{
error_clear_last();
$safeResult = \mime_content_type($filename);
if ($safeResult === false) {
throw FileinfoException::createFromPhpError();
}
return $safeResult;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,81 +0,0 @@
<?php
namespace Safe;
use Safe\Exceptions\FilterException;
/**
* This function is useful for retrieving many values without
* repetitively calling filter_input.
*
* @param int $type One of INPUT_GET, INPUT_POST,
* INPUT_COOKIE, INPUT_SERVER, or
* INPUT_ENV.
* @param array|int $options An array defining the arguments. A valid key is a string
* containing a variable name and a valid value is either a filter type, or an array
* optionally specifying the filter, flags and options. If the value is an
* array, valid keys are filter which specifies the
* filter type,
* flags which specifies any flags that apply to the
* filter, and options which specifies any options that
* apply to the filter. See the example below for a better understanding.
*
* This parameter can be also an integer holding a filter constant. Then all values in the
* input array are filtered by this filter.
* @param bool $add_empty Add missing keys as NULL to the return value.
* @return array|null An array containing the values of the requested variables on success.
* If the input array designated by type is not populated,
* the function returns NULL if the FILTER_NULL_ON_FAILURE
* flag is not given, or FALSE otherwise. For other failures, FALSE is returned.
*
* An array value will be FALSE if the filter fails, or NULL if
* the variable is not set. Or if the flag FILTER_NULL_ON_FAILURE
* is used, it returns FALSE if the variable is not set and NULL if the filter
* fails. If the add_empty parameter is FALSE, no array
* element will be added for unset variables.
* @throws FilterException
*
*/
function filter_input_array(int $type, $options = FILTER_DEFAULT, bool $add_empty = true): ?array
{
error_clear_last();
$safeResult = \filter_input_array($type, $options, $add_empty);
if ($safeResult === false) {
throw FilterException::createFromPhpError();
}
return $safeResult;
}
/**
* This function is useful for retrieving many values without
* repetitively calling filter_var.
*
* @param array $array An array with string keys containing the data to filter.
* @param mixed $options An array defining the arguments. A valid key is a string
* containing a variable name and a valid value is either a
* filter type, or an
* array optionally specifying the filter, flags and options.
* If the value is an array, valid keys are filter
* which specifies the filter type,
* flags which specifies any flags that apply to the
* filter, and options which specifies any options that
* apply to the filter. See the example below for a better understanding.
*
* This parameter can be also an integer holding a filter constant. Then all values in the
* input array are filtered by this filter.
* @param bool $add_empty Add missing keys as NULL to the return value.
* @return array|null An array containing the values of the requested variables on success. An array value will be FALSE if the filter fails, or NULL if
* the variable is not set.
* @throws FilterException
*
*/
function filter_var_array(array $array, $options = FILTER_DEFAULT, bool $add_empty = true): ?array
{
error_clear_last();
$safeResult = \filter_var_array($array, $options, $add_empty);
if ($safeResult === false) {
throw FilterException::createFromPhpError();
}
return $safeResult;
}

View File

@@ -5,10 +5,6 @@
use Safe\Exceptions\FpmException;
/**
* This function flushes all response data to the client and finishes the
* request. This allows for time consuming tasks to be performed without
* leaving the connection to the client open.
*
* @throws FpmException
*
*/
@@ -23,14 +19,7 @@ function fastcgi_finish_request(): void
/**
* This function returns the full current FPM pool status as an associative array. It always
* returns the full status, including per-process status information. See the
* FPM status page guide for further
* details.
*
* Note that this function will only be defined if FPM is being used to serve the script.
*
* @return array{pool: string, process-manager: 'dynamic'|'ondemand'|'static', start-time: int, start-since: int, accepted-conn: int, listen-queue: int, max-listen-queue: int, listen-queue-len: int, idle-processes: int, active-processes: int, total-processes: int, max-active-processes: int, max-children-reached: 0|1, slow-requests: int, procs: array} Associative array containing the full FPM pool status.
* @return array{pool: string, process-manager: 'dynamic'|'ondemand'|'static', start-time: int, start-since: int, accepted-conn: int, listen-queue: int, max-listen-queue: int, listen-queue-len: int, idle-processes: int, active-processes: int, total-processes: int, max-active-processes: int, max-children-reached: 0|1, slow-requests: int, procs: array}
* @throws FpmException
*
*/

View File

@@ -1,568 +0,0 @@
<?php
namespace Safe;
use Safe\Exceptions\FtpException;
/**
* Sends an ALLO command to the remote FTP server to
* allocate space for a file to be uploaded.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param int $size The number of bytes to allocate.
* @param null|string $response A textual representation of the servers response will be returned by
* reference in response if a variable is provided.
* @throws FtpException
*
*/
function ftp_alloc(\FTP\Connection $ftp, int $size, ?string &$response = null): void
{
error_clear_last();
$safeResult = \ftp_alloc($ftp, $size, $response);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
}
/**
*
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $remote_filename
* @param string $local_filename
* @param FTP_ASCII|FTP_BINARY $mode
* @throws FtpException
*
*/
function ftp_append(\FTP\Connection $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY): void
{
error_clear_last();
$safeResult = \ftp_append($ftp, $remote_filename, $local_filename, $mode);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
}
/**
* Changes to the parent directory.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @throws FtpException
*
*/
function ftp_cdup(\FTP\Connection $ftp): void
{
error_clear_last();
$safeResult = \ftp_cdup($ftp);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
}
/**
* Changes the current directory to the specified one.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $directory The target directory.
* @throws FtpException
*
*/
function ftp_chdir(\FTP\Connection $ftp, string $directory): void
{
error_clear_last();
$safeResult = \ftp_chdir($ftp, $directory);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
}
/**
* Sets the permissions on the specified remote file to
* permissions.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param int $permissions The new permissions, given as an octal value.
* @param string $filename The remote file.
* @return int Returns the new file permissions on success.
* @throws FtpException
*
*/
function ftp_chmod(\FTP\Connection $ftp, int $permissions, string $filename): int
{
error_clear_last();
$safeResult = \ftp_chmod($ftp, $permissions, $filename);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
return $safeResult;
}
/**
* ftp_close closes the given link identifier
* and releases the resource.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @throws FtpException
*
*/
function ftp_close(\FTP\Connection $ftp): void
{
error_clear_last();
$safeResult = \ftp_close($ftp);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
}
/**
* ftp_connect opens an FTP connection to the
* specified hostname.
*
* @param string $hostname The FTP server address. This parameter shouldn't have any trailing
* slashes and shouldn't be prefixed with ftp://.
* @param int $port This parameter specifies an alternate port to connect to. If it is
* omitted or set to zero, then the default FTP port, 21, will be used.
* @param int $timeout This parameter specifies the timeout in seconds for all subsequent network operations.
* If omitted, the default value is 90 seconds. The timeout can be changed and
* queried at any time with ftp_set_option and
* ftp_get_option.
* @return \FTP\Connection Returns an FTP\Connection instance on success.
* @throws FtpException
*
*/
function ftp_connect(string $hostname, int $port = 21, int $timeout = 90): \FTP\Connection
{
error_clear_last();
$safeResult = \ftp_connect($hostname, $port, $timeout);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
return $safeResult;
}
/**
* ftp_delete deletes the file specified by
* filename from the FTP server.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $filename The file to delete.
* @throws FtpException
*
*/
function ftp_delete(\FTP\Connection $ftp, string $filename): void
{
error_clear_last();
$safeResult = \ftp_delete($ftp, $filename);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
}
/**
* ftp_fget retrieves remote_filename
* from the FTP server, and writes it to the given file pointer.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param resource $stream An open file pointer in which we store the data.
* @param string $remote_filename The remote file path.
* @param FTP_ASCII|FTP_BINARY $mode The transfer mode. Must be either FTP_ASCII or
* FTP_BINARY.
* @param int $offset The position in the remote file to start downloading from.
* @throws FtpException
*
*/
function ftp_fget(\FTP\Connection $ftp, $stream, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): void
{
error_clear_last();
$safeResult = \ftp_fget($ftp, $stream, $remote_filename, $mode, $offset);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
}
/**
* ftp_fput uploads the data from a file pointer
* to a remote file on the FTP server.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $remote_filename The remote file path.
* @param resource $stream An open file pointer on the local file. Reading stops at end of file.
* @param FTP_ASCII|FTP_BINARY $mode The transfer mode. Must be either FTP_ASCII or
* FTP_BINARY.
* @param int $offset The position in the remote file to start uploading to.
* @throws FtpException
*
*/
function ftp_fput(\FTP\Connection $ftp, string $remote_filename, $stream, int $mode = FTP_BINARY, int $offset = 0): void
{
error_clear_last();
$safeResult = \ftp_fput($ftp, $remote_filename, $stream, $mode, $offset);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
}
/**
* ftp_get retrieves a remote file from the FTP server,
* and saves it into a local file.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $local_filename The local file path (will be overwritten if the file already exists).
* @param string $remote_filename The remote file path.
* @param FTP_ASCII|FTP_BINARY $mode The transfer mode. Must be either FTP_ASCII or
* FTP_BINARY.
* @param int $offset The position in the remote file to start downloading from.
* @throws FtpException
*
*/
function ftp_get(\FTP\Connection $ftp, string $local_filename, string $remote_filename, int $mode = FTP_BINARY, int $offset = 0): void
{
error_clear_last();
$safeResult = \ftp_get($ftp, $local_filename, $remote_filename, $mode, $offset);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
}
/**
* Logs in to the given FTP connection.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $username The username (USER).
* @param string $password The password (PASS).
* @throws FtpException
*
*/
function ftp_login(\FTP\Connection $ftp, string $username, string $password): void
{
error_clear_last();
$safeResult = \ftp_login($ftp, $username, $password);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
}
/**
* Creates the specified directory on the FTP server.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $directory The name of the directory that will be created.
* @return string Returns the newly created directory name on success.
* @throws FtpException
*
*/
function ftp_mkdir(\FTP\Connection $ftp, string $directory): string
{
error_clear_last();
$safeResult = \ftp_mkdir($ftp, $directory);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
return $safeResult;
}
/**
*
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $directory The directory to be listed.
* @return array Returns an array of arrays with file infos from the specified directory on success.
* @throws FtpException
*
*/
function ftp_mlsd(\FTP\Connection $ftp, string $directory): array
{
error_clear_last();
$safeResult = \ftp_mlsd($ftp, $directory);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
return $safeResult;
}
/**
* ftp_nb_put stores a local file on the FTP server.
*
* The difference between this function and the ftp_put
* is that this function uploads the file asynchronously, so your program can
* perform other operations while the file is being uploaded.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $remote_filename The remote file path.
* @param string $local_filename The local file path.
* @param FTP_ASCII|FTP_BINARY $mode The transfer mode. Must be either FTP_ASCII or
* FTP_BINARY.
* @param int $offset The position in the remote file to start uploading to.
* @return int Returns FTP_FAILED or FTP_FINISHED
* or FTP_MOREDATA to open the local file.
* @throws FtpException
*
*/
function ftp_nb_put(\FTP\Connection $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): int
{
error_clear_last();
$safeResult = \ftp_nb_put($ftp, $remote_filename, $local_filename, $mode, $offset);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
return $safeResult;
}
/**
*
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $directory The directory to be listed. This parameter can also include arguments, eg.
* ftp_nlist($ftp, "-la /your/dir");.
* Note that this parameter isn't escaped so there may be some issues with
* filenames containing spaces and other characters.
* @return array Returns an array of filenames from the specified directory on success.
* @throws FtpException
*
*/
function ftp_nlist(\FTP\Connection $ftp, string $directory): array
{
error_clear_last();
$safeResult = \ftp_nlist($ftp, $directory);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
return $safeResult;
}
/**
* ftp_pasv turns on or off passive mode. In
* passive mode, data connections are initiated by the client,
* rather than by the server.
* It may be needed if the client is behind firewall.
*
* Please note that ftp_pasv can only be called after a
* successful login or otherwise it will fail.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param bool $enable If TRUE, the passive mode is turned on, else it's turned off.
* @throws FtpException
*
*/
function ftp_pasv(\FTP\Connection $ftp, bool $enable): void
{
error_clear_last();
$safeResult = \ftp_pasv($ftp, $enable);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
}
/**
* ftp_put stores a local file on the FTP server.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $remote_filename The remote file path.
* @param string $local_filename The local file path.
* @param FTP_ASCII|FTP_BINARY $mode The transfer mode. Must be either FTP_ASCII or
* FTP_BINARY.
* @param int $offset The position in the remote file to start uploading to.
* @throws FtpException
*
*/
function ftp_put(\FTP\Connection $ftp, string $remote_filename, string $local_filename, int $mode = FTP_BINARY, int $offset = 0): void
{
error_clear_last();
$safeResult = \ftp_put($ftp, $remote_filename, $local_filename, $mode, $offset);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
}
/**
*
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @return string Returns the current directory name.
* @throws FtpException
*
*/
function ftp_pwd(\FTP\Connection $ftp): string
{
error_clear_last();
$safeResult = \ftp_pwd($ftp);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
return $safeResult;
}
/**
* Sends an arbitrary command to the FTP server.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $command The command to execute.
* @return array Returns the server's response as an array of strings.
* No parsing is performed on the response string, nor does
* ftp_raw determine if the command succeeded.
* @throws FtpException
*
*/
function ftp_raw(\FTP\Connection $ftp, string $command): array
{
error_clear_last();
$safeResult = \ftp_raw($ftp, $command);
if ($safeResult === null) {
throw FtpException::createFromPhpError();
}
return $safeResult;
}
/**
* ftp_rename renames a file or a directory on the FTP
* server.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $from The old file/directory name.
* @param string $to The new name.
* @throws FtpException
*
*/
function ftp_rename(\FTP\Connection $ftp, string $from, string $to): void
{
error_clear_last();
$safeResult = \ftp_rename($ftp, $from, $to);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
}
/**
* Removes the specified directory on the FTP server.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $directory The directory to delete. This must be either an absolute or relative
* path to an empty directory.
* @throws FtpException
*
*/
function ftp_rmdir(\FTP\Connection $ftp, string $directory): void
{
error_clear_last();
$safeResult = \ftp_rmdir($ftp, $directory);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
}
/**
* ftp_site sends the given SITE
* command to the FTP server.
*
* SITE commands are not standardized, and vary from server
* to server. They are useful for handling such things as file permissions and
* group membership.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $command The SITE command. Note that this parameter isn't escaped so there may
* be some issues with filenames containing spaces and other characters.
* @throws FtpException
*
*/
function ftp_site(\FTP\Connection $ftp, string $command): void
{
error_clear_last();
$safeResult = \ftp_site($ftp, $command);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
}
/**
* ftp_size returns the size of the given file in
* bytes.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @param string $filename The remote file.
* @return int Returns the file size on success.
* @throws FtpException
*
*/
function ftp_size(\FTP\Connection $ftp, string $filename): int
{
error_clear_last();
$safeResult = \ftp_size($ftp, $filename);
if ($safeResult === -1) {
throw FtpException::createFromPhpError();
}
return $safeResult;
}
/**
* ftp_ssl_connect opens an explicit SSL-FTP connection to the
* specified hostname. That implies that
* ftp_ssl_connect will succeed even if the server is not
* configured for SSL-FTP, or its certificate is invalid. Only when
* ftp_login is called, the client will send the
* appropriate AUTH FTP command, so ftp_login will fail in
* the mentioned cases.
*
* @param string $hostname The FTP server address. This parameter shouldn't have any trailing
* slashes and shouldn't be prefixed with ftp://.
* @param int $port This parameter specifies an alternate port to connect to. If it is
* omitted or set to zero, then the default FTP port, 21, will be used.
* @param int $timeout This parameter specifies the timeout for all subsequent network operations.
* If omitted, the default value is 90 seconds. The timeout can be changed and
* queried at any time with ftp_set_option and
* ftp_get_option.
* @return \FTP\Connection Returns an FTP\Connection instance on success.
* @throws FtpException
*
*/
function ftp_ssl_connect(string $hostname, int $port = 21, int $timeout = 90): \FTP\Connection
{
error_clear_last();
$safeResult = \ftp_ssl_connect($hostname, $port, $timeout);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
return $safeResult;
}
/**
* Returns the system type identifier of the remote FTP server.
*
* @param \FTP\Connection $ftp An FTP\Connection instance.
* @return string Returns the remote system type.
* @throws FtpException
*
*/
function ftp_systype(\FTP\Connection $ftp): string
{
error_clear_last();
$safeResult = \ftp_systype($ftp);
if ($safeResult === false) {
throw FtpException::createFromPhpError();
}
return $safeResult;
}

View File

@@ -1,26 +0,0 @@
<?php
namespace Safe;
use Safe\Exceptions\FunchandException;
/**
*
*
* @param callable(): void $callback The function to register.
* @param mixed $args
* @throws FunchandException
*
*/
function register_tick_function(callable $callback, ...$args): void
{
error_clear_last();
if ($args !== []) {
$safeResult = \register_tick_function($callback, ...$args);
} else {
$safeResult = \register_tick_function($callback);
}
if ($safeResult === false) {
throw FunchandException::createFromPhpError();
}
}

Some files were not shown because too many files have changed in this diff Show More