phpextra/unknown

PHP未知类型

dev-master / 1.0.x-dev 2015-04-02 08:44 UTC

This package is not auto-updated.

Last update: 2024-09-24 03:13:57 UTC


README

#UnknownType (PHPExtra\Type\UnknownType)

Latest Stable Version Total Downloads License Build Status Scrutinizer Code Quality Code Coverage GitTip

##用法

这种情况不应该发生,但有时确实如此 - 你有一个具有许多不同响应类型的方法,但希望像专业人士一样处理它

$messedUpResponse = $api->getMeSomeChickens(); // returns "Chicken" **or** "Collection" **of** "Chickens" **or** "no" as an error response :-)

$result = new UnknownType($messedUpResponse);

if($result->isCollection()){
    $result->getAsCollection()->sort($sorter);
    ...
}elseif($result->isException){
    throw $result->getAsException();
    ...
}

UnknownType 可以扩展和定制 :-)

安装(Composer)

{
    "require": {
        "phpextra/unknown":"~1.0"
    }
}

##变更日志

No releases yet

##贡献

所有代码贡献必须通过拉取请求进行。克隆项目,创建功能分支,然后向我发送拉取请求。为了确保代码库的一致性,你应该确保代码遵循 编码标准。如果您想帮忙,请查看 问题列表

##需求

See composer.json for a full list of dependencies.

##作者

Jacek Kobus - <kobus.jacek@gmail.com>

许可证信息

See the file LICENSE.txt for copying permission.on.