phpextra / unknown
Unknown type for PHP
Installs: 8 026
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.3.0
- phpextra/collection: dev-master
- phpextra/enum: ~1.0
- phpextra/sorter: ~1.0
Requires (Dev)
- phpunit/phpunit: ~4.2
This package is not auto-updated.
Last update: 2024-11-05 03:42:32 UTC
README
#UnknownType (PHPExtra\Type\UnknownType)
##Usage
It should not happen but sometimes does - you have a method with many different response types, but want to handle it like a pro:
$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 can be extended and customized :-)
Installation (Composer)
{ "require": { "phpextra/unknown":"~1.0" } }
##Changelog
No releases yet
##Contributing
All code contributions must go through a pull request. Fork the project, create a feature branch, and send me a pull request. To ensure a consistent code base, you should make sure the code follows the coding standards. If you would like to help take a look at the list of issues.
##Requirements
See composer.json for a full list of dependencies.
##Authors
Jacek Kobus - <kobus.jacek@gmail.com>
License information
See the file LICENSE.txt for copying permission.on.