jf / assert
3.1.2
2023-02-01 07:41 UTC
README
PHP 断言库。
安装
Composer
此项目使用 Composer 作为依赖管理器,可以通过遵循项目官方 文档 中的说明进行安装。
要使用此包管理器安装 jf/assert 包,请运行
composer require jf/assert
版本控制
可以使用 git 安装此项目。首先必须克隆项目,然后安装依赖项
git clone https://www.gitlab.com/jfphp/jfAssert.git
cd jfAssert
composer install
文件
类
| 名称 | 描述 |
|---|---|
| jf\assert\Assert | 用于执行验证并在验证未通过时抛出异常的类。 |
| jf\assert\dict\Messages | 用于处理库消息的类。 |
| jf\assert\http\AHttp | HTTP 异常的基础类。 |
| jf\assert\http\BadGateway | 返回 HTTP 状态码 502(Bad Gateway)的断言。 |
| jf\assert\http\BadRequest | 返回 HTTP 状态码 400(Bad Request)的断言。 |
| jf\assert\http\Conflict | 返回 HTTP 状态码 409(Conflict)的断言。 |
| jf\assert\http\ExpectationFailed | 返回 HTTP 状态码 417(Expectation Failed)的断言。 |
| jf\assert\http\FailedDependency | 返回 HTTP 状态码 424(Failed Dependency)的断言。 |
| jf\assert\http\Forbidden | 返回 HTTP 状态码 403(Forbidden)的断言。 |
| jf\assert\http\Found | 返回 HTTP 状态码 302(Found)的断言。 |
| jf\assert\http\GatewayTimeout | 返回 HTTP 状态码 504(Gateway Timeout)的断言。 |
| jf\assert\http\Gone | 返回 HTTP 状态码 410(Gone)的断言。 |
| jf\assert\http\ImATeapot | 返回 HTTP 状态码 418(Im A Teapot)的断言。 |
| jf\assert\http\InsufficientStorage | 返回 HTTP 状态码 507(Insufficient Storage)的断言。 |
| jf\assert\http\InternalServerError | 返回 HTTP 状态码 500(Internal Server Error)的断言。 |
| jf\assert\http\LengthRequired | 返回 HTTP 状态码 411(Length Required)的断言。 |
| jf\assert\http\Locked | 返回 HTTP 状态码 423(Locked)的断言。 |
| jf\assert\http\LoopDetected | 返回 HTTP 状态码 508(Loop Detected)的断言。 |
| jf\assert\http\MethodNotAllowed | 返回 HTTP 状态码 405(Method Not Allowed)的断言。 |
| jf\assert\http\MisdirectedRequest | 返回 HTTP 状态码 421(Misdirected Request)的断言。 |
| jf\assert\http\MovedPermanently | 返回 HTTP 状态码 301(Moved Permanently)的断言。 |
| jf\assert\http\MultipleChoices | 返回 HTTP 状态码 300(Multiple Choices)的断言。 |
| jf\assert\http\NetworkAuthenticationRequired | 返回 HTTP 状态码 511(Network Authentication Required)的断言。 |
| jf\assert\http\NotAcceptable | 返回 HTTP 状态码 406(Not Acceptable)的断言。 |
| jf\assert\http\NotExtended | 返回 HTTP 状态码 510(Not Extended)的断言。 |
| jf\assert\http\NotFound | 返回 HTTP 状态码 404(Not Found)的断言。 |
| jf\assert\http\NotImplemented | 返回 HTTP 状态码 501(Not Implemented)的断言。 |
| jf\assert\http\NotModified | 返回 HTTP 状态码 304(Not Modified)的断言。 |
| jf\assert\http\PayloadTooLarge | 返回HTTP状态码413(负载过大)的断言。 |
| jf\assert\http\PaymentRequired | 返回HTTP状态码402(需要付款)的断言。 |
| jf\assert\http\PermanentRedirect | 返回HTTP状态码308(永久重定向)的断言。 |
| jf\assert\http\PreconditionFailed | 返回HTTP状态码412(预条件失败)的断言。 |
| jf\assert\http\PreconditionRequired | 返回HTTP状态码428(需要预条件)的断言。 |
| jf\assert\http\ProxyAuthenticationRequired | 返回HTTP状态码407(代理认证要求)的断言。 |
| jf\assert\http\RangeNotSatisfiable | 返回HTTP状态码416(范围不可满足)的断言。 |
| jf\assert\http\RequestHeaderFieldsTooLarge | 返回HTTP状态码431(请求头字段过大)的断言。 |
| jf\assert\http\RequestTimeout | 返回HTTP状态码408(请求超时)的断言。 |
| jf\assert\http\Reserved | 返回HTTP状态码306(保留)的断言。 |
| jf\assert\http\SeeOther | 返回HTTP状态码303(另见)的断言。 |
| jf\assert\http\ServiceUnavailable | 返回HTTP状态码503(服务不可用)的断言。 |
| jf\assert\http\TemporaryRedirect | 返回HTTP状态码307(临时重定向)的断言。 |
| jf\assert\http\TooEarly | 返回HTTP状态码425(太早)的断言。 |
| jf\assert\http\TooManyRequests | 返回HTTP状态码429(请求过多)的断言。 |
| jf\assert\http\Unauthorized | 返回HTTP状态码401(未授权)的断言。 |
| jf\assert\http\UnavailableForLegalReasons | 返回HTTP状态码451(因法律原因不可用)的断言。 |
| jf\assert\http\UnprocessableEntity | 返回HTTP状态码422(不可处理的实体)的断言。 |
| jf\assert\http\UnsupportedMediaType | 返回HTTP状态码415(不支持的媒体类型)的断言。 |
| jf\assert\http\UpgradeRequired | 返回HTTP状态码426(需要升级)的断言。 |
| jf\assert\http\UriTooLong | 返回HTTP状态码414(URI过长)的断言。 |
| jf\assert\http\UseProxy | 返回HTTP状态码305(使用代理)的断言。 |
| jf\assert\http\VariantAlsoNegotiates | 返回HTTP状态码506(变量也协商)的断言。 |
| jf\assert\http\VersionNotSupported | 返回HTTP状态码505(版本不受支持)的断言。 |
| jf\assert\php\ArgumentCountError | 当向用户定义的函数或方法传递的参数太少时抛出ArgumentCountError。 |
| jf\assert\php\ArithmeticError | 当执行数学运算发生错误时抛出ArithmeticError。这些错误包括尝试以负数进行位移动,以及任何导致intdiv()值超出int可能范围调用的intdiv()。 |
| jf\assert\php\AssertionError | 当通过assert()函数进行的断言失败时抛出AssertionError。 |
| jf\assert\php\BadFunctionCallException | 如果回调引用了未定义的函数或缺少某些参数,则抛出BadFunctionCallException。 |
| jf\assert\php\BadMethodCallException | 如果回调引用了未定义的方法或缺少某些参数,则抛出BadMethodCallException。 |
| jf\assert\php\CompileError | CompileError抛出一些编译错误,这些错误以前会引发致命错误。 |
| jf\assert\php\DivisionByZeroError | 当尝试将一个数除以零时抛出DivisionByZeroError。 |
| jf\assert\php\DomainException | 如果值不符合定义的有效数据范围,将抛出异常。 |
| jf\assert\php\Error | Error 是所有内部 PHP 错误的基类。 |
| jf\assert\php\ErrorException | 错误异常。 |
| jf\assert\php\Exception | Exception 是所有用户异常的基类。 |
| jf\assert\php\IntlException | 当在 intl 函数内部发生错误时使用此类生成异常。只有在启用 intl.use_exceptions 时才会生成此类异常。 |
| jf\assert\php\InvalidArgumentException | 如果参数不是预期的类型,将抛出异常。 |
| jf\assert\php\JsonException | 如果为 json_encode() 或 json_decode() 设置了 JSON_THROW_ON_ERROR 选项,将抛出异常。code 包含错误类型,可能的值请参阅 json_last_error()。 |
| jf\assert\php\LengthException | 如果长度无效,将抛出异常。 |
| jf\assert\php\LogicException | 表示程序逻辑错误的异常。此类异常应直接导致您的代码中的修复。 |
| jf\assert\php\OutOfBoundsException | 如果值不是一个有效的键,将抛出异常。这代表在编译时无法检测到的错误。 |
| jf\assert\php\OutOfRangeException | 当请求非法索引时抛出异常。这代表应在编译时检测到的错误。 |
| jf\assert\php\OverflowException | 当向已满的容器中添加元素时抛出异常。 |
| jf\assert\php\PDOException | 表示 PDO 引发的错误。您不应从自己的代码中抛出 PDOException。有关 PHP 中的异常的更多信息,请参阅异常部分。 |
| jf\assert\php\ParseError | 当解析 PHP 代码时(例如当调用 eval() 时)抛出 ParseError。 |
| jf\assert\php\PharException | PharException 类为 try/catch 块提供 Phar 特定的异常类。 |
| jf\assert\php\RangeException | 在程序执行期间指示范围错误的异常。通常这意味着除了下溢/上溢之外还有其他算术错误。这是 DomainException 的运行时版本。 |
| jf\assert\php\ReflectionException | ReflectionException 类。 |
| jf\assert\php\RuntimeException | 如果发生只能在运行时检测到的错误,将抛出异常。 |
| jf\assert\php\SodiumException | 由 sodium 函数抛出的异常。 |
| jf\assert\php\TypeError | 当发生以下情况时可能抛出 TypeError。 |
| jf\assert\php\UnderflowException | 当对空容器执行无效操作(如删除元素)时抛出异常。 |
| jf\assert\php\UnexpectedValueException | 如果值不匹配一组值,将抛出异常。通常这发生在函数调用另一个函数并期望返回值是某种类型或值(不包括算术或缓冲区相关错误)时。 |
| jf\assert\php\UnhandledMatchError | 当传递给 match 表达式的主题没有被 match 表达式的任何部分处理时,将抛出 UnhandledMatchError。 |
| jf\assert\php\ValueError | 当参数的类型正确但值不正确时抛出 ValueError。例如,当函数期望正整数时传递负整数,或当函数期望非空字符串/数组时传递空字符串/数组。 |
特性
| 名称 | 描述 |
|---|---|
| jf\assert\TAll | 包含包中所有特性的特性。 |
| jf\assert\TArray | 使用 PHP 模块 array 函数的断言特性。 |
| jf\assert\TAssert | 用于验证和如果验证未通过则抛出异常的特性。 |
| jf\assert\TClassObj | 使用 PHP 模块 classobj 函数的断言特性。 |
| jf\assert\TCtype | 使用 PHP 模块 ctype 函数的断言特性。 |
| jf\assert\TFileSystem | 使用 PHP 模块 filesystem 函数的断言特性。 |
| jf\assert\TFilter | 使用 PHP 模块 filter 函数的断言特性。 |
| jf\assert\TFloat | 用于浮点数之间比较的特性。 |
| jf\assert\TFuncHand | 使用 PHP 模块 funchand 函数的断言特性。 |
| jf\assert\TInfo | 使用 PHP 模块 info 函数的断言特性。 |
| jf\assert\TInteger | 整数之间比较的特性。 |
| jf\assert\TLogical | 混合类型之间逻辑比较的特性。 |
| jf\assert\TMath | 使用PHP模块 math 函数的断言特性。 |
| jf\assert\TMessage | 构建错误信息的特性。 |
| jf\assert\TStrings | 使用PHP模块 strings 函数的断言特性。 |
| jf\assert\TVar | 使用PHP模块 var 函数的断言特性。 |
断言
jf\assert\TArray
使用PHP模块 array 函数的断言特性,请参阅文档。
| 方法 | 描述 |
|---|---|
| arrayCountBetweenAnd | 检查数组或可计数对象中的元素数量是否在指定的范围内。 |
| arrayCountGreaterOrEqual | 检查数组或可计数对象中的元素数量是否大于或等于另一个数量。 |
| arrayCountGreaterThan | 检查数组或可计数对象中的元素数量是否大于另一个数量。 |
| arrayCountIdentical | 检查数组或可计数对象中的元素数量是否与另一个数量完全相同 (===)。 |
| arrayCountLessOrEqual | 检查数组或可计数对象中的元素数量是否小于或等于另一个数量。 |
| arrayCountLessThan | 检查数组或可计数对象中的元素数量是否小于另一个数量。 |
| arrayIsList | 检查给定的数组是否为列表。 |
| arrayKeyExists | 检查给定的键或索引是否存在于数组中。 |
| inArray | 检查值是否存在于数组中。 |
| notArrayCountBetweenAnd | 评估方法 static::arrayCountBetweenAnd 的逆条件。 |
| notArrayCountGreaterOrEqual | 评估方法 static::arrayCountGreaterOrEqual 的逆条件。 |
| notArrayCountGreaterThan | 评估方法 static::arrayCountGreaterThan 的逆条件。 |
| notArrayCountIdentical | 评估方法 static::arrayCountIdentical 的逆条件。 |
| notArrayCountLessOrEqual | 评估方法 static::arrayCountLessOrEqual 的逆条件。 |
| notArrayCountLessThan | 评估方法 static::arrayCountLessThan 的逆条件。 |
| notArrayIsList | 评估方法 static::arrayIsList 的逆条件。 |
| notArrayKeyExists | 评估方法 static::arrayKeyExists 的逆条件。 |
| notInArray | 评估方法 static::inArray 的逆条件。 |
jf\assert\TAssert
用于验证和如果验证未通过则抛出异常的特性。
| 方法 | 描述 |
|---|---|
| assert | 检查断言是否成立。 |
| empty | 检查值是否为空。 |
| isFalse | 验证变量的内容是否为 FALSE。 |
| isTrue | 验证变量的内容是否为 TRUE。 |
| notEmpty | 检查值是否不为空。 |
| notIsFalse | 验证变量的内容是否不为 FALSE。 |
| notIsTrue | 验证变量的内容是否不为 TRUE。 |
jf\assert\TClassObj
使用PHP模块 classobj 函数的断言特性,请参阅文档。
| 方法 | 描述 |
|---|---|
| classAlias | 为类创建别名。 |
| classExists | 检查类是否已定义。 |
| enumExists | 检查枚举是否已定义。 |
| interfaceExists | 检查接口是否已定义。 |
| isA | 检查对象是否为此类的实例或是否有此类作为其父类。 |
| isSubclassOf | 检查对象是否以此类作为其父类或实现它。 |
| methodExists | 检查类方法是否存在。 |
| notClassAlias | 评估方法 static::classAlias 的逆条件。 |
| notClassExists | 评估方法 static::classExists 的逆条件。 |
| notEnumExists | 评估方法 static::enumExists 的逆条件。 |
| notInterfaceExists | 评估方法 static::interfaceExists 的逆条件。 |
| notIsA | 评估方法 static::isA 的逆条件。 |
| notIsSubclassOf | 评估方法 static::isSubclassOf 的逆条件。 |
| notMethodExists | 评估方法 static::methodExists 的逆条件。 |
| notPropertyExists | 评估方法 static::propertyExists 的逆条件。 |
| notTraitExists | 评估方法 static::traitExists 的逆条件。 |
| propertyExists | 检查对象或类是否有属性。 |
| traitExists | 检查是否存在特性。 |
jf\assert\TCtype
用于断言的特性,使用 PHP 模块 ctype 中的函数,请参阅 文档。
| 方法 | 描述 |
|---|---|
| isAlnum | 检查是否为字母数字字符。 |
| isAlpha | 检查是否为字母字符。 |
| isCntrl | 检查是否为控制字符。 |
| isDigit | 检查是否为数字字符。 |
| isGraph | 检查是否为任何可打印字符(除空格外)。 |
| isLower | 检查是否为小写字母。 |
| isPrint | 检查是否为可打印字符。 |
| isPunct | 检查是否为任何可打印字符,既不是空白也不是字母数字。 |
| isSpace | 检查是否为空白字符。 |
| isUpper | 检查是否为大写字母。 |
| isXdigit | 检查是否为表示十六进制数字的字符。 |
| notIsAlnum | 评估方法 static::isAlnum 的逆条件。 |
| notIsAlpha | 评估方法 static::isAlpha 的逆条件。 |
| notIsCntrl | 评估方法 static::isCntrl 的逆条件。 |
| notIsDigit | 评估方法 static::isDigit 的逆条件。 |
| notIsGraph | 评估方法 static::isGraph 的逆条件。 |
| notIsLower | 评估方法 static::isLower 的逆条件。 |
| notIsPrint | 评估方法 static::isPrint 的逆条件。 |
| notIsPunct | 评估方法 static::isPunct 的逆条件。 |
| notIsSpace | 评估方法 static::isSpace 的逆条件。 |
| notIsUpper | 评估方法 static::isUpper 的逆条件。 |
| notIsXdigit | 评估方法 static::isXdigit 的逆条件。 |
jf\assert\TFileSystem
用于断言的特性,使用 PHP 模块 filesystem 中的函数,请参阅 文档。
| 方法 | 描述 |
|---|---|
| chgrp | 更改文件组。 |
| chmod | 更改文件模式。 |
| chown | 更改文件所有者。 |
| copy | 复制文件。 |
| fclose | 关闭一个打开的文件指针。 |
| fdatasync | 同步数据(不包括元数据)到文件。 |
| feof | 测试文件指针上的文件结束位置。 |
| fflush | 刷新文件输出。 |
| fileExists | 检查文件或目录是否存在。 |
| flock | 便携式咨询文件锁定。 |
| fnmatch | 匹配文件名与模式。 |
| fsync | 同步对文件的更改(包括元数据)。 |
| ftruncate | 截断文件到指定长度。 |
| isDir | 判断文件名是否为目录。 |
| isExecutable | 判断文件名是否可执行。 |
| isFile | 判断文件名是否为常规文件。 |
| isLink | 判断文件名是否为符号链接。 |
| isReadable | 判断文件是否存在且可读。 |
| isUploadedFile | 判断文件是否通过 HTTP POST 上传。 |
| isWritable | 判断文件名是否可写。 |
| lchgrp | 更改符号链接的组所有权。 |
| lchown | 更改符号链接的用户所有权。 |
| link | 创建一个硬链接。 |
| mkdir | 创建目录。 |
| moveUploadedFile | 将上传的文件移动到新位置。 |
| notChgrp | 评估方法 static::chgrp 的逆条件。 |
| notChmod | 评估方法 static::chmod 的逆条件。 |
| notChown | 评估方法 static::chown 的逆条件。 |
| notCopy | 评估方法 static::copy 的逆条件。 |
| notFclose | 评估方法 static::fclose 的逆条件。 |
| notFdatasync | 评估方法 static::fdatasync 的逆条件。 |
| notFeof | 评估方法 static::feof 的逆条件。 |
| notFflush | 评估方法 static::fflush 的逆条件。 |
| notFileExists | 评估方法 static::fileExists 的逆条件。 |
| notFlock | 评估方法 static::flock 的逆条件。 |
| notFnmatch | 评估方法 static::fnmatch 的逆条件。 |
| notFsync | 评估方法 static::fsync 的逆条件。 |
| notFtruncate | 评估方法 static::ftruncate 的逆条件。 |
| notIsDir | 评估方法 static::isDir 的逆条件。 |
| notIsExecutable | 评估方法 static::isExecutable 的逆条件。 |
| notIsFile | 评估方法 static::isFile 的逆条件。 |
| notIsLink | 评估方法 static::isLink 的逆条件。 |
| notIsReadable | 评估方法 static::isReadable 的逆条件。 |
| notIsUploadedFile | 评估方法 static::isUploadedFile 的逆条件。 |
| notIsWritable | 评估方法 static::isWritable 的逆条件。 |
| notLchgrp | 评估方法 static::lchgrp 的逆条件。 |
| notLchown | 评估方法 static::lchown 的逆条件。 |
| notLink | 评估方法 static::link 的逆条件。 |
| notMkdir | 评估方法 static::mkdir 的逆条件。 |
| notMoveUploadedFile | 评估方法 static::moveUploadedFile 的逆条件。 |
| notRename | 评估方法 static::rename 的逆条件。 |
| notRewind | 评估方法 static::rewind 的逆条件。 |
| notRmdir | 评估方法 static::rmdir 的逆条件。 |
| notSymlink | 评估方法 static::symlink 的逆条件。 |
| notTouch | 评估方法 static::touch 的逆条件。 |
| notUnlink | 评估方法 static::unlink 的逆条件。 |
| rename | 重命名文件或目录。 |
| rewind | 重置文件指针的位置。 |
| rmdir | 删除目录。 |
| symlink | 创建符号链接。 |
| touch | 设置文件的访问和修改时间。 |
| unlink | 删除文件。 |
jf\assert\TFilter
PHP模块 filter 中断言使用的特性,请参阅 文档。
| 方法 | 描述 |
|---|---|
| filterHasVar | 检查指定类型的变量是否存在。 |
| filterValidateBool | 对于 1、true、on 和 yes 返回 true。否则返回 false。 |
| filterValidateDomain | 验证域名标签长度是否有效。 |
| filterValidateEmail | 验证值是否是有效的电子邮件地址。 |
| filterValidateFloat | 验证值为浮点数,可选地来自指定的范围,并在成功时转换为浮点数。 |
| filterValidateInt | 验证值是否为整数,可选地验证是否在指定的范围内,并在成功时转换为整型。 |
| filterValidateIp | 验证值是否为IP地址,可选地仅验证IPv4或IPv6或非私有或保留地址范围。 |
| filterValidateMac | 验证值是否为MAC地址。 |
| filterValidateRegexp | 验证值是否符合正则表达式,即与Perl兼容的正则表达式。 |
| filterValidateUrl | 验证值是否为URL(根据http://www.faqs.org/rfcs/rfc2396),可选地包含必要的组件。 |
| filterVar | 使用指定的过滤器过滤变量。 |
| notFilterHasVar | 评估方法static::filterHasVar的逆条件。 |
| notFilterValidateBool | 评估方法static::filterValidateBool的逆条件。 |
| notFilterValidateDomain | 评估方法static::filterValidateDomain的逆条件。 |
| notFilterValidateEmail | 评估方法static::filterValidateEmail的逆条件。 |
| notFilterValidateFloat | 评估方法static::filterValidateFloat的逆条件。 |
| notFilterValidateInt | 评估方法static::filterValidateInt的逆条件。 |
| notFilterValidateIp | 评估方法static::filterValidateIp的逆条件。 |
| notFilterValidateMac | 评估方法static::filterValidateMac的逆条件。 |
| notFilterValidateRegexp | 评估方法static::filterValidateRegexp的逆条件。 |
| notFilterValidateUrl | 评估方法static::filterValidateUrl的逆条件。 |
| notFilterVar | 评估方法static::filterVar的逆条件。 |
jf\assert\TFloat
用于浮点数之间比较的特性。
| 方法 | 描述 |
|---|---|
| floatBetweenAnd | 检查浮点数值是否在给定的范围内。 |
| floatGreaterOrEqual | 检查浮点数值是否大于或等于另一个值。 |
| floatGreaterThan | 检查浮点数值是否大于另一个值。 |
| floatIdentical | 检查浮点数值是否与另一个值相同(===)。 |
| floatLessOrEqual | 检查浮点数值是否小于或等于另一个值。 |
| floatLessThan | 检查浮点数值是否小于另一个值。 |
| notFloatBetweenAnd | 评估方法static::floatBetweenAnd的逆条件。 |
| notFloatGreaterOrEqual | 评估方法static::floatGreaterOrEqual的逆条件。 |
| notFloatGreaterThan | 评估方法static::floatGreaterThan的逆条件。 |
| notFloatIdentical | 评估方法static::floatIdentical的逆条件。 |
| notFloatLessOrEqual | 评估方法static::floatLessOrEqual的逆条件。 |
| notFloatLessThan | 评估方法static::floatLessThan的逆条件。 |
jf\assert\TFuncHand
用于使用PHP模块funchand中的函数进行断言的特质,见文档。
| 方法 | 描述 |
|---|---|
| functionExists | 如果给定的函数已定义,则返回true。 |
| notFunctionExists | 评估方法static::functionExists的逆条件。 |
jf\assert\TInfo
用于使用PHP模块info中的函数进行断言的特质,见文档。
| 方法 | 描述 |
|---|---|
| extensionLoaded | 确定是否已加载扩展。 |
| notExtensionLoaded | 评估方法static::extensionLoaded的逆条件。 |
| notVersionCompare | 评估方法static::versionCompare的逆条件。 |
| versionCompare | 比较两个“PHP标准化”的版本号字符串。 |
jf\assert\TInteger
整数之间比较的特性。
| 方法 | 描述 |
|---|---|
| intBetweenAnd | 检查整数值是否在给定的范围内。 |
| intGreaterOrEqual | 检查一个整数值是否大于或等于另一个。 |
| intGreaterThan | 检查一个整数值是否大于另一个。 |
| intIdentical | 检查一个整数值是否与另一个相同(===)。 |
| intLessOrEqual | 检查一个整数值是否小于或等于另一个。 |
| intLessThan | 检查一个整数值是否小于另一个。 |
| notIntBetweenAnd | 评估方法 static::intBetweenAnd 的逆条件。 |
| notIntGreaterOrEqual | 评估方法 static::intGreaterOrEqual 的逆条件。 |
| notIntGreaterThan | 评估方法 static::intGreaterThan 的逆条件。 |
| notIntIdentical | 评估方法 static::intIdentical 的逆条件。 |
| notIntLessOrEqual | 评估方法 static::intLessOrEqual 的逆条件。 |
| notIntLessThan | 评估方法 static::intLessThan 的逆条件。 |
jf\assert\TLogical
混合类型之间逻辑比较的特性。
| 方法 | 描述 |
|---|---|
| betweenAnd | 检查一个值是否在给定的范围内。 |
| equal | 检查一个值是否等于另一个(==)。 |
| greaterOrEqual | 检查一个值是否大于或等于另一个。 |
| greaterThan | 检查一个值是否大于另一个。 |
| identical | 检查一个值是否与另一个相同(===)。 |
| lessOrEqual | 检查一个值是否小于或等于另一个。 |
| lessThan | 检查一个值是否小于另一个。 |
| notBetweenAnd | 评估方法 static::betweenAnd 的逆条件。 |
| notEqual | 评估方法 static::equal 的逆条件。 |
| notGreaterOrEqual | 评估方法 static::greaterOrEqual 的逆条件。 |
| notGreaterThan | 评估方法 static::greaterThan 的逆条件。 |
| notIdentical | 评估方法 static::identical 的逆条件。 |
| notLessOrEqual | 评估方法 static::lessOrEqual 的逆条件。 |
| notLessThan | 评估方法 static::lessThan 的逆条件。 |
jf\assert\TMath
使用 PHP 模块 math 中的函数进行断言的 trait,请参阅文档。
| 方法 | 描述 |
|---|---|
| isFinite | 查找一个值是否是合法的有限数字。 |
| isInfinite | 查找一个值是否是无穷大。 |
| isNan | 查找一个值是否不是数字。 |
| notIsFinite | 评估方法 static::isFinite 的逆条件。 |
| notIsInfinite | 评估方法 static::isInfinite 的逆条件。 |
| notIsNan | 评估方法 static::isNan 的逆条件。 |
jf\assert\TStrings
使用 PHP 模块 strings 中的函数进行断言的 trait,请参阅文档。
| 方法 | 描述 |
|---|---|
| notRegex | 评估方法 static::regex 的逆条件。 |
| notStrContains | 评估方法 static::strContains 的逆条件。 |
| notStrEndsWith | 评估方法 static::strEndsWith 的逆条件。 |
| notStrLengthBetweenAnd | 评估方法 static::strLengthBetweenAnd 的逆条件。 |
| notStrLengthGreaterOrEqual | 评估方法 static::strLengthGreaterOrEqual 的逆条件。 |
| notStrLengthGreaterThan | 评估方法 static::strLengthGreaterThan 的逆条件。 |
| notStrLengthIdentical | 评估方法 static::strLengthIdentical 的逆条件。 |
| notStrLengthLessOrEqual | 评估方法 static::strLengthLessOrEqual 的逆条件。 |
| notStrLengthLessThan | 评估方法 static::strLengthLessThan 的逆条件。 |
| notStrStartsWith | 评估方法 static::strStartsWith 的逆条件。 |
| 正则表达式 | 检查字符串是否与正则表达式匹配。 |
| strContains | 确定字符串是否包含指定的子字符串。 |
| strEndsWith | 检查字符串是否以指定的子字符串结尾。 |
| strLengthBetweenAnd | 检查字符串的长度是否在给定的范围内。 |
| strLengthGreaterOrEqual | 检查字符串的长度是否大于或等于另一个。 |
| strLengthGreaterThan | 检查字符串的长度是否大于另一个。 |
| strLengthIdentical | 检查字符串的长度是否与另一个完全相同(===)。 |
| strLengthLessOrEqual | 检查字符串的长度是否小于或等于另一个。 |
| strLengthLessThan | 检查字符串的长度是否小于另一个。 |
| strStartsWith | 检查字符串是否以给定的子字符串开头。 |
jf\assert\TVar
使用 PHP 模块 var 中的函数的断言特性,见文档。
| 方法 | 描述 |
|---|---|
| isArray | 查找变量是否为数组。 |
| isBool | 确定变量是否为布尔值。 |
| isCallable | 验证值是否可以从当前作用域中作为函数调用。 |
| isCountable | 验证变量的内容是否为可计数值。 |
| isFloat | 查找变量的类型是否为浮点数。 |
| isInstanceOf | 检查值是否为指定类的实例。 |
| isInt | 查找变量的类型是否为整数。 |
| isIterable | 验证变量的内容是否为可迭代的值。 |
| isNull | 查找变量是否为 null。 |
| isNumeric | 查找变量是否为数字或数值字符串。 |
| isObject | 查找变量是否为对象。 |
| isResource | 查找变量是否为资源。 |
| isScalar | 查找变量是否为标量。 |
| isString | 查找变量的类型是否为字符串。 |
| isTraversable | 检查值是否为数组或 \Traversable 的实例。 |
| notIsArray | 评估方法 static::isArray 的逆条件。 |
| notIsBool | 评估方法 static::isBool 的逆条件。 |
| notIsCallable | 评估方法 static::isCallable 的逆条件。 |
| notIsCountable | 评估方法 static::isCountable 的逆条件。 |
| notIsFloat | 评估方法 static::isFloat 的逆条件。 |
| notIsInstanceOf | 评估方法 static::isInstanceOf 的逆条件。 |
| notIsInt | 评估方法 static::isInt 的逆条件。 |
| notIsIterable | 评估方法 static::isIterable 的逆条件。 |
| notIsNull | 评估方法 static::isNull 的逆条件。 |
| notIsNumeric | 评估方法 static::isNumeric 的逆条件。 |
| notIsObject | 评估方法 static::isObject 的逆条件。 |
| notIsResource | 评估方法 static::isResource 的逆条件。 |
| notIsScalar | 评估方法 static::isScalar 的逆条件。 |
| notIsString | 评估方法 static::isString 的逆条件。 |
| notIsTraversable | 评估方法 static::isTraversable 的逆条件。 |