diff --git a/CHANGELOG.md b/CHANGELOG.md index b7007e3..ac3989e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Common and useful classes, methods, exceptions etc. 1. Composer > support/require PHP 5.6+ (instead of 5.5.9+) 2. Docker > rename `php-cli` service to `php` 3. Exceptions > create instance of exception using static `create()` method (instead of constructor) +4. Documentation > Exceptions # 0.0.21 diff --git a/README.md b/README.md index 382b117..7b2e20e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Meritoo Common Library + Common and useful classes, methods, exceptions etc. [![Travis](https://img.shields.io/travis/rust-lang/rust.svg?style=flat-square)](https://travis-ci.org/meritoo/common-library) [![Packagist](https://img.shields.io/packagist/v/meritoo/common-library.svg?style=flat-square)](https://packagist.org/packages/meritoo/common-library) [![license](https://img.shields.io/github/license/meritoo/common-library.svg?style=flat-square)](https://github.com/meritoo/common-library) [![GitHub commits](https://img.shields.io/github/commits-since/meritoo/common-library/0.0.1.svg?style=flat-square)](https://github.com/meritoo/common-library) [![Coverage Status](https://coveralls.io/repos/github/meritoo/common-library/badge.svg?branch=master)](https://coveralls.io/github/meritoo/common-library?branch=master) @@ -17,7 +18,8 @@ composer require meritoo/common-library 1. [Base test case (with common methods and data providers)](docs/Base-test-case.md) 2. [Collection of elements](docs/Collection-of-elements.md) -3. [Static methods](docs/Static-methods.md) +3. [Exceptions](docs/Static-methods.md) +4. [Static methods](docs/Static-methods.md) # Development diff --git a/docs/Base-test-case.md b/docs/Base-test-case.md index 529b7f1..f8b7b1a 100644 --- a/docs/Base-test-case.md +++ b/docs/Base-test-case.md @@ -1,4 +1,5 @@ # Meritoo Common Library + Common and useful classes, methods, exceptions etc. # Base test case (with common methods and data providers) @@ -45,6 +46,7 @@ class MimeTypesTest extends BaseTestCase 1. [**Base test case (with common methods and data providers)**](Base-test-case.md) 2. [Collection of elements](Collection-of-elements.md) -3. [Static methods](Static-methods.md) +3. [Exceptions](Exceptions.md) +4. [Static methods](Static-methods.md) [‹ Back to `Readme`](../README.md) diff --git a/docs/Collection-of-elements.md b/docs/Collection-of-elements.md index 79c57fa..fb0a600 100644 --- a/docs/Collection-of-elements.md +++ b/docs/Collection-of-elements.md @@ -1,4 +1,5 @@ # Meritoo Common Library + Common and useful classes, methods, exceptions etc. # Collection of elements @@ -43,6 +44,7 @@ var_dump($simpleCollection->has('dolor')); // bool(true) 1. [Base test case (with common methods and data providers)](Base-test-case.md) 2. [**Collection of elements**](Collection-of-elements.md) -3. [Static methods](Static-methods.md) +3. [Exceptions](Exceptions.md) +4. [Static methods](Static-methods.md) [‹ Back to `Readme`](../README.md) diff --git a/docs/Development.md b/docs/Development.md index 944d334..f8165a8 100644 --- a/docs/Development.md +++ b/docs/Development.md @@ -1,4 +1,5 @@ # Meritoo Common Library + Development-related information # Requirements diff --git a/docs/Exceptions.md b/docs/Exceptions.md new file mode 100644 index 0000000..eda4362 --- /dev/null +++ b/docs/Exceptions.md @@ -0,0 +1,61 @@ +# Meritoo Common Library + +Common and useful classes, methods, exceptions etc. + +# Exceptions + +### Create instance of exception + +This package contains a lot of exceptions. Each of them contains static method `create()` with proper arguments that is used to create instance of the exception. Example: + +```php +use Meritoo\Common\Exception\Bundle\IncorrectBundleNameException; +throw IncorrectBundleNameException::create('RisusIpsum'); +``` + +### Base exception for unknown type of something + +##### Short description + +It's a `Meritoo\Common\Exception\Base\UnknownTypeException` class. Related to `Meritoo\Common\Type\Base\BaseType` class that represents type of something, e.g. type of button, order. + +##### Usage + +You can extend `Meritoo\Common\Exception\Base\UnknownTypeException` class and create your own static method, e.g. `createException()`, which will be used create instance of the exception. Inside the `createException()` method you can call `parent::create()` method. + +##### Example + +```php +