Download the PHP package azjezz/roew without Composer
On this page you can find all versions of the php package azjezz/roew. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package roew
Roew
Hack-like result or exception wrapper for PHP.
Installation
This package can be installed with Composer.
Usage
API
abstract Roew\ResultOrExceptionWrapper<T>
Represents a result of operation that either has a successful result or the exception object if that operation failed.
This is an abstract class. You get generally
ResultOrExceptionWrapper<T>
by callingwrap<T>()
, passing in thecallable(): T
, and aWrappedResult<T>
orWrappedException<Te, Tr>
is returned.
@template T
public function Roew\ResultOrExceptionWrapper<T>::getResult(): T
Return the result of the operation, or throw underlying exception.
- if the operation succeeded: return its result.
- if the operation failed: throw the exception inciting failure.
@return T
- The result of the operation upon success
public Roew\ResultOrExceptionWrapper::getException(): Exception
Return the underlying exception, or fail with a logic exception.
- if the operation succeeded: fails with a logic exception.
- if the operation failed: returns the exception indicating failure.
@throws \LogicException
- When the operation succeeded
public Roew\ResultOrExceptionWrapper::isSucceeded(): bool
Indicates whether the operation associated with this wrapper existed normally.
if
isSucceeded()
returnstrue
,isFailed()
returns false.
@return bool
-true
if the operation succeeded;false
otherwise
public Roew\ResultOrExceptionWrapper::isFailed(): bool
Indicates whether the operation associated with this wrapper exited abnormally via an exception of some sort.
if
isFailed()
returnstrue
,isSucceeded()
returns false.
@return bool
-true
if the operation failed;false
otherwise
References
- https://docs.hhvm.com/hack/reference/interface/HH.Asio.ResultOrExceptionWrapper/
- https://docs.hhvm.com/hack/reference/class/HH.Asio.WrappedResult/
- https://docs.hhvm.com/hack/reference/class/HH.Asio.WrappedException/
License
The Roew Project is open-sourced software licensed under the MIT license.