Update website
This commit is contained in:
parent
bb4b0f9be8
commit
011b183e28
4263 changed files with 3014 additions and 720369 deletions
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ApacheException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ApcuException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ArrayException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class Bzip2Exception extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class CalendarException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ClassobjException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ComException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class CubridException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class DatetimeException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class DirException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class EioException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ErrorfuncException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ExecException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class FileinfoException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class FilesystemException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class FilterException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class FpmException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class FtpException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class FunchandException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class GmpException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class GnupgException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class HashException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class IbaseException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class IbmDb2Exception extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class IconvException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ImageException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ImapException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class InfoException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class IngresiiException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class InotifyException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class LdapException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class LibxmlException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class LzfException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class MailparseException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class MbstringException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class MiscException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class MsqlException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class MysqlException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class MysqliException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class MysqlndMsException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class MysqlndQcException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class NetworkException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class Oci8Exception extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class OpcacheException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class OutcontrolException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class PasswordException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class PcntlException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class PdfException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class PgsqlException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class PosixException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class PsException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class PspellException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ReadlineException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class RpminfoException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class RrdException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class SemException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class SessionException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ShmopException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class SimplexmlException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class SocketsException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class SodiumException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class SolrException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class SplException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class SqlsrvException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class SsdeepException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class Ssh2Exception extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class StreamException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class StringsException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class SwooleException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class UodbcException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class UopzException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class UrlException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class VarException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class XdiffException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class XmlException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class XmlrpcException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class YamlException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class YazException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ZipException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
namespace Safe\Exceptions;
|
||||
|
||||
class ZlibException extends \ErrorException implements SafeExceptionInterface
|
||||
{
|
||||
public static function createFromPhpError(): self
|
||||
{
|
||||
$error = error_get_last();
|
||||
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
|
||||
}
|
||||
}
|
|
@ -1,177 +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();
|
||||
$result = \apache_get_version();
|
||||
if ($result === false) {
|
||||
throw ApacheException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve an Apache environment variable specified by
|
||||
* variable.
|
||||
*
|
||||
* This function requires Apache 2 otherwise it's undefined.
|
||||
*
|
||||
* @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();
|
||||
$result = \apache_getenv($variable, $walk_to_top);
|
||||
if ($result === false) {
|
||||
throw ApacheException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetches all HTTP request headers from the current request. Works in the
|
||||
* Apache, FastCGI, CLI, FPM and NSAPI server module
|
||||
* in Netscape/iPlanet/SunONE 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();
|
||||
$result = \apache_request_headers();
|
||||
if ($result === false) {
|
||||
throw ApacheException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* apache_reset_timeout resets the Apache write timer,
|
||||
* which defaults to 300 seconds. With set_time_limit(0);
|
||||
* ignore_user_abort(true) and periodic
|
||||
* apache_reset_timeout calls, Apache can theoretically
|
||||
* run forever.
|
||||
*
|
||||
* This function requires Apache 1.
|
||||
*
|
||||
* @throws ApacheException
|
||||
*
|
||||
*/
|
||||
function apache_reset_timeout(): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \apache_reset_timeout();
|
||||
if ($result === false) {
|
||||
throw ApacheException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fetch all HTTP response headers. Works in the
|
||||
* Apache, FastCGI, CLI, FPM and NSAPI server module
|
||||
* in Netscape/iPlanet/SunONE webservers.
|
||||
*
|
||||
* @return array An array of all Apache response headers on success.
|
||||
* @throws ApacheException
|
||||
*
|
||||
*/
|
||||
function apache_response_headers(): array
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \apache_response_headers();
|
||||
if ($result === false) {
|
||||
throw ApacheException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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();
|
||||
$result = \apache_setenv($variable, $value, $walk_to_top);
|
||||
if ($result === 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();
|
||||
$result = \getallheaders();
|
||||
if ($result === false) {
|
||||
throw ApacheException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 $filename The file that the virtual command will be performed on.
|
||||
* @throws ApacheException
|
||||
*
|
||||
*/
|
||||
function virtual(string $filename): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \virtual($filename);
|
||||
if ($result === false) {
|
||||
throw ApacheException::createFromPhpError();
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
$result = \apcu_cache_info($limited);
|
||||
if ($result === false) {
|
||||
throw ApcuException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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();
|
||||
$result = \apcu_cas($key, $old, $new);
|
||||
if ($result === 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();
|
||||
$result = \apcu_dec($key, $step, $success, $ttl);
|
||||
if ($result === false) {
|
||||
throw ApcuException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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();
|
||||
$result = \apcu_inc($key, $step, $success, $ttl);
|
||||
if ($result === false) {
|
||||
throw ApcuException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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();
|
||||
$result = \apcu_sma_info($limited);
|
||||
if ($result === false) {
|
||||
throw ApcuException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
|
@ -1,464 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
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.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function array_combine(array $keys, array $values): array
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \array_combine($keys, $values);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* array_flip returns an array in flip
|
||||
* order, i.e. keys from array become values and values
|
||||
* from array become keys.
|
||||
*
|
||||
* Note that the values of array need to be valid
|
||||
* keys, i.e. they need to be either integer or
|
||||
* string. A warning will be emitted if a value has the wrong
|
||||
* type, and the key/value pair in question will not be included
|
||||
* in the result.
|
||||
*
|
||||
* If a value has several occurrences, the latest key will be
|
||||
* used as its value, and all others will be lost.
|
||||
*
|
||||
* @param array $array An array of key/value pairs to be flipped.
|
||||
* @return array Returns the flipped array on success.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function array_flip(array $array): array
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \array_flip($array);
|
||||
if ($result === null) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* array_replace_recursive replaces the values of
|
||||
* array1 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 $array1 The array in which elements are replaced.
|
||||
* @param array $params Optional. Arrays from which elements will be extracted.
|
||||
* @return array Returns an array.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function array_replace_recursive(array $array1, array ...$params): array
|
||||
{
|
||||
error_clear_last();
|
||||
if ($params !== []) {
|
||||
$result = \array_replace_recursive($array1, ...$params);
|
||||
} else {
|
||||
$result = \array_replace_recursive($array1);
|
||||
}
|
||||
if ($result === null) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* array_replace replaces the values of
|
||||
* array1 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 $array1 The array in which elements are replaced.
|
||||
* @param array $params Arrays from which elements will be extracted.
|
||||
* Values from later arrays overwrite the previous values.
|
||||
* @return array Returns an array.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function array_replace(array $array1, array ...$params): array
|
||||
{
|
||||
error_clear_last();
|
||||
if ($params !== []) {
|
||||
$result = \array_replace($array1, ...$params);
|
||||
} else {
|
||||
$result = \array_replace($array1);
|
||||
}
|
||||
if ($result === null) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Applies the user-defined callback function to each
|
||||
* element of the array. This function will recurse
|
||||
* into deeper arrays.
|
||||
*
|
||||
* @param array $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 $userdata If the optional userdata parameter is supplied,
|
||||
* it will be passed as the third parameter to the
|
||||
* callback.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function array_walk_recursive(array &$array, callable $callback, $userdata = null): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \array_walk_recursive($array, $callback, $userdata);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function sorts an array such that array indices maintain their
|
||||
* correlation with the array elements they are associated with.
|
||||
*
|
||||
* This is used mainly when sorting associative arrays where the actual
|
||||
* element order is significant.
|
||||
*
|
||||
* @param array $array The input array.
|
||||
* @param int $sort_flags You may modify the behavior of the sort using the optional parameter
|
||||
* sort_flags, for details see
|
||||
* sort.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function arsort(array &$array, int $sort_flags = SORT_REGULAR): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \arsort($array, $sort_flags);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function sorts an array such that array indices maintain
|
||||
* their correlation with the array elements they are associated
|
||||
* with. This is used mainly when sorting associative arrays where
|
||||
* the actual element order is significant.
|
||||
*
|
||||
* @param array $array The input array.
|
||||
* @param int $sort_flags You may modify the behavior of the sort using the optional
|
||||
* parameter sort_flags, for details
|
||||
* see sort.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function asort(array &$array, int $sort_flags = SORT_REGULAR): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \asort($array, $sort_flags);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sorts an array by key in reverse order, maintaining key to data
|
||||
* correlations. This is useful mainly for associative arrays.
|
||||
*
|
||||
* @param array $array The input array.
|
||||
* @param int $sort_flags You may modify the behavior of the sort using the optional parameter
|
||||
* sort_flags, for details see
|
||||
* sort.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function krsort(array &$array, int $sort_flags = SORT_REGULAR): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \krsort($array, $sort_flags);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sorts an array by key, maintaining key to data correlations. This is
|
||||
* useful mainly for associative arrays.
|
||||
*
|
||||
* @param array $array The input array.
|
||||
* @param int $sort_flags You may modify the behavior of the sort using the optional
|
||||
* parameter sort_flags, for details
|
||||
* see sort.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function ksort(array &$array, int $sort_flags = SORT_REGULAR): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ksort($array, $sort_flags);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* natcasesort is a case insensitive version of
|
||||
* natsort.
|
||||
*
|
||||
* This function implements a sort algorithm that orders
|
||||
* alphanumeric strings in the way a human being would while maintaining
|
||||
* key/value associations. This is described as a "natural ordering".
|
||||
*
|
||||
* @param array $array The input array.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function natcasesort(array &$array): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \natcasesort($array);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function implements a sort algorithm that orders alphanumeric strings
|
||||
* in the way a human being would while maintaining key/value associations.
|
||||
* This is described as a "natural ordering". An example of the difference
|
||||
* between this algorithm and the regular computer string sorting algorithms
|
||||
* (used in sort) can be seen in the example below.
|
||||
*
|
||||
* @param array $array The input array.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function natsort(array &$array): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \natsort($array);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function sorts an array in reverse order (highest to lowest).
|
||||
*
|
||||
* @param array $array The input array.
|
||||
* @param int $sort_flags You may modify the behavior of the sort using the optional
|
||||
* parameter sort_flags, for details see
|
||||
* sort.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function rsort(array &$array, int $sort_flags = SORT_REGULAR): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \rsort($array, $sort_flags);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function shuffles (randomizes the order of the elements in) an array.
|
||||
* It uses a pseudo random number generator that is not suitable for
|
||||
* cryptographic purposes.
|
||||
*
|
||||
* @param array $array The array.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function shuffle(array &$array): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \shuffle($array);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function sorts an array. Elements will be arranged from
|
||||
* lowest to highest when this function has completed.
|
||||
*
|
||||
* @param array $array The input array.
|
||||
* @param int $sort_flags The optional second parameter sort_flags
|
||||
* may be used to modify the sorting behavior using these values:
|
||||
*
|
||||
* Sorting type flags:
|
||||
*
|
||||
*
|
||||
* SORT_REGULAR - compare items normally;
|
||||
* the details are described in the comparison operators section
|
||||
*
|
||||
*
|
||||
* SORT_NUMERIC - compare items numerically
|
||||
*
|
||||
*
|
||||
* SORT_STRING - compare items as strings
|
||||
*
|
||||
*
|
||||
*
|
||||
* SORT_LOCALE_STRING - compare items as
|
||||
* strings, based on the current locale. It uses the locale,
|
||||
* which can be changed using setlocale
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* SORT_NATURAL - compare items as strings
|
||||
* using "natural ordering" like natsort
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* SORT_FLAG_CASE - can be combined
|
||||
* (bitwise OR) with
|
||||
* SORT_STRING or
|
||||
* SORT_NATURAL to sort strings case-insensitively
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function sort(array &$array, int $sort_flags = SORT_REGULAR): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \sort($array, $sort_flags);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function sorts an array such that array indices maintain their
|
||||
* correlation with the array elements they are associated with, using a
|
||||
* user-defined comparison function.
|
||||
*
|
||||
* This is used mainly when sorting associative arrays where the actual
|
||||
* element order is significant.
|
||||
*
|
||||
* @param array $array The input array.
|
||||
* @param callable $value_compare_func See usort and uksort for
|
||||
* examples of user-defined comparison functions.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function uasort(array &$array, callable $value_compare_func): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \uasort($array, $value_compare_func);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* uksort will sort the keys of an array using a
|
||||
* user-supplied comparison function. If the array you wish to sort
|
||||
* needs to be sorted by some non-trivial criteria, you should use
|
||||
* this function.
|
||||
*
|
||||
* @param array $array The input array.
|
||||
* @param callable $key_compare_func The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
|
||||
* Note that before PHP 7.0.0 this integer had to be in the range from -2147483648 to 2147483647.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function uksort(array &$array, callable $key_compare_func): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \uksort($array, $key_compare_func);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function will sort an array by its values using a user-supplied
|
||||
* comparison function. If the array you wish to sort needs to be sorted by
|
||||
* some non-trivial criteria, you should use this function.
|
||||
*
|
||||
* @param array $array The input array.
|
||||
* @param callable $value_compare_func The comparison function must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
|
||||
* Note that before PHP 7.0.0 this integer had to be in the range from -2147483648 to 2147483647.
|
||||
*
|
||||
* Returning non-integer values from the comparison
|
||||
* function, such as float, will result in an internal cast to
|
||||
* integer of the callback's return value. So values such as
|
||||
* 0.99 and 0.1 will both be cast to an integer value of 0, which will
|
||||
* compare such values as equal.
|
||||
* @throws ArrayException
|
||||
*
|
||||
*/
|
||||
function usort(array &$array, callable $value_compare_func): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \usort($array, $value_compare_func);
|
||||
if ($result === false) {
|
||||
throw ArrayException::createFromPhpError();
|
||||
}
|
||||
}
|
|
@ -1,96 +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();
|
||||
$result = \bzclose($bz);
|
||||
if ($result === false) {
|
||||
throw Bzip2Exception::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Forces a write of all buffered bzip2 data for the file pointer
|
||||
* bz.
|
||||
*
|
||||
* @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();
|
||||
$result = \bzflush($bz);
|
||||
if ($result === false) {
|
||||
throw Bzip2Exception::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* bzread reads from the given bzip2 file pointer.
|
||||
*
|
||||
* Reading stops when length (uncompressed) bytes have
|
||||
* been read or EOF is reached, whichever comes first.
|
||||
*
|
||||
* @param resource $bz The file pointer. It must be valid and must point to a file
|
||||
* successfully opened by bzopen.
|
||||
* @param int $length If not specified, bzread will read 1024
|
||||
* (uncompressed) bytes at a time. A maximum of 8192
|
||||
* uncompressed bytes will be read at a time.
|
||||
* @return string Returns the uncompressed data.
|
||||
* @throws Bzip2Exception
|
||||
*
|
||||
*/
|
||||
function bzread($bz, int $length = 1024): string
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \bzread($bz, $length);
|
||||
if ($result === false) {
|
||||
throw Bzip2Exception::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* bzwrite writes a string into the given bzip2 file
|
||||
* stream.
|
||||
*
|
||||
* @param resource $bz The file pointer. It must be valid and must point to a file
|
||||
* successfully opened by bzopen.
|
||||
* @param string $data The written data.
|
||||
* @param int $length If supplied, writing will stop after length
|
||||
* (uncompressed) bytes have been written or the end of
|
||||
* data is reached, whichever comes first.
|
||||
* @return int Returns the number of bytes written.
|
||||
* @throws Bzip2Exception
|
||||
*
|
||||
*/
|
||||
function bzwrite($bz, string $data, int $length = null): int
|
||||
{
|
||||
error_clear_last();
|
||||
if ($length !== null) {
|
||||
$result = \bzwrite($bz, $data, $length);
|
||||
} else {
|
||||
$result = \bzwrite($bz, $data);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw Bzip2Exception::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\CalendarException;
|
||||
|
||||
/**
|
||||
* This function will return a Unix timestamp corresponding to the
|
||||
* Julian Day given in jday or FALSE if
|
||||
* jday is outside of the allowed range. The time returned is
|
||||
* UTC.
|
||||
*
|
||||
* @param int $jday A julian day number between 2440588 and 106751993607888
|
||||
* on 64bit systems, or between 2440588 and 2465443 on 32bit systems.
|
||||
* @return int The unix timestamp for the start (midnight, not noon) of the given Julian day.
|
||||
* @throws CalendarException
|
||||
*
|
||||
*/
|
||||
function jdtounix(int $jday): int
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \jdtounix($jday);
|
||||
if ($result === false) {
|
||||
throw CalendarException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\ClassobjException;
|
||||
|
||||
/**
|
||||
* Creates an alias named alias
|
||||
* based on the user defined class original.
|
||||
* The aliased class is exactly the same as the original class.
|
||||
*
|
||||
* @param string $original 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 $original, string $alias, bool $autoload = true): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \class_alias($original, $alias, $autoload);
|
||||
if ($result === false) {
|
||||
throw ClassobjException::createFromPhpError();
|
||||
}
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\ComException;
|
||||
|
||||
/**
|
||||
* Instructs COM to sink events generated by
|
||||
* comobject into the PHP object
|
||||
* sinkobject.
|
||||
*
|
||||
* 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 $comobject
|
||||
* @param object $sinkobject sinkobject 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 $sinkinterface PHP will attempt to use the default dispinterface type specified by
|
||||
* the typelibrary associated with comobject, but
|
||||
* you may override this choice by setting
|
||||
* sinkinterface to the name of the dispinterface
|
||||
* that you want to use.
|
||||
* @throws ComException
|
||||
*
|
||||
*/
|
||||
function com_event_sink(object $comobject, object $sinkobject, $sinkinterface = null): void
|
||||
{
|
||||
error_clear_last();
|
||||
if ($sinkinterface !== null) {
|
||||
$result = \com_event_sink($comobject, $sinkobject, $sinkinterface);
|
||||
} else {
|
||||
$result = \com_event_sink($comobject, $sinkobject);
|
||||
}
|
||||
if ($result === 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 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_name typelib_name 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_sensitive The case_sensitive behaves inversely to
|
||||
* the parameter $case_insensitive in the define
|
||||
* function.
|
||||
* @throws ComException
|
||||
*
|
||||
*/
|
||||
function com_load_typelib(string $typelib_name, bool $case_sensitive = true): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \com_load_typelib($typelib_name, $case_sensitive);
|
||||
if ($result === 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 $comobject comobject 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 string $dispinterface The name of an IDispatch descendant interface that you want to display.
|
||||
* @param bool $wantsink If set to TRUE, the corresponding sink interface will be displayed
|
||||
* instead.
|
||||
* @throws ComException
|
||||
*
|
||||
*/
|
||||
function com_print_typeinfo(object $comobject, string $dispinterface = null, bool $wantsink = false): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \com_print_typeinfo($comobject, $dispinterface, $wantsink);
|
||||
if ($result === false) {
|
||||
throw ComException::createFromPhpError();
|
||||
}
|
||||
}
|
|
@ -1,395 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\CubridException;
|
||||
|
||||
/**
|
||||
* This function frees the memory occupied by the result data. It returns
|
||||
* TRUE on success. Note that it can only frees the
|
||||
* client fetch buffer now, and if you want free all memory, use function
|
||||
* cubrid_close_request.
|
||||
*
|
||||
* @param resource $req_identifier This is the request identifier.
|
||||
* @throws CubridException
|
||||
*
|
||||
*/
|
||||
function cubrid_free_result($req_identifier): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \cubrid_free_result($req_identifier);
|
||||
if ($result === false) {
|
||||
throw CubridException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function returns the current CUBRID connection charset and is similar
|
||||
* to the CUBRID MySQL compatible function
|
||||
* cubrid_client_encoding.
|
||||
*
|
||||
* @param resource $conn_identifier The CUBRID connection.
|
||||
* @return string A string that represents the CUBRID connection charset; on success.
|
||||
*
|
||||
* FALSE on failure.
|
||||
* @throws CubridException
|
||||
*
|
||||
*/
|
||||
function cubrid_get_charset($conn_identifier): string
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \cubrid_get_charset($conn_identifier);
|
||||
if ($result === false) {
|
||||
throw CubridException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function returns a string that represents the client library version.
|
||||
*
|
||||
* @return string A string that represents the client library version; on success.
|
||||
*
|
||||
* FALSE on failure.
|
||||
* @throws CubridException
|
||||
*
|
||||
*/
|
||||
function cubrid_get_client_info(): string
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \cubrid_get_client_info();
|
||||
if ($result === false) {
|
||||
throw CubridException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function returns the CUBRID database parameters or it returns FALSE on
|
||||
* failure. It returns an associative array with the values for the following
|
||||
* parameters:
|
||||
*
|
||||
*
|
||||
* PARAM_ISOLATION_LEVEL
|
||||
* PARAM_LOCK_TIMEOUT
|
||||
* PARAM_MAX_STRING_LENGTH
|
||||
* PARAM_AUTO_COMMIT
|
||||
*
|
||||
*
|
||||
*
|
||||
* Database parameters
|
||||
*
|
||||
*
|
||||
*
|
||||
* Parameter
|
||||
* Description
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* PARAM_ISOLATION_LEVEL
|
||||
* The transaction isolation level.
|
||||
*
|
||||
*
|
||||
* LOCK_TIMEOUT
|
||||
* CUBRID provides the lock timeout feature, which sets the waiting
|
||||
* time (in seconds) for the lock until the transaction lock setting is
|
||||
* allowed. The default value of the lock_timeout_in_secs parameter is
|
||||
* -1, which means the application client will wait indefinitely until
|
||||
* the transaction lock is allowed.
|
||||
*
|
||||
*
|
||||
*
|
||||
* PARAM_AUTO_COMMIT
|
||||
* In CUBRID PHP, auto-commit mode is disabled by default for
|
||||
* transaction management. It can be set by using
|
||||
* cubrid_set_autocommit.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* The following table shows the isolation levels from 1 to 6. It consists of
|
||||
* table schema (row) and isolation level:
|
||||
*
|
||||
* Levels of Isolation Supported by CUBRID
|
||||
*
|
||||
*
|
||||
*
|
||||
* Name
|
||||
* Description
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* SERIALIZABLE (6)
|
||||
* In this isolation level, problems concerning concurrency (e.g.
|
||||
* dirty read, non-repeatable read, phantom read, etc.) do not
|
||||
* occur.
|
||||
*
|
||||
*
|
||||
* REPEATABLE READ CLASS with REPEATABLE READ INSTANCES (5)
|
||||
* Another transaction T2 cannot update the schema of table A while
|
||||
* transaction T1 is viewing table A.
|
||||
* Transaction T1 may experience phantom read for the record R that was
|
||||
* inserted by another transaction T2 when it is repeatedly retrieving a
|
||||
* specific record.
|
||||
*
|
||||
*
|
||||
* REPEATABLE READ CLASS with READ COMMITTED INSTANCES (or CURSOR STABILITY) (4)
|
||||
* Another transaction T2 cannot update the schema of table A while
|
||||
* transaction T1 is viewing table A.
|
||||
* Transaction T1 may experience R read (non-repeatable read) that was
|
||||
* updated and committed by another transaction T2 when it is repeatedly
|
||||
* retrieving the record R.
|
||||
*
|
||||
*
|
||||
* REPEATABLE READ CLASS with READ UNCOMMITTED INSTANCES (3)
|
||||
* Default isolation level. Another transaction T2 cannot update
|
||||
* the schema of table A while transaction T1 is viewing table A.
|
||||
* Transaction T1 may experience R' read (dirty read) for the record that
|
||||
* was updated but not committed by another transaction T2.
|
||||
*
|
||||
*
|
||||
* READ COMMITTED CLASS with READ COMMITTED INSTANCES (2)
|
||||
* Transaction T1 may experience A' read (non-repeatable read) for
|
||||
* the table that was updated and committed by another transaction T2
|
||||
* while it is viewing table A repeatedly. Transaction T1 may experience
|
||||
* R' read (non-repeatable read) for the record that was updated and
|
||||
* committed by another transaction T2 while it is retrieving the record
|
||||
* R repeatedly.
|
||||
*
|
||||
*
|
||||
* READ COMMITTED CLASS with READ UNCOMMITTED INSTANCES (1)
|
||||
* Transaction T1 may experience A' read (non-repeatable read) for
|
||||
* the table that was updated and committed by another transaction T2
|
||||
* while it is repeatedly viewing table A. Transaction T1 may experience
|
||||
* R' read (dirty read) for the record that was updated but not committed
|
||||
* by another transaction T2.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param resource $conn_identifier The CUBRID connection. If the connection identifier is not specified,
|
||||
* the last link opened by cubrid_connect is assumed.
|
||||
* @return array An associative array with CUBRID database parameters; on success.
|
||||
*
|
||||
* FALSE on failure.
|
||||
* @throws CubridException
|
||||
*
|
||||
*/
|
||||
function cubrid_get_db_parameter($conn_identifier): array
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \cubrid_get_db_parameter($conn_identifier);
|
||||
if ($result === false) {
|
||||
throw CubridException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function returns a string that represents the CUBRID server version.
|
||||
*
|
||||
* @param resource $conn_identifier The CUBRID connection.
|
||||
* @return string A string that represents the CUBRID server version; on success.
|
||||
*
|
||||
* FALSE on failure.
|
||||
* @throws CubridException
|
||||
*
|
||||
*/
|
||||
function cubrid_get_server_info($conn_identifier): string
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \cubrid_get_server_info($conn_identifier);
|
||||
if ($result === false) {
|
||||
throw CubridException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The cubrid_insert_id function retrieves the ID
|
||||
* generated for the AUTO_INCREMENT column which is updated by the previous
|
||||
* INSERT query. It returns 0 if the previous query does not generate new
|
||||
* rows.
|
||||
*
|
||||
* @param resource $conn_identifier The connection identifier previously obtained by a call to
|
||||
* cubrid_connect.
|
||||
* @return string A string representing the ID generated for an AUTO_INCREMENT column by the
|
||||
* previous query, on success.
|
||||
*
|
||||
* 0, if the previous query does not generate new rows.
|
||||
*
|
||||
* FALSE on failure.
|
||||
* @throws CubridException
|
||||
*
|
||||
*/
|
||||
function cubrid_insert_id($conn_identifier = null): string
|
||||
{
|
||||
error_clear_last();
|
||||
if ($conn_identifier !== null) {
|
||||
$result = \cubrid_insert_id($conn_identifier);
|
||||
} else {
|
||||
$result = \cubrid_insert_id();
|
||||
}
|
||||
if ($result === false) {
|
||||
throw CubridException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The cubrid_lob2_new function is used to create a lob object (both BLOB and CLOB).
|
||||
* This function should be used before you bind a lob object.
|
||||
*
|
||||
* @param resource $conn_identifier Connection identifier. If the connection identifier is not specified,
|
||||
* the last connection opened by cubrid_connect or
|
||||
* cubrid_connect_with_url is assumed.
|
||||
* @param string $type It may be "BLOB" or "CLOB", it won't be case-sensitive. The default value is "BLOB".
|
||||
* @return resource Lob identifier when it is successful.
|
||||
*
|
||||
* FALSE on failure.
|
||||
* @throws CubridException
|
||||
*
|
||||
*/
|
||||
function cubrid_lob2_new($conn_identifier = null, string $type = "BLOB")
|
||||
{
|
||||
error_clear_last();
|
||||
if ($type !== "BLOB") {
|
||||
$result = \cubrid_lob2_new($conn_identifier, $type);
|
||||
} elseif ($conn_identifier !== null) {
|
||||
$result = \cubrid_lob2_new($conn_identifier);
|
||||
} else {
|
||||
$result = \cubrid_lob2_new();
|
||||
}
|
||||
if ($result === false) {
|
||||
throw CubridException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The cubrid_lob2_size function is used to get the size of a lob object.
|
||||
*
|
||||
* @param resource $lob_identifier Lob identifier as a result of cubrid_lob2_new or get from the result set.
|
||||
* @return int It will return the size of the LOB object when it processes successfully.
|
||||
*
|
||||
* FALSE on failure.
|
||||
* @throws CubridException
|
||||
*
|
||||
*/
|
||||
function cubrid_lob2_size($lob_identifier): int
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \cubrid_lob2_size($lob_identifier);
|
||||
if ($result === false) {
|
||||
throw CubridException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The cubrid_lob2_size64 function is used to get the
|
||||
* size of a lob object. If the size of a lob object is larger than an
|
||||
* integer data can be stored, you can use this function and it will return
|
||||
* the size as a string.
|
||||
*
|
||||
* @param resource $lob_identifier Lob identifier as a result of cubrid_lob2_new or get from the result set.
|
||||
* @return string It will return the size of the LOB object as a string when it processes successfully.
|
||||
*
|
||||
* FALSE on failure.
|
||||
* @throws CubridException
|
||||
*
|
||||
*/
|
||||
function cubrid_lob2_size64($lob_identifier): string
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \cubrid_lob2_size64($lob_identifier);
|
||||
if ($result === false) {
|
||||
throw CubridException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The cubrid_lob2_tell function is used to tell the cursor position of the LOB object.
|
||||
*
|
||||
* @param resource $lob_identifier Lob identifier as a result of cubrid_lob2_new or get from the result set.
|
||||
* @return int It will return the cursor position on the LOB object when it processes successfully.
|
||||
*
|
||||
* FALSE on failure.
|
||||
* @throws CubridException
|
||||
*
|
||||
*/
|
||||
function cubrid_lob2_tell($lob_identifier): int
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \cubrid_lob2_tell($lob_identifier);
|
||||
if ($result === false) {
|
||||
throw CubridException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The cubrid_lob2_tell64 function is used to tell the
|
||||
* cursor position of the LOB object. If the size of a lob object is larger
|
||||
* than an integer data can be stored, you can use this function and it will
|
||||
* return the position information as a string.
|
||||
*
|
||||
* @param resource $lob_identifier Lob identifier as a result of cubrid_lob2_new or get from the result set.
|
||||
* @return string It will return the cursor position on the LOB object as a string when it processes successfully.
|
||||
*
|
||||
* FALSE on failure.
|
||||
* @throws CubridException
|
||||
*
|
||||
*/
|
||||
function cubrid_lob2_tell64($lob_identifier): string
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \cubrid_lob2_tell64($lob_identifier);
|
||||
if ($result === false) {
|
||||
throw CubridException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The cubrid_set_db_parameter function is used to set
|
||||
* the CUBRID database parameters. It can set the following CUBRID database
|
||||
* parameters:
|
||||
*
|
||||
*
|
||||
* PARAM_ISOLATION_LEVEL
|
||||
* PARAM_LOCK_TIMEOUT
|
||||
*
|
||||
*
|
||||
* @param resource $conn_identifier The CUBRID connection. If the connection identifier is not specified,
|
||||
* the last link opened by cubrid_connect is assumed.
|
||||
* @param int $param_type Database parameter type.
|
||||
* @param int $param_value Isolation level value (1-6) or lock timeout (in seconds) value.
|
||||
* @throws CubridException
|
||||
*
|
||||
*/
|
||||
function cubrid_set_db_parameter($conn_identifier, int $param_type, int $param_value): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \cubrid_set_db_parameter($conn_identifier, $param_type, $param_value);
|
||||
if ($result === false) {
|
||||
throw CubridException::createFromPhpError();
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,631 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
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 Returns associative array with detailed info about given date/time.
|
||||
* @throws DatetimeException
|
||||
*
|
||||
*/
|
||||
function date_parse_from_format(string $format, string $datetime): array
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \date_parse_from_format($format, $datetime);
|
||||
if ($result === false) {
|
||||
throw DatetimeException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param string $datetime Date/time in format accepted by
|
||||
* DateTimeImmutable::__construct.
|
||||
* @return array Returns array with information about the parsed date/time
|
||||
* on success.
|
||||
* @throws DatetimeException
|
||||
*
|
||||
*/
|
||||
function date_parse(string $datetime): array
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \date_parse($datetime);
|
||||
if ($result === false) {
|
||||
throw DatetimeException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param int $timestamp Unix timestamp.
|
||||
* @param float $latitude Latitude in degrees.
|
||||
* @param float $longitude Longitude in degrees.
|
||||
* @return array 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.
|
||||
* @throws DatetimeException
|
||||
*
|
||||
*/
|
||||
function date_sun_info(int $timestamp, float $latitude, float $longitude): array
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \date_sun_info($timestamp, $latitude, $longitude);
|
||||
if ($result === false) {
|
||||
throw DatetimeException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 $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 integer (timestamp)
|
||||
* 1095034606
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param float $latitude Defaults to North, pass in a negative value for South.
|
||||
* See also: date.default_latitude
|
||||
* @param float $longitude Defaults to East, pass in a negative value for West.
|
||||
* See also: date.default_longitude
|
||||
* @param float $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 $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.
|
||||
* @throws DatetimeException
|
||||
*
|
||||
*/
|
||||
function date_sunrise(int $timestamp, int $returnFormat = SUNFUNCS_RET_STRING, float $latitude = null, float $longitude = null, float $zenith = null, float $utcOffset = 0)
|
||||
{
|
||||
error_clear_last();
|
||||
if ($utcOffset !== 0) {
|
||||
$result = \date_sunrise($timestamp, $returnFormat, $latitude, $longitude, $zenith, $utcOffset);
|
||||
} elseif ($zenith !== null) {
|
||||
$result = \date_sunrise($timestamp, $returnFormat, $latitude, $longitude, $zenith);
|
||||
} elseif ($longitude !== null) {
|
||||
$result = \date_sunrise($timestamp, $returnFormat, $latitude, $longitude);
|
||||
} elseif ($latitude !== null) {
|
||||
$result = \date_sunrise($timestamp, $returnFormat, $latitude);
|
||||
} else {
|
||||
$result = \date_sunrise($timestamp, $returnFormat);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw DatetimeException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 $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 integer (timestamp)
|
||||
* 1095034606
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param float $latitude Defaults to North, pass in a negative value for South.
|
||||
* See also: date.default_latitude
|
||||
* @param float $longitude Defaults to East, pass in a negative value for West.
|
||||
* See also: date.default_longitude
|
||||
* @param float $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 $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.
|
||||
* @throws DatetimeException
|
||||
*
|
||||
*/
|
||||
function date_sunset(int $timestamp, int $returnFormat = SUNFUNCS_RET_STRING, float $latitude = null, float $longitude = null, float $zenith = null, float $utcOffset = 0)
|
||||
{
|
||||
error_clear_last();
|
||||
if ($utcOffset !== 0) {
|
||||
$result = \date_sunset($timestamp, $returnFormat, $latitude, $longitude, $zenith, $utcOffset);
|
||||
} elseif ($zenith !== null) {
|
||||
$result = \date_sunset($timestamp, $returnFormat, $latitude, $longitude, $zenith);
|
||||
} elseif ($longitude !== null) {
|
||||
$result = \date_sunset($timestamp, $returnFormat, $latitude, $longitude);
|
||||
} elseif ($latitude !== null) {
|
||||
$result = \date_sunset($timestamp, $returnFormat, $latitude);
|
||||
} else {
|
||||
$result = \date_sunset($timestamp, $returnFormat);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw DatetimeException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 $timestamp The optional timestamp parameter is an
|
||||
* integer Unix timestamp that defaults to the current
|
||||
* local time if a timestamp is not given. In other
|
||||
* words, it defaults to the value of time.
|
||||
* @return string Returns a formatted date string. If a non-numeric value is used for
|
||||
* timestamp, FALSE is returned and an
|
||||
* E_WARNING level error is emitted.
|
||||
* @throws DatetimeException
|
||||
*
|
||||
*/
|
||||
function date(string $format, int $timestamp = null): string
|
||||
{
|
||||
error_clear_last();
|
||||
if ($timestamp !== null) {
|
||||
$result = \date($format, $timestamp);
|
||||
} else {
|
||||
$result = \date($format);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw DatetimeException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Identical to the date function except that
|
||||
* the time returned is Greenwich Mean Time (GMT).
|
||||
*
|
||||
* @param string $format The format of the outputted date string. See the formatting
|
||||
* options for the date function.
|
||||
* @param int $timestamp The optional timestamp parameter is an
|
||||
* integer Unix timestamp that defaults to the current
|
||||
* local time if a timestamp is not given. In other
|
||||
* words, it defaults to the value of time.
|
||||
* @return string Returns a formatted date string. If a non-numeric value is used for
|
||||
* timestamp, FALSE is returned and an
|
||||
* E_WARNING level error is emitted.
|
||||
* @throws DatetimeException
|
||||
*
|
||||
*/
|
||||
function gmdate(string $format, int $timestamp = null): string
|
||||
{
|
||||
error_clear_last();
|
||||
if ($timestamp !== null) {
|
||||
$result = \gmdate($format, $timestamp);
|
||||
} else {
|
||||
$result = \gmdate($format);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw DatetimeException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the Unix timestamp corresponding to the arguments
|
||||
* given. This timestamp is a long integer containing the number of
|
||||
* seconds between the Unix Epoch (January 1 1970 00:00:00 GMT) and the time
|
||||
* specified.
|
||||
*
|
||||
* Arguments may be left out in order from right to left; any
|
||||
* arguments thus omitted will be set to the current value according
|
||||
* to the local date and time.
|
||||
*
|
||||
* @param int $hour The number of the hour relative to the start of the day determined by
|
||||
* month, day and year.
|
||||
* Negative values reference the hour before midnight of the day in question.
|
||||
* Values greater than 23 reference the appropriate hour in the following day(s).
|
||||
* @param int $minute The number of the minute relative to the start of the hour.
|
||||
* Negative values reference the minute in the previous hour.
|
||||
* Values greater than 59 reference the appropriate minute in the following hour(s).
|
||||
* @param int $second The number of seconds relative to the start of the minute.
|
||||
* Negative values reference the second in the previous minute.
|
||||
* Values greater than 59 reference the appropriate second in the following minute(s).
|
||||
* @param int $month The number of the month relative to the end of the previous year.
|
||||
* Values 1 to 12 reference the normal calendar months of the year in question.
|
||||
* Values less than 1 (including negative values) reference the months in the previous year in reverse order, so 0 is December, -1 is November, etc.
|
||||
* Values greater than 12 reference the appropriate month in the following year(s).
|
||||
* @param int $day The number of the day relative to the end of the previous month.
|
||||
* Values 1 to 28, 29, 30 or 31 (depending upon the month) reference the normal days in the relevant month.
|
||||
* Values less than 1 (including negative values) reference the days in the previous month, so 0 is the last day of the previous month, -1 is the day before that, etc.
|
||||
* Values greater than the number of days in the relevant month reference the appropriate day in the following month(s).
|
||||
* @param int $year The number of the year, may be a two or four digit value,
|
||||
* with values between 0-69 mapping to 2000-2069 and 70-100 to
|
||||
* 1970-2000. On systems where time_t is a 32bit signed integer, as
|
||||
* most common today, the valid range for year
|
||||
* is somewhere between 1901 and 2038. However, before PHP 5.1.0 this
|
||||
* range was limited from 1970 to 2038 on some systems (e.g. Windows).
|
||||
* @return int mktime returns the Unix timestamp of the arguments
|
||||
* given.
|
||||
* If the arguments are invalid, the function returns FALSE (before PHP 5.1
|
||||
* it returned -1).
|
||||
* @throws DatetimeException
|
||||
*
|
||||
*/
|
||||
function mktime(int $hour = null, int $minute = null, int $second = null, int $month = null, int $day = null, int $year = null): int
|
||||
{
|
||||
error_clear_last();
|
||||
if ($year !== null) {
|
||||
$result = \mktime($hour, $minute, $second, $month, $day, $year);
|
||||
} elseif ($day !== null) {
|
||||
$result = \mktime($hour, $minute, $second, $month, $day);
|
||||
} elseif ($month !== null) {
|
||||
$result = \mktime($hour, $minute, $second, $month);
|
||||
} elseif ($second !== null) {
|
||||
$result = \mktime($hour, $minute, $second);
|
||||
} elseif ($minute !== null) {
|
||||
$result = \mktime($hour, $minute);
|
||||
} elseif ($hour !== null) {
|
||||
$result = \mktime($hour);
|
||||
} else {
|
||||
$result = \mktime();
|
||||
}
|
||||
if ($result === false) {
|
||||
throw DatetimeException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* strptime returns an array with the
|
||||
* date parsed.
|
||||
*
|
||||
* Month and weekday names and other language dependent strings respect the
|
||||
* current locale set with setlocale (LC_TIME).
|
||||
*
|
||||
* @param string $date The string to parse (e.g. returned from strftime).
|
||||
* @param string $format The format used in date (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 date part which was not
|
||||
* recognized using the specified format
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws DatetimeException
|
||||
*
|
||||
*/
|
||||
function strptime(string $date, string $format): array
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \strptime($date, $format);
|
||||
if ($result === false) {
|
||||
throw DatetimeException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 $now The timestamp which is used as a base for the calculation of relative
|
||||
* dates.
|
||||
* @return int Returns a timestamp on success, FALSE otherwise. Previous to PHP 5.1.0,
|
||||
* this function would return -1 on failure.
|
||||
* @throws DatetimeException
|
||||
*
|
||||
*/
|
||||
function strtotime(string $datetime, int $now = null): int
|
||||
{
|
||||
error_clear_last();
|
||||
if ($now !== null) {
|
||||
$result = \strtotime($datetime, $now);
|
||||
} else {
|
||||
$result = \strtotime($datetime);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw DatetimeException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @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.
|
||||
* @throws DatetimeException
|
||||
*
|
||||
*/
|
||||
function timezone_name_from_abbr(string $abbr, int $utcOffset = -1, int $isDST = -1): string
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \timezone_name_from_abbr($abbr, $utcOffset, $isDST);
|
||||
if ($result === false) {
|
||||
throw DatetimeException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
|
@ -1,157 +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();
|
||||
$result = \chdir($directory);
|
||||
if ($result === 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.
|
||||
*
|
||||
* @param string $directory The path to change the root directory to.
|
||||
* @throws DirException
|
||||
*
|
||||
*/
|
||||
function chroot(string $directory): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \chroot($directory);
|
||||
if ($result === false) {
|
||||
throw DirException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the current working directory.
|
||||
*
|
||||
* @return 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();
|
||||
$result = \getcwd();
|
||||
if ($result === false) {
|
||||
throw DirException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Opens up a directory handle to be used in subsequent
|
||||
* closedir, readdir, and
|
||||
* rewinddir calls.
|
||||
*
|
||||
* @param string $path The directory path that is to be opened
|
||||
* @param 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 $path, $context = null)
|
||||
{
|
||||
error_clear_last();
|
||||
if ($context !== null) {
|
||||
$result = \opendir($path, $context);
|
||||
} else {
|
||||
$result = \opendir($path);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw DirException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resets the directory stream indicated by
|
||||
* dir_handle to the beginning of the
|
||||
* directory.
|
||||
*
|
||||
* @param resource $dir_handle The directory handle resource previously opened
|
||||
* with opendir. If the directory handle is
|
||||
* not specified, the last link opened by opendir
|
||||
* is assumed.
|
||||
* @throws DirException
|
||||
*
|
||||
*/
|
||||
function rewinddir($dir_handle = null): void
|
||||
{
|
||||
error_clear_last();
|
||||
if ($dir_handle !== null) {
|
||||
$result = \rewinddir($dir_handle);
|
||||
} else {
|
||||
$result = \rewinddir();
|
||||
}
|
||||
if ($result === false) {
|
||||
throw DirException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array of files and directories from the
|
||||
* directory.
|
||||
*
|
||||
* @param string $directory The directory that will be scanned.
|
||||
* @param int $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 resource $context For a description of the context parameter,
|
||||
* refer to the streams section of
|
||||
* the manual.
|
||||
* @return array 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) {
|
||||
$result = \scandir($directory, $sorting_order, $context);
|
||||
} else {
|
||||
$result = \scandir($directory, $sorting_order);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw DirException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,82 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
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 int $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.
|
||||
* @throws ErrorfuncException
|
||||
*
|
||||
*/
|
||||
function error_log(string $message, int $message_type = 0, string $destination = null, string $extra_headers = null): void
|
||||
{
|
||||
error_clear_last();
|
||||
if ($extra_headers !== null) {
|
||||
$result = \error_log($message, $message_type, $destination, $extra_headers);
|
||||
} elseif ($destination !== null) {
|
||||
$result = \error_log($message, $message_type, $destination);
|
||||
} else {
|
||||
$result = \error_log($message, $message_type);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw ErrorfuncException::createFromPhpError();
|
||||
}
|
||||
}
|
|
@ -1,159 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\ExecException;
|
||||
|
||||
/**
|
||||
* proc_get_status fetches data about a
|
||||
* process opened using proc_open.
|
||||
*
|
||||
* @param resource $process The proc_open resource that will
|
||||
* be evaluated.
|
||||
* @return array An array of collected information on success. The returned array contains the following elements:
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* elementtypedescription
|
||||
*
|
||||
*
|
||||
*
|
||||
* command
|
||||
* string
|
||||
*
|
||||
* The command string that was passed to proc_open.
|
||||
*
|
||||
*
|
||||
*
|
||||
* pid
|
||||
* int
|
||||
* process id
|
||||
*
|
||||
*
|
||||
* running
|
||||
* bool
|
||||
*
|
||||
* TRUE if the process is still running, FALSE if it has
|
||||
* terminated.
|
||||
*
|
||||
*
|
||||
*
|
||||
* signaled
|
||||
* bool
|
||||
*
|
||||
* TRUE if the child process has been terminated by
|
||||
* an uncaught signal. Always set to FALSE on Windows.
|
||||
*
|
||||
*
|
||||
*
|
||||
* stopped
|
||||
* bool
|
||||
*
|
||||
* TRUE if the child process has been stopped by a
|
||||
* signal. Always set to FALSE on Windows.
|
||||
*
|
||||
*
|
||||
*
|
||||
* exitcode
|
||||
* int
|
||||
*
|
||||
* The exit code returned by the process (which is only
|
||||
* meaningful if running is FALSE).
|
||||
* Only first call of this function return real value, next calls return
|
||||
* -1.
|
||||
*
|
||||
*
|
||||
*
|
||||
* termsig
|
||||
* int
|
||||
*
|
||||
* The number of the signal that caused the child process to terminate
|
||||
* its execution (only meaningful if signaled is TRUE).
|
||||
*
|
||||
*
|
||||
*
|
||||
* stopsig
|
||||
* int
|
||||
*
|
||||
* The number of the signal that caused the child process to stop its
|
||||
* execution (only meaningful if stopped is TRUE).
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @throws ExecException
|
||||
*
|
||||
*/
|
||||
function proc_get_status($process): array
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \proc_get_status($process);
|
||||
if ($result === false) {
|
||||
throw ExecException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* proc_nice changes the priority of the current
|
||||
* process by the amount specified in increment. A
|
||||
* positive increment will lower the priority of the
|
||||
* current process, whereas a negative increment
|
||||
* will raise the priority.
|
||||
*
|
||||
* proc_nice is not related to
|
||||
* proc_open and its associated functions in any way.
|
||||
*
|
||||
* @param int $increment 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 increment parameter have the
|
||||
* following meanings:
|
||||
* @throws ExecException
|
||||
*
|
||||
*/
|
||||
function proc_nice(int $increment): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \proc_nice($increment);
|
||||
if ($result === false) {
|
||||
throw ExecException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 $return_var If the return_var 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.
|
||||
* @throws ExecException
|
||||
*
|
||||
*/
|
||||
function system(string $command, int &$return_var = null): string
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \system($command, $return_var);
|
||||
if ($result === false) {
|
||||
throw ExecException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\FileinfoException;
|
||||
|
||||
/**
|
||||
* This function closes the resource opened by finfo_open.
|
||||
*
|
||||
* @param resource $finfo Fileinfo resource returned by finfo_open.
|
||||
* @throws FileinfoException
|
||||
*
|
||||
*/
|
||||
function finfo_close($finfo): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \finfo_close($finfo);
|
||||
if ($result === false) {
|
||||
throw FileinfoException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Procedural style
|
||||
*
|
||||
* Object oriented style (constructor):
|
||||
*
|
||||
* This function opens a magic database and returns its resource.
|
||||
*
|
||||
* @param int $options One or disjunction of more Fileinfo
|
||||
* constants.
|
||||
* @param string $magic_file 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 resource (Procedural style only)
|
||||
* Returns a magic database resource on success.
|
||||
* @throws FileinfoException
|
||||
*
|
||||
*/
|
||||
function finfo_open(int $options = FILEINFO_NONE, string $magic_file = "")
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \finfo_open($options, $magic_file);
|
||||
if ($result === false) {
|
||||
throw FileinfoException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the MIME content type for a file as determined by using
|
||||
* information from the magic.mime file.
|
||||
*
|
||||
* @param 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(string $filename): string
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \mime_content_type($filename);
|
||||
if ($result === false) {
|
||||
throw FileinfoException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -1,93 +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 int|array $definition 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 mixed 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, $definition = null, bool $add_empty = true)
|
||||
{
|
||||
error_clear_last();
|
||||
if ($add_empty !== true) {
|
||||
$result = \filter_input_array($type, $definition, $add_empty);
|
||||
} elseif ($definition !== null) {
|
||||
$result = \filter_input_array($type, $definition);
|
||||
} else {
|
||||
$result = \filter_input_array($type);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw FilterException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function is useful for retrieving many values without
|
||||
* repetitively calling filter_var.
|
||||
*
|
||||
* @param array $data An array with string keys containing the data to filter.
|
||||
* @param mixed $definition 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 mixed 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 $data, $definition = null, bool $add_empty = true)
|
||||
{
|
||||
error_clear_last();
|
||||
if ($add_empty !== true) {
|
||||
$result = \filter_var_array($data, $definition, $add_empty);
|
||||
} elseif ($definition !== null) {
|
||||
$result = \filter_var_array($data, $definition);
|
||||
} else {
|
||||
$result = \filter_var_array($data);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw FilterException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
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
|
||||
*
|
||||
*/
|
||||
function fastcgi_finish_request(): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \fastcgi_finish_request();
|
||||
if ($result === false) {
|
||||
throw FpmException::createFromPhpError();
|
||||
}
|
||||
}
|
|
@ -1,496 +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 resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @param int $filesize The number of bytes to allocate.
|
||||
* @param string $result A textual representation of the servers response will be returned by
|
||||
* reference in result if a variable is provided.
|
||||
* @throws FtpException
|
||||
*
|
||||
*/
|
||||
function ftp_alloc($ftp_stream, int $filesize, string &$result = null): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_alloc($ftp_stream, $filesize, $result);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param resource $ftp
|
||||
* @param string $remote_file
|
||||
* @param string $local_file
|
||||
* @param int $mode
|
||||
* @throws FtpException
|
||||
*
|
||||
*/
|
||||
function ftp_append($ftp, string $remote_file, string $local_file, int $mode = FTP_BINARY): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_append($ftp, $remote_file, $local_file, $mode);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Changes to the parent directory.
|
||||
*
|
||||
* @param resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @throws FtpException
|
||||
*
|
||||
*/
|
||||
function ftp_cdup($ftp_stream): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_cdup($ftp_stream);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Changes the current directory to the specified one.
|
||||
*
|
||||
* @param resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @param string $directory The target directory.
|
||||
* @throws FtpException
|
||||
*
|
||||
*/
|
||||
function ftp_chdir($ftp_stream, string $directory): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_chdir($ftp_stream, $directory);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the permissions on the specified remote file to
|
||||
* mode.
|
||||
*
|
||||
* @param resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @param int $mode 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_stream, int $mode, string $filename): int
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_chmod($ftp_stream, $mode, $filename);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ftp_close closes the given link identifier
|
||||
* and releases the resource.
|
||||
*
|
||||
* @param resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @throws FtpException
|
||||
*
|
||||
*/
|
||||
function ftp_close($ftp_stream): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_close($ftp_stream);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ftp_connect opens an FTP connection to the
|
||||
* specified host.
|
||||
*
|
||||
* @param string $host 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 resource Returns a FTP stream on success.
|
||||
* @throws FtpException
|
||||
*
|
||||
*/
|
||||
function ftp_connect(string $host, int $port = 21, int $timeout = 90)
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_connect($host, $port, $timeout);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ftp_delete deletes the file specified by
|
||||
* path from the FTP server.
|
||||
*
|
||||
* @param resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @param string $path The file to delete.
|
||||
* @throws FtpException
|
||||
*
|
||||
*/
|
||||
function ftp_delete($ftp_stream, string $path): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_delete($ftp_stream, $path);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ftp_fget retrieves remote_file
|
||||
* from the FTP server, and writes it to the given file pointer.
|
||||
*
|
||||
* @param resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @param resource $handle An open file pointer in which we store the data.
|
||||
* @param string $remote_file The remote file path.
|
||||
* @param int $mode The transfer mode. Must be either FTP_ASCII or
|
||||
* FTP_BINARY.
|
||||
* @param int $resumepos The position in the remote file to start downloading from.
|
||||
* @throws FtpException
|
||||
*
|
||||
*/
|
||||
function ftp_fget($ftp_stream, $handle, string $remote_file, int $mode = FTP_BINARY, int $resumepos = 0): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_fget($ftp_stream, $handle, $remote_file, $mode, $resumepos);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ftp_fput uploads the data from a file pointer
|
||||
* to a remote file on the FTP server.
|
||||
*
|
||||
* @param resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @param string $remote_file The remote file path.
|
||||
* @param resource $handle An open file pointer on the local file. Reading stops at end of file.
|
||||
* @param int $mode The transfer mode. Must be either FTP_ASCII or
|
||||
* FTP_BINARY.
|
||||
* @param int $startpos The position in the remote file to start uploading to.
|
||||
* @throws FtpException
|
||||
*
|
||||
*/
|
||||
function ftp_fput($ftp_stream, string $remote_file, $handle, int $mode = FTP_BINARY, int $startpos = 0): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_fput($ftp_stream, $remote_file, $handle, $mode, $startpos);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ftp_get retrieves a remote file from the FTP server,
|
||||
* and saves it into a local file.
|
||||
*
|
||||
* @param resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @param string $local_file The local file path (will be overwritten if the file already exists).
|
||||
* @param string $remote_file The remote file path.
|
||||
* @param int $mode The transfer mode. Must be either FTP_ASCII or
|
||||
* FTP_BINARY.
|
||||
* @param int $resumepos The position in the remote file to start downloading from.
|
||||
* @throws FtpException
|
||||
*
|
||||
*/
|
||||
function ftp_get($ftp_stream, string $local_file, string $remote_file, int $mode = FTP_BINARY, int $resumepos = 0): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_get($ftp_stream, $local_file, $remote_file, $mode, $resumepos);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Logs in to the given FTP stream.
|
||||
*
|
||||
* @param resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @param string $username The username (USER).
|
||||
* @param string $password The password (PASS).
|
||||
* @throws FtpException
|
||||
*
|
||||
*/
|
||||
function ftp_login($ftp_stream, string $username, string $password): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_login($ftp_stream, $username, $password);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates the specified directory on the FTP server.
|
||||
*
|
||||
* @param resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @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_stream, string $directory): string
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_mkdir($ftp_stream, $directory);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @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_stream, string $directory): array
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_mlsd($ftp_stream, $directory);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @param string $directory The directory to be listed. This parameter can also include arguments, eg.
|
||||
* ftp_nlist($conn_id, "-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_stream, string $directory): array
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_nlist($ftp_stream, $directory);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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 resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @param bool $pasv If TRUE, the passive mode is turned on, else it's turned off.
|
||||
* @throws FtpException
|
||||
*
|
||||
*/
|
||||
function ftp_pasv($ftp_stream, bool $pasv): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_pasv($ftp_stream, $pasv);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ftp_put stores a local file on the FTP server.
|
||||
*
|
||||
* @param resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @param string $remote_file The remote file path.
|
||||
* @param string $local_file The local file path.
|
||||
* @param int $mode The transfer mode. Must be either FTP_ASCII or
|
||||
* FTP_BINARY.
|
||||
* @param int $startpos The position in the remote file to start uploading to.
|
||||
* @throws FtpException
|
||||
*
|
||||
*/
|
||||
function ftp_put($ftp_stream, string $remote_file, string $local_file, int $mode = FTP_BINARY, int $startpos = 0): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_put($ftp_stream, $remote_file, $local_file, $mode, $startpos);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @return string Returns the current directory name.
|
||||
* @throws FtpException
|
||||
*
|
||||
*/
|
||||
function ftp_pwd($ftp_stream): string
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_pwd($ftp_stream);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ftp_rename renames a file or a directory on the FTP
|
||||
* server.
|
||||
*
|
||||
* @param resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @param string $oldname The old file/directory name.
|
||||
* @param string $newname The new name.
|
||||
* @throws FtpException
|
||||
*
|
||||
*/
|
||||
function ftp_rename($ftp_stream, string $oldname, string $newname): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_rename($ftp_stream, $oldname, $newname);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes the specified directory on the FTP server.
|
||||
*
|
||||
* @param resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @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_stream, string $directory): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_rmdir($ftp_stream, $directory);
|
||||
if ($result === 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 resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @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_stream, string $command): void
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_site($ftp_stream, $command);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ftp_ssl_connect opens an explicit SSL-FTP connection to the
|
||||
* specified host. 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 $host 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 resource Returns a SSL-FTP stream on success.
|
||||
* @throws FtpException
|
||||
*
|
||||
*/
|
||||
function ftp_ssl_connect(string $host, int $port = 21, int $timeout = 90)
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_ssl_connect($host, $port, $timeout);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the system type identifier of the remote FTP server.
|
||||
*
|
||||
* @param resource $ftp_stream The link identifier of the FTP connection.
|
||||
* @return string Returns the remote system type.
|
||||
* @throws FtpException
|
||||
*
|
||||
*/
|
||||
function ftp_systype($ftp_stream): string
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \ftp_systype($ftp_stream);
|
||||
if ($result === false) {
|
||||
throw FtpException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Safe;
|
||||
|
||||
use Safe\Exceptions\FunchandException;
|
||||
|
||||
/**
|
||||
* Creates an anonymous function from the parameters passed, and
|
||||
* returns a unique name for it.
|
||||
*
|
||||
* @param string $args The function arguments.
|
||||
* @param string $code The function code.
|
||||
* @return string Returns a unique function name as a string.
|
||||
* @throws FunchandException
|
||||
*
|
||||
*/
|
||||
function create_function(string $args, string $code): string
|
||||
{
|
||||
error_clear_last();
|
||||
$result = \create_function($args, $code);
|
||||
if ($result === false) {
|
||||
throw FunchandException::createFromPhpError();
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param callable(): void $function The function to register.
|
||||
* @param mixed $params
|
||||
* @throws FunchandException
|
||||
*
|
||||
*/
|
||||
function register_tick_function(callable $function, ...$params): void
|
||||
{
|
||||
error_clear_last();
|
||||
if ($params !== []) {
|
||||
$result = \register_tick_function($function, ...$params);
|
||||
} else {
|
||||
$result = \register_tick_function($function);
|
||||
}
|
||||
if ($result === false) {
|
||||
throw FunchandException::createFromPhpError();
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue