weblinuxgame/date-type

值类型格式化和验证工具

1.0.0 2019-06-09 04:32 UTC

This package is auto-updated.

Last update: 2024-09-09 16:07:00 UTC


README

1. 支持基本类型检查与格式化

基本类型
字符串,数字(整数,浮点[双精度]),
数组(array,数字数组,列表Map,HashMap),
对象,空,布尔,资源,闭包,可调用

包括类型别名和缩写支持
JSON化后类型检查与格式化还原
序列化后类型检查与格式化还原

eg :  
    0 === Number::format("0")
    null === Nil::format("N;")
    true == Nil::isSerailize("N;")  
    
    false === Number::verify(null)   
    true == NumberArr::verify([0,1,2,3])
    false == NumberArr::verify([0,'test'=>1,'php'])

2. 支持反射检查 Any 工具类

eg :
 $bool = Any::isInstance(Type:class,New Number)
 $interfaces = Any::hasInterfaces(Number::class)
  
 $result = Any::hasInterfaces(Number::class,[Type::class])
 if($result[Type::class]){
     echo ""has interface Type";
 }