pagantis/module-utils

Pagantis PHP Library. Module utils

v2.0.1 2019-03-14 10:52 UTC

This package is auto-updated.

Last update: 2024-12-20 01:57:25 UTC


README

CircleCI: CircleCI

Latest Stable Version composer.lock Scrutinizer Code Quality

Module Utils will help you when developing integration test of Pagantis. The library will use the Exception object to find some problem. Check each exception type to find the error which causes the problem.

How to use

Install the library by:

  • Downloading it from here

  • Using Composer:

composer require pagantis/module-utils

Finally, be sure to include the autoloader:

require_once '/path/to/your-project/vendor/autoload.php';

Once the library is ready and inside the project the stub objects will available and the moduleUtils will also available.

//Amount mismatch Example
try {
    if ($price1 != $price2) {
        throw new AmountMismatchException($price1, $price2);
    }
} catch(AmountMismatchException $e) {
    $jsonResponse = new JsonExceptionResponse();
    $jsonResponse->setException($e);
    $jsonResponse->toJson();
}

Help us to improve

We are happy to accept suggestions or pull requests. If you are willing to help us develop better software please create a pull request here following the PSR-2 code style and we will use reviewable to check the code and if al test pass and no issues are detected by SensioLab Insights you could will be ready to merge.