diff --git a/CHANGELOG.md b/CHANGELOG.md index 14063e4..ac3989e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,20 @@ # Meritoo Common Library + Common and useful classes, methods, exceptions etc. +# 0.1.0 + +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 + +1. Composer > require ext-pcre +2. Arrays > minor refactoring +3. Update @author and @copyright in classes' descriptions + # 0.0.20 1. Collection > add() method > treat empty string as not provided index (same as null) 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/build.xml b/build.xml index d23552d..d65367b 100644 --- a/build.xml +++ b/build.xml @@ -29,7 +29,7 @@ Conditional running of tests. Disabled, because not required. - Krzysztof Niziol + Meritoo 2017-02-22 diff --git a/composer.json b/composer.json index 8303f1b..6dfa257 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "meritoo/common-library", "description": "Useful classes, methods, extensions etc.", "license": "MIT", - "version": "0.0.20", + "version": "0.1.0", "authors": [ { "name": "Meritoo.pl", @@ -11,7 +11,8 @@ } ], "require": { - "php": ">=5.5.9", + "php": ">=5.6", + "ext-pcre": "*", "doctrine/orm": "^2.5", "gedmo/doctrine-extensions": "^2.4" }, diff --git a/docker-compose.yml b/docker-compose.yml index 25cf8b9..ef072c8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,9 @@ version: '3' services: - php-cli: - image: ${DOCKER_CONTAINER_OWNER}/${DOCKER_CONTAINER_PROJECT}-php-cli - container_name: ${DOCKER_CONTAINER_OWNER}-${DOCKER_CONTAINER_PROJECT}-php-cli + php: + image: ${DOCKER_CONTAINER_OWNER}/${DOCKER_CONTAINER_PROJECT}-php + container_name: ${DOCKER_CONTAINER_OWNER}-${DOCKER_CONTAINER_PROJECT}-php entrypoint: php command: -S 0.0.0.0:9999 build: @@ -13,7 +13,7 @@ services: volumes: - .:/project composer: - image: ${DOCKER_CONTAINER_OWNER}/${DOCKER_CONTAINER_PROJECT}-php-cli + image: ${DOCKER_CONTAINER_OWNER}/${DOCKER_CONTAINER_PROJECT}-php container_name: ${DOCKER_CONTAINER_OWNER}-${DOCKER_CONTAINER_PROJECT}-composer entrypoint: composer volumes: diff --git a/docker/config/Dockerfile b/docker/config/Dockerfile index 989e520..df4b0f8 100644 --- a/docker/config/Dockerfile +++ b/docker/config/Dockerfile @@ -1,4 +1,4 @@ -FROM php:5.5-cli +FROM php:5.6-cli MAINTAINER Meritoo # 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 545b3dd..f8165a8 100644 --- a/docs/Development.md +++ b/docs/Development.md @@ -1,4 +1,5 @@ # Meritoo Common Library + Development-related information # Requirements @@ -61,13 +62,13 @@ docker-compose run composer remove / Fix coding standard by running command: ```bash -docker-compose exec php-cli php-cs-fixer fix +docker-compose exec php php-cs-fixer fix ``` Omit cache and run the Fixer from scratch by running command: ```bash -docker-compose exec php-cli rm .php_cs.cache && docker-compose exec php-cli php-cs-fixer fix +docker-compose exec php rm .php_cs.cache && docker-compose exec php php-cs-fixer fix ``` > [Want more?](https://cs.sensiolabs.org) @@ -82,17 +83,17 @@ Install required packages by running command: `docker-compose run composer insta #### Simply & quick, without code coverage -Tests are running using Docker and `php-cli` service defined in `docker-compose.yml`. Example: +Tests are running using Docker and `php` service defined in `docker-compose.yml`. Example: ```bash -docker-compose exec php-cli phpunit --no-coverage +docker-compose exec php phpunit --no-coverage ``` You can also run them in container. In this case you have to run 2 commands: 1. Enter container: ```bash - docker-compose exec php-cli bash + docker-compose exec php bash ``` 2. Run tests: @@ -104,7 +105,7 @@ You can also run them in container. In this case you have to run 2 commands: #### With code coverage ```bash -docker-compose exec php-cli phpunit +docker-compose exec php phpunit ``` # Other @@ -112,7 +113,7 @@ docker-compose exec php-cli phpunit Rebuild project and run tests by running command: ```bash -docker-compose exec php-cli phing +docker-compose exec php phing ``` [‹ Back to `Readme`](../README.md) 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 + +# Meritoo # 2017-06-06 # cache.clearWithWarmup = false @@ -81,7 +81,7 @@ dir.reports.coverage = ${dir.reports}/phpunit_coverage # Disabled, because unnecessary right now # phpdocumentor/phpdocumentor cannot be installed via Composer # -# Krzysztof Niziol +# Meritoo # 2017-02-22 # #dir.docs = ${dir.build}/docs diff --git a/phing/tests.xml b/phing/tests.xml index c4e983b..edd288b 100644 --- a/phing/tests.xml +++ b/phing/tests.xml @@ -4,7 +4,7 @@ The AutoloaderTask is required to load binaries installed by Composer. The "autoloaderpath" attribute of this task is not required, because it's default value is: vendor/autoload.php. - Krzysztof Niziol + Meritoo 2017-02-23 --> @@ -48,7 +48,7 @@ a) phpdocumentor/phpdocumentor v2.9.0 requires symfony/validator ~2.2 b) symfony/validator ~2.2 causes to remove symfony/symfony 3.* - Krzysztof Niziol + Meritoo 2017-02-22 --> @@ -73,7 +73,7 @@ a) phpdocumentor/phpdocumentor v2.9.0 requires symfony/validator ~2.2 b) symfony/validator ~2.2 causes to remove symfony/symfony 3.* - Krzysztof Niziol + Meritoo 2017-02-22 --> @@ -113,7 +113,7 @@ a) phpdocumentor/phpdocumentor v2.9.0 requires symfony/validator ~2.2 b) symfony/validator ~2.2 causes to remove symfony/symfony 3.* - Krzysztof Niziol + Meritoo 2017-02-22 @@ -142,7 +142,7 @@ via Composer the Symfony2 standard is not included / available in this package. In this case the PHP Coding Standards Fixer (http://cs.sensiolabs.org) is used. - Krzysztof Niziol + Meritoo 2017-02-22 --> @@ -166,7 +166,7 @@