mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 01:31:45 +01:00
Merge branch 'develop'
This commit is contained in:
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,6 +1,20 @@
|
|||||||
# Meritoo Common Library
|
# Meritoo Common Library
|
||||||
|
|
||||||
Common and useful classes, methods, exceptions etc.
|
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
|
# 0.0.20
|
||||||
|
|
||||||
1. Collection > add() method > treat empty string as not provided index (same as null)
|
1. Collection > add() method > treat empty string as not provided index (same as null)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# Meritoo Common Library
|
# Meritoo Common Library
|
||||||
|
|
||||||
Common and useful classes, methods, exceptions etc.
|
Common and useful classes, methods, exceptions etc.
|
||||||
|
|
||||||
[](https://travis-ci.org/meritoo/common-library) [](https://packagist.org/packages/meritoo/common-library) [](https://github.com/meritoo/common-library) [](https://github.com/meritoo/common-library) [](https://coveralls.io/github/meritoo/common-library?branch=master)
|
[](https://travis-ci.org/meritoo/common-library) [](https://packagist.org/packages/meritoo/common-library) [](https://github.com/meritoo/common-library) [](https://github.com/meritoo/common-library) [](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)
|
1. [Base test case (with common methods and data providers)](docs/Base-test-case.md)
|
||||||
2. [Collection of elements](docs/Collection-of-elements.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
|
# Development
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
Conditional running of tests.
|
Conditional running of tests.
|
||||||
Disabled, because not required.
|
Disabled, because not required.
|
||||||
|
|
||||||
Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
Meritoo <github@meritoo.pl>
|
||||||
2017-02-22
|
2017-02-22
|
||||||
|
|
||||||
<if>
|
<if>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "meritoo/common-library",
|
"name": "meritoo/common-library",
|
||||||
"description": "Useful classes, methods, extensions etc.",
|
"description": "Useful classes, methods, extensions etc.",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"version": "0.0.20",
|
"version": "0.1.0",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Meritoo.pl",
|
"name": "Meritoo.pl",
|
||||||
@@ -11,7 +11,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.5.9",
|
"php": ">=5.6",
|
||||||
|
"ext-pcre": "*",
|
||||||
"doctrine/orm": "^2.5",
|
"doctrine/orm": "^2.5",
|
||||||
"gedmo/doctrine-extensions": "^2.4"
|
"gedmo/doctrine-extensions": "^2.4"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
version: '3'
|
version: '3'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
php-cli:
|
php:
|
||||||
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}-php-cli
|
container_name: ${DOCKER_CONTAINER_OWNER}-${DOCKER_CONTAINER_PROJECT}-php
|
||||||
entrypoint: php
|
entrypoint: php
|
||||||
command: -S 0.0.0.0:9999
|
command: -S 0.0.0.0:9999
|
||||||
build:
|
build:
|
||||||
@@ -13,7 +13,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- .:/project
|
- .:/project
|
||||||
composer:
|
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
|
container_name: ${DOCKER_CONTAINER_OWNER}-${DOCKER_CONTAINER_PROJECT}-composer
|
||||||
entrypoint: composer
|
entrypoint: composer
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM php:5.5-cli
|
FROM php:5.6-cli
|
||||||
MAINTAINER Meritoo <github@meritoo.pl>
|
MAINTAINER Meritoo <github@meritoo.pl>
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# Meritoo Common Library
|
# Meritoo Common Library
|
||||||
|
|
||||||
Common and useful classes, methods, exceptions etc.
|
Common and useful classes, methods, exceptions etc.
|
||||||
|
|
||||||
# Base test case (with common methods and data providers)
|
# 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)
|
1. [**Base test case (with common methods and data providers)**](Base-test-case.md)
|
||||||
2. [Collection of elements](Collection-of-elements.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)
|
[‹ Back to `Readme`](../README.md)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# Meritoo Common Library
|
# Meritoo Common Library
|
||||||
|
|
||||||
Common and useful classes, methods, exceptions etc.
|
Common and useful classes, methods, exceptions etc.
|
||||||
|
|
||||||
# Collection of elements
|
# 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)
|
1. [Base test case (with common methods and data providers)](Base-test-case.md)
|
||||||
2. [**Collection of elements**](Collection-of-elements.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)
|
[‹ Back to `Readme`](../README.md)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# Meritoo Common Library
|
# Meritoo Common Library
|
||||||
|
|
||||||
Development-related information
|
Development-related information
|
||||||
|
|
||||||
# Requirements
|
# Requirements
|
||||||
@@ -61,13 +62,13 @@ docker-compose run composer remove <vendor>/<package>
|
|||||||
Fix coding standard by running command:
|
Fix coding standard by running command:
|
||||||
|
|
||||||
```bash
|
```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:
|
Omit cache and run the Fixer from scratch by running command:
|
||||||
|
|
||||||
```bash
|
```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)
|
> [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
|
#### 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
|
```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:
|
You can also run them in container. In this case you have to run 2 commands:
|
||||||
1. Enter container:
|
1. Enter container:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose exec php-cli bash
|
docker-compose exec php bash
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Run tests:
|
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
|
#### With code coverage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose exec php-cli phpunit
|
docker-compose exec php phpunit
|
||||||
```
|
```
|
||||||
|
|
||||||
# Other
|
# Other
|
||||||
@@ -112,7 +113,7 @@ docker-compose exec php-cli phpunit
|
|||||||
Rebuild project and run tests by running command:
|
Rebuild project and run tests by running command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose exec php-cli phing
|
docker-compose exec php phing
|
||||||
```
|
```
|
||||||
|
|
||||||
[‹ Back to `Readme`](../README.md)
|
[‹ Back to `Readme`](../README.md)
|
||||||
|
|||||||
61
docs/Exceptions.md
Normal file
61
docs/Exceptions.md
Normal file
@@ -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
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Your\Package\Exception\Type;
|
||||||
|
|
||||||
|
use Meritoo\Common\Exception\Base\UnknownTypeException;
|
||||||
|
use Your\Package\Type\SimpleType;
|
||||||
|
|
||||||
|
class UnknownSimpleTypeException extends UnknownTypeException
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Creates exception
|
||||||
|
*
|
||||||
|
* @param string $unknownType Unknown and simple type
|
||||||
|
* @return UnknownSimpleTypeException
|
||||||
|
*/
|
||||||
|
public static function createException($unknownType)
|
||||||
|
{
|
||||||
|
/* @var UnknownSimpleTypeException $exception */
|
||||||
|
$exception = parent::create($unknownType, new SimpleType(), 'my simple type of something');
|
||||||
|
|
||||||
|
return $exception;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
# More
|
||||||
|
|
||||||
|
1. [Base test case (with common methods and data providers)](Base-test-case.md)
|
||||||
|
2. [Collection of elements](Collection-of-elements.md)
|
||||||
|
3. [**Exceptions**](Exceptions.md)
|
||||||
|
4. [Static methods](Static-methods.md)
|
||||||
|
|
||||||
|
[‹ Back to `Readme`](../README.md)
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
# Meritoo Common Library
|
# Meritoo Common Library
|
||||||
|
|
||||||
Common and useful classes, methods, exceptions etc.
|
Common and useful classes, methods, exceptions etc.
|
||||||
|
|
||||||
# Static methods
|
# Static methods
|
||||||
@@ -16,6 +17,7 @@ var_dump($firstElement); // string(5) "lorem"
|
|||||||
|
|
||||||
1. [Base test case (with common methods and data providers)](Base-test-case.md)
|
1. [Base test case (with common methods and data providers)](Base-test-case.md)
|
||||||
2. [Collection of elements](Collection-of-elements.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)
|
[‹ Back to `Readme`](../README.md)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ assets.installWithSymlink = true
|
|||||||
# The cache:clear command should always be called with the --no-warmup option. Warmup should be done via the cache:warmup command.
|
# The cache:clear command should always be called with the --no-warmup option. Warmup should be done via the cache:warmup command.
|
||||||
# https://github.com/symfony/symfony/blob/master/UPGRADE-3.3.md#frameworkbundle
|
# https://github.com/symfony/symfony/blob/master/UPGRADE-3.3.md#frameworkbundle
|
||||||
#
|
#
|
||||||
# Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
# Meritoo <github@meritoo.pl>
|
||||||
# 2017-06-06
|
# 2017-06-06
|
||||||
#
|
#
|
||||||
cache.clearWithWarmup = false
|
cache.clearWithWarmup = false
|
||||||
@@ -81,7 +81,7 @@ dir.reports.coverage = ${dir.reports}/phpunit_coverage
|
|||||||
# Disabled, because unnecessary right now
|
# Disabled, because unnecessary right now
|
||||||
# phpdocumentor/phpdocumentor cannot be installed via Composer
|
# phpdocumentor/phpdocumentor cannot be installed via Composer
|
||||||
#
|
#
|
||||||
# Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
# Meritoo <github@meritoo.pl>
|
||||||
# 2017-02-22
|
# 2017-02-22
|
||||||
#
|
#
|
||||||
#dir.docs = ${dir.build}/docs
|
#dir.docs = ${dir.build}/docs
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
The AutoloaderTask is required to load binaries installed by Composer.
|
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.
|
The "autoloaderpath" attribute of this task is not required, because it's default value is: vendor/autoload.php.
|
||||||
|
|
||||||
Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
Meritoo <github@meritoo.pl>
|
||||||
2017-02-23
|
2017-02-23
|
||||||
-->
|
-->
|
||||||
<autoloader />
|
<autoloader />
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
a) phpdocumentor/phpdocumentor v2.9.0 requires symfony/validator ~2.2
|
a) phpdocumentor/phpdocumentor v2.9.0 requires symfony/validator ~2.2
|
||||||
b) symfony/validator ~2.2 causes to remove symfony/symfony 3.*
|
b) symfony/validator ~2.2 causes to remove symfony/symfony 3.*
|
||||||
|
|
||||||
Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
Meritoo <github@meritoo.pl>
|
||||||
2017-02-22
|
2017-02-22
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
a) phpdocumentor/phpdocumentor v2.9.0 requires symfony/validator ~2.2
|
a) phpdocumentor/phpdocumentor v2.9.0 requires symfony/validator ~2.2
|
||||||
b) symfony/validator ~2.2 causes to remove symfony/symfony 3.*
|
b) symfony/validator ~2.2 causes to remove symfony/symfony 3.*
|
||||||
|
|
||||||
Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
Meritoo <github@meritoo.pl>
|
||||||
2017-02-22
|
2017-02-22
|
||||||
-->
|
-->
|
||||||
<!--<target name="build:doc"-->
|
<!--<target name="build:doc"-->
|
||||||
@@ -113,7 +113,7 @@
|
|||||||
a) phpdocumentor/phpdocumentor v2.9.0 requires symfony/validator ~2.2
|
a) phpdocumentor/phpdocumentor v2.9.0 requires symfony/validator ~2.2
|
||||||
b) symfony/validator ~2.2 causes to remove symfony/symfony 3.*
|
b) symfony/validator ~2.2 causes to remove symfony/symfony 3.*
|
||||||
|
|
||||||
Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
Meritoo <github@meritoo.pl>
|
||||||
2017-02-22
|
2017-02-22
|
||||||
|
|
||||||
<target name="doc:phpdoc2" description="Generates API documentations">
|
<target name="doc:phpdoc2" description="Generates API documentations">
|
||||||
@@ -142,7 +142,7 @@
|
|||||||
via Composer the Symfony2 standard is not included / available in this package. In this case the PHP Coding
|
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.
|
Standards Fixer (http://cs.sensiolabs.org) is used.
|
||||||
|
|
||||||
Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
Meritoo <github@meritoo.pl>
|
||||||
2017-02-22
|
2017-02-22
|
||||||
-->
|
-->
|
||||||
<target name="check:cs" description="Checks coding standard">
|
<target name="check:cs" description="Checks coding standard">
|
||||||
@@ -166,7 +166,7 @@
|
|||||||
<!--
|
<!--
|
||||||
Previous / old version
|
Previous / old version
|
||||||
|
|
||||||
Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
Meritoo <github@meritoo.pl>
|
||||||
2017-02-22
|
2017-02-22
|
||||||
|
|
||||||
<exec command="phpcpd \-\-log-pmd=${dir.reports}/pmd-cpd.xml ${dir.src}" />
|
<exec command="phpcpd \-\-log-pmd=${dir.reports}/pmd-cpd.xml ${dir.src}" />
|
||||||
@@ -204,7 +204,7 @@
|
|||||||
<!--
|
<!--
|
||||||
Previous / old version
|
Previous / old version
|
||||||
|
|
||||||
Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
Meritoo <github@meritoo.pl>
|
||||||
2017-02-22
|
2017-02-22
|
||||||
|
|
||||||
<exec command="phploc \-\-log-csv=${dir.reports}/phploc.csv ${dir.src}" />
|
<exec command="phploc \-\-log-csv=${dir.reports}/phploc.csv ${dir.src}" />
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ use Meritoo\Common\Utilities\Arrays;
|
|||||||
* Collection of elements.
|
* Collection of elements.
|
||||||
* It's a set of some elements, e.g. objects.
|
* It's a set of some elements, e.g. objects.
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class Collection implements Countable, ArrayAccess, IteratorAggregate
|
class Collection implements Countable, ArrayAccess, IteratorAggregate
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,27 +15,28 @@ use Meritoo\Common\Utilities\Arrays;
|
|||||||
/**
|
/**
|
||||||
* An exception used while type of something is unknown
|
* An exception used while type of something is unknown
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
abstract class UnknownTypeException extends Exception
|
abstract class UnknownTypeException extends Exception
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Creates exception
|
||||||
*
|
*
|
||||||
* @param string|int $unknownType The unknown type of something (value of constant)
|
* @param string|int $unknownType The unknown type of something (value of constant)
|
||||||
* @param BaseType $typeInstance An instance of class that contains type of the something
|
* @param BaseType $typeInstance An instance of class that contains type of the something
|
||||||
* @param string $typeName Name of the something
|
* @param string $typeName Name of the something
|
||||||
|
* @return UnknownTypeException
|
||||||
*/
|
*/
|
||||||
public function __construct($unknownType, BaseType $typeInstance, $typeName)
|
public static function create($unknownType, BaseType $typeInstance, $typeName)
|
||||||
{
|
{
|
||||||
$allTypes = $typeInstance->getAll();
|
|
||||||
$types = Arrays::values2string($allTypes, '', ', ');
|
|
||||||
|
|
||||||
$template = 'The \'%s\' type of %s is unknown. Probably doesn\'t exist or there is a typo. You should use one'
|
$template = 'The \'%s\' type of %s is unknown. Probably doesn\'t exist or there is a typo. You should use one'
|
||||||
. ' of these types: %s.';
|
. ' of these types: %s.';
|
||||||
|
|
||||||
|
$allTypes = $typeInstance->getAll();
|
||||||
|
$types = Arrays::values2string($allTypes, '', ', ');
|
||||||
$message = sprintf(sprintf($template, $unknownType, $typeName, $types));
|
$message = sprintf(sprintf($template, $unknownType, $typeName, $types));
|
||||||
parent::__construct($message);
|
|
||||||
|
return new static($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,22 +13,24 @@ use Exception;
|
|||||||
/**
|
/**
|
||||||
* An exception used while name of bundle is incorrect
|
* An exception used while name of bundle is incorrect
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class IncorrectBundleNameException extends Exception
|
class IncorrectBundleNameException extends Exception
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Creates exception
|
||||||
*
|
*
|
||||||
* @param string $bundleName Incorrect name of bundle
|
* @param string $bundleName Incorrect name of bundle
|
||||||
|
* @return IncorrectBundleNameException
|
||||||
*/
|
*/
|
||||||
public function __construct($bundleName)
|
public static function create($bundleName)
|
||||||
{
|
{
|
||||||
$template = 'Name of bundle \'%s\' is incorrect. It should start with big letter and end with "Bundle". Is'
|
$template = 'Name of bundle \'%s\' is incorrect. It should start with big letter and end with "Bundle". Is'
|
||||||
. ' there everything ok?';
|
. ' there everything ok?';
|
||||||
|
|
||||||
$message = sprintf($template, $bundleName);
|
$message = sprintf($template, $bundleName);
|
||||||
parent::__construct($message);
|
|
||||||
|
return new static($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (c) Meritoo.pl, http://www.meritoo.pl
|
|
||||||
* For the full copyright and license information, please view the LICENSE
|
|
||||||
* file that was distributed with this source code.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Meritoo\Common\Exception\Date;
|
|
||||||
|
|
||||||
use Meritoo\Common\Exception\Base\UnknownTypeException;
|
|
||||||
use Meritoo\Common\Type\DatePartType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An exception used while type of date part, e.g. "year", is unknown
|
|
||||||
*
|
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
|
||||||
* @copyright Meritoo.pl
|
|
||||||
*/
|
|
||||||
class UnknownDatePartTypeException extends UnknownTypeException
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Class constructor
|
|
||||||
*
|
|
||||||
* @param string $unknownDatePart Type of date part, e.g. "year". One of DatePartType class constants.
|
|
||||||
* @param string $value Incorrect value
|
|
||||||
*/
|
|
||||||
public function __construct($unknownDatePart, $value)
|
|
||||||
{
|
|
||||||
parent::__construct($unknownDatePart, new DatePartType(), sprintf('date part (with value %s)', $value));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -11,21 +11,22 @@ namespace Meritoo\Common\Exception\File;
|
|||||||
/**
|
/**
|
||||||
* An exception used while file with given path is empty (has no content)
|
* An exception used while file with given path is empty (has no content)
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class EmptyFileException extends \Exception
|
class EmptyFileException extends \Exception
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Creates exception
|
||||||
*
|
*
|
||||||
* @param string $emptyFilePath Path of the empty file
|
* @param string $emptyFilePath Path of the empty file
|
||||||
|
* @return EmptyFileException
|
||||||
*/
|
*/
|
||||||
public function __construct($emptyFilePath)
|
public static function create($emptyFilePath)
|
||||||
{
|
{
|
||||||
$template = 'File with path \'%s\' is empty (has no content). Did you provide path of proper file?';
|
$template = 'File with path \'%s\' is empty (has no content). Did you provide path of proper file?';
|
||||||
$message = sprintf($template, $emptyFilePath);
|
$message = sprintf($template, $emptyFilePath);
|
||||||
|
|
||||||
parent::__construct($message);
|
return new static($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,16 +11,16 @@ namespace Meritoo\Common\Exception\File;
|
|||||||
/**
|
/**
|
||||||
* An exception used while path of given file is empty
|
* An exception used while path of given file is empty
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class EmptyFilePathException extends \Exception
|
class EmptyFilePathException extends \Exception
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Creates exception
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public static function create()
|
||||||
{
|
{
|
||||||
parent::__construct('Path of the file is empty. Did you provide path of proper file?');
|
return new static('Path of the file is empty. Did you provide path of proper file?');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,21 +11,22 @@ namespace Meritoo\Common\Exception\File;
|
|||||||
/**
|
/**
|
||||||
* An exception used while file with given path does not exist
|
* An exception used while file with given path does not exist
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class NotExistingFileException extends \Exception
|
class NotExistingFileException extends \Exception
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Creates exception
|
||||||
*
|
*
|
||||||
* @param string $notExistingFilePath Path of not existing (or not readable) file
|
* @param string $notExistingFilePath Path of not existing (or not readable) file
|
||||||
|
* @return NotExistingFileException
|
||||||
*/
|
*/
|
||||||
public function __construct($notExistingFilePath)
|
public static function create($notExistingFilePath)
|
||||||
{
|
{
|
||||||
$template = 'File with path \'%s\' does not exist (or is not readable). Did you provide path of proper file?';
|
$template = 'File with path \'%s\' does not exist (or is not readable). Did you provide path of proper file?';
|
||||||
$message = sprintf($template, $notExistingFilePath);
|
$message = sprintf($template, $notExistingFilePath);
|
||||||
|
|
||||||
parent::__construct($message);
|
return new static($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,18 +13,19 @@ use Exception;
|
|||||||
/**
|
/**
|
||||||
* An exception used while method cannot be called, because is disabled
|
* An exception used while method cannot be called, because is disabled
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class DisabledMethodException extends Exception
|
class DisabledMethodException extends Exception
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Creates exception
|
||||||
*
|
*
|
||||||
* @param string $disabledMethod Name of the disabled method
|
* @param string $disabledMethod Name of the disabled method
|
||||||
* @param string $alternativeMethod (optional) Name of the alternative method
|
* @param string $alternativeMethod (optional) Name of the alternative method
|
||||||
|
* @return DisabledMethodException
|
||||||
*/
|
*/
|
||||||
public function __construct($disabledMethod, $alternativeMethod = '')
|
public static function create($disabledMethod, $alternativeMethod = '')
|
||||||
{
|
{
|
||||||
$template = 'Method %s() cannot be called, because is disabled.';
|
$template = 'Method %s() cannot be called, because is disabled.';
|
||||||
|
|
||||||
@@ -33,6 +34,7 @@ class DisabledMethodException extends Exception
|
|||||||
}
|
}
|
||||||
|
|
||||||
$message = sprintf($template, $disabledMethod, $alternativeMethod);
|
$message = sprintf($template, $disabledMethod, $alternativeMethod);
|
||||||
parent::__construct($message);
|
|
||||||
|
return new static($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,20 +13,21 @@ use Exception;
|
|||||||
/**
|
/**
|
||||||
* An exception used while name of class or trait cannot be resolved
|
* An exception used while name of class or trait cannot be resolved
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class CannotResolveClassNameException extends Exception
|
class CannotResolveClassNameException extends Exception
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Creates exception
|
||||||
*
|
*
|
||||||
* @param array|object|string $source Source of the class's / trait's name. It can be an array of objects,
|
* @param array|object|string $source Source of the class's / trait's name. It can be an array of objects,
|
||||||
* namespaces, object or namespace.
|
* namespaces, object or namespace.
|
||||||
* @param bool $forClass (optional) If is set to true, message of this exception for class is
|
* @param bool $forClass (optional) If is set to true, message of this exception for class is
|
||||||
* prepared. Otherwise - for trait.
|
* prepared. Otherwise - for trait.
|
||||||
|
* @return CannotResolveClassNameException
|
||||||
*/
|
*/
|
||||||
public function __construct($source, $forClass = true)
|
public static function create($source, $forClass = true)
|
||||||
{
|
{
|
||||||
$forWho = 'trait';
|
$forWho = 'trait';
|
||||||
$value = '';
|
$value = '';
|
||||||
@@ -42,6 +43,6 @@ class CannotResolveClassNameException extends Exception
|
|||||||
$template = 'Name of %s from given \'%s\'%s cannot be resolved. Is there everything ok?';
|
$template = 'Name of %s from given \'%s\'%s cannot be resolved. Is there everything ok?';
|
||||||
$message = sprintf($template, $forWho, gettype($source), $value);
|
$message = sprintf($template, $forWho, gettype($source), $value);
|
||||||
|
|
||||||
parent::__construct($message);
|
return new static($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,18 +14,19 @@ use Meritoo\Common\Utilities\Reflection;
|
|||||||
/**
|
/**
|
||||||
* An exception used while given class has no child classes
|
* An exception used while given class has no child classes
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class MissingChildClassesException extends Exception
|
class MissingChildClassesException extends Exception
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Creates exception
|
||||||
*
|
*
|
||||||
* @param array|object|string $parentClass Class that hasn't child classes, but it should. An array of objects,
|
* @param array|object|string $parentClass Class that hasn't child classes, but it should. An array of objects,
|
||||||
* strings, object or string.
|
* strings, object or string.
|
||||||
|
* @return MissingChildClassesException
|
||||||
*/
|
*/
|
||||||
public function __construct($parentClass)
|
public static function create($parentClass)
|
||||||
{
|
{
|
||||||
$template = 'The \'%s\' class requires one child class at least who will extend her (maybe is an abstract'
|
$template = 'The \'%s\' class requires one child class at least who will extend her (maybe is an abstract'
|
||||||
. ' class), but the child classes are missing. Did you forget to extend this class?';
|
. ' class), but the child classes are missing. Did you forget to extend this class?';
|
||||||
@@ -33,6 +34,6 @@ class MissingChildClassesException extends Exception
|
|||||||
$parentClassName = Reflection::getClassName($parentClass);
|
$parentClassName = Reflection::getClassName($parentClass);
|
||||||
$message = sprintf($template, $parentClassName);
|
$message = sprintf($template, $parentClassName);
|
||||||
|
|
||||||
parent::__construct($message);
|
return new static($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,19 +14,20 @@ use Meritoo\Common\Utilities\Reflection;
|
|||||||
/**
|
/**
|
||||||
* An exception used while given class has more than one child class
|
* An exception used while given class has more than one child class
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class TooManyChildClassesException extends Exception
|
class TooManyChildClassesException extends Exception
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Creates exception
|
||||||
*
|
*
|
||||||
* @param array|object|string $parentClass Class that has more than one child class, but it shouldn't. An array
|
* @param array|object|string $parentClass Class that has more than one child class, but it shouldn't. An array
|
||||||
* of objects, strings, object or string.
|
* of objects, strings, object or string.
|
||||||
* @param array $childClasses Child classes
|
* @param array $childClasses Child classes
|
||||||
|
* @return TooManyChildClassesException
|
||||||
*/
|
*/
|
||||||
public function __construct($parentClass, array $childClasses)
|
public static function create($parentClass, array $childClasses)
|
||||||
{
|
{
|
||||||
$template = "The '%s' class requires one child class at most who will extend her, but more than one child"
|
$template = "The '%s' class requires one child class at most who will extend her, but more than one child"
|
||||||
. " class was found:\n- %s\n\nWhy did you create more than one classes that extend '%s' class?";
|
. " class was found:\n- %s\n\nWhy did you create more than one classes that extend '%s' class?";
|
||||||
@@ -34,6 +35,6 @@ class TooManyChildClassesException extends Exception
|
|||||||
$parentClassName = Reflection::getClassName($parentClass);
|
$parentClassName = Reflection::getClassName($parentClass);
|
||||||
$message = sprintf($template, $parentClassName, implode("\n- ", $childClasses), $parentClassName);
|
$message = sprintf($template, $parentClassName, implode("\n- ", $childClasses), $parentClassName);
|
||||||
|
|
||||||
parent::__construct($message);
|
return new static($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,22 +11,24 @@ namespace Meritoo\Common\Exception\Regex;
|
|||||||
/**
|
/**
|
||||||
* An exception used while length of given hexadecimal value of color is incorrect
|
* An exception used while length of given hexadecimal value of color is incorrect
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class IncorrectColorHexLengthException extends \Exception
|
class IncorrectColorHexLengthException extends \Exception
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Creates exception
|
||||||
*
|
*
|
||||||
* @param string $color Incorrect hexadecimal value of color
|
* @param string $color Incorrect hexadecimal value of color
|
||||||
|
* @return IncorrectColorHexLengthException
|
||||||
*/
|
*/
|
||||||
public function __construct($color)
|
public static function create($color)
|
||||||
{
|
{
|
||||||
$template = 'Length of hexadecimal value of color \'%s\' is incorrect. It\'s %d, but it should be 3 or 6.'
|
$template = 'Length of hexadecimal value of color \'%s\' is incorrect. It\'s %d, but it should be 3 or 6.'
|
||||||
. ' Is there everything ok?';
|
. ' Is there everything ok?';
|
||||||
|
|
||||||
$message = sprintf($template, $color, strlen($color));
|
$message = sprintf($template, $color, strlen($color));
|
||||||
parent::__construct($message);
|
|
||||||
|
return new static($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,19 +11,21 @@ namespace Meritoo\Common\Exception\Regex;
|
|||||||
/**
|
/**
|
||||||
* An exception used while given hexadecimal value of color is invalid
|
* An exception used while given hexadecimal value of color is invalid
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class InvalidColorHexValueException extends \Exception
|
class InvalidColorHexValueException extends \Exception
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Creates exception
|
||||||
*
|
*
|
||||||
* @param string $color Invalid hexadecimal value of color
|
* @param string $color Invalid hexadecimal value of color
|
||||||
|
* @return InvalidColorHexValueException
|
||||||
*/
|
*/
|
||||||
public function __construct($color)
|
public static function create($color)
|
||||||
{
|
{
|
||||||
$message = sprintf('Hexadecimal value of color \'%s\' is invalid. Is there everything ok?', $color);
|
$message = sprintf('Hexadecimal value of color \'%s\' is invalid. Is there everything ok?', $color);
|
||||||
parent::__construct($message);
|
|
||||||
|
return new static($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,19 +11,21 @@ namespace Meritoo\Common\Exception\Regex;
|
|||||||
/**
|
/**
|
||||||
* An exception used while html attributes are invalid
|
* An exception used while html attributes are invalid
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class InvalidHtmlAttributesException extends \Exception
|
class InvalidHtmlAttributesException extends \Exception
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Creates exception
|
||||||
*
|
*
|
||||||
* @param string $htmlAttributes Invalid html attributes
|
* @param string $htmlAttributes Invalid html attributes
|
||||||
|
* @return InvalidHtmlAttributesException
|
||||||
*/
|
*/
|
||||||
public function __construct($htmlAttributes)
|
public static function create($htmlAttributes)
|
||||||
{
|
{
|
||||||
$message = sprintf('HTML attributes \'%s\' are invalid. Is there everything ok?', $htmlAttributes);
|
$message = sprintf('HTML attributes \'%s\' are invalid. Is there everything ok?', $htmlAttributes);
|
||||||
parent::__construct($message);
|
|
||||||
|
return new static($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,31 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (c) Meritoo.pl, http://www.meritoo.pl
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Meritoo\Common\Exception\Regex;
|
namespace Meritoo\Common\Exception\Regex;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An exception used while url is invalid
|
* An exception used while url is invalid
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class InvalidUrlException extends \Exception
|
class InvalidUrlException extends \Exception
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Creates exception
|
||||||
*
|
*
|
||||||
* @param string $url Invalid url
|
* @param string $url Invalid url
|
||||||
|
* @return InvalidUrlException
|
||||||
*/
|
*/
|
||||||
public function __construct($url)
|
public static function create($url)
|
||||||
{
|
{
|
||||||
$message = sprintf('Url \'%s\' is invalid. Is there everything ok?', $url);
|
$message = sprintf('Url \'%s\' is invalid. Is there everything ok?', $url);
|
||||||
parent::__construct($message);
|
|
||||||
|
return new static($message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
36
src/Exception/Type/UnknownDatePartTypeException.php
Normal file
36
src/Exception/Type/UnknownDatePartTypeException.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (c) Meritoo.pl, http://www.meritoo.pl
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Meritoo\Common\Exception\Type;
|
||||||
|
|
||||||
|
use Meritoo\Common\Exception\Base\UnknownTypeException;
|
||||||
|
use Meritoo\Common\Type\DatePartType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An exception used while type of date part, e.g. "year", is unknown
|
||||||
|
*
|
||||||
|
* @author Meritoo <github@meritoo.pl>
|
||||||
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
|
*/
|
||||||
|
class UnknownDatePartTypeException extends UnknownTypeException
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Creates exception
|
||||||
|
*
|
||||||
|
* @param string $unknownDatePart Unknown type of date part
|
||||||
|
* @param string $value Incorrect value
|
||||||
|
* @return UnknownDatePartTypeException
|
||||||
|
*/
|
||||||
|
public static function createException($unknownDatePart, $value)
|
||||||
|
{
|
||||||
|
/* @var UnknownDatePartTypeException $exception */
|
||||||
|
$exception = parent::create($unknownDatePart, new DatePartType(), sprintf('date part (with value %s)', $value));
|
||||||
|
|
||||||
|
return $exception;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (c) Meritoo.pl, http://www.meritoo.pl
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
namespace Meritoo\Common\Exception\Type;
|
namespace Meritoo\Common\Exception\Type;
|
||||||
|
|
||||||
use Meritoo\Common\Exception\Base\UnknownTypeException;
|
use Meritoo\Common\Exception\Base\UnknownTypeException;
|
||||||
@@ -8,16 +14,22 @@ use Meritoo\Common\Type\OopVisibilityType;
|
|||||||
/**
|
/**
|
||||||
* An exception used while the visibility of a property, a method or (as of PHP 7.1.0) a constant is unknown
|
* An exception used while the visibility of a property, a method or (as of PHP 7.1.0) a constant is unknown
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class UnknownOopVisibilityTypeException extends UnknownTypeException
|
class UnknownOopVisibilityTypeException extends UnknownTypeException
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* Creates exception
|
||||||
|
*
|
||||||
|
* @param string $unknownType Unknown visibility of a property, a method or (as of PHP 7.1.0) a constant
|
||||||
|
* @return UnknownOopVisibilityTypeException
|
||||||
*/
|
*/
|
||||||
public function __construct($unknownType)
|
public static function createException($unknownType)
|
||||||
{
|
{
|
||||||
parent::__construct($unknownType, new OopVisibilityType(), 'OOP-related visibility');
|
/* @var UnknownOopVisibilityTypeException $exception */
|
||||||
|
$exception = parent::create($unknownType, new OopVisibilityType(), 'OOP-related visibility');
|
||||||
|
|
||||||
|
return $exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ use PHPUnit\Framework\TestCase;
|
|||||||
/**
|
/**
|
||||||
* Base test case with common methods and data providers
|
* Base test case with common methods and data providers
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
abstract class BaseTestCase extends TestCase
|
abstract class BaseTestCase extends TestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ use Meritoo\Common\Traits\Test\Base\BaseTypeTestCaseTrait;
|
|||||||
/**
|
/**
|
||||||
* Base test case for the type of something
|
* Base test case for the type of something
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
abstract class BaseTypeTestCase extends BaseTestCase
|
abstract class BaseTypeTestCase extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ use stdClass;
|
|||||||
* BaseTestCaseTrait
|
* BaseTestCaseTrait
|
||||||
* Created on 2017-11-02
|
* Created on 2017-11-02
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
trait BaseTestCaseTrait
|
trait BaseTestCaseTrait
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ use Meritoo\Common\Type\Base\BaseType;
|
|||||||
/**
|
/**
|
||||||
* Trait for the base test case for the type of something
|
* Trait for the base test case for the type of something
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
trait BaseTypeTestCaseTrait
|
trait BaseTypeTestCaseTrait
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ use Meritoo\Common\Utilities\Reflection;
|
|||||||
* Base / abstract type of something, e.g. type of button, order, date etc.
|
* Base / abstract type of something, e.g. type of button, order, date etc.
|
||||||
* Child class should contain constants - each of them represent one type.
|
* Child class should contain constants - each of them represent one type.
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
abstract class BaseType
|
abstract class BaseType
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ use Meritoo\Common\Type\Base\BaseType;
|
|||||||
/**
|
/**
|
||||||
* Type of date part, e.g. "year"
|
* Type of date part, e.g. "year"
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class DatePartType extends BaseType
|
class DatePartType extends BaseType
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ use Meritoo\Common\Utilities\Date;
|
|||||||
* A date's period.
|
* A date's period.
|
||||||
* Contains start and end date of the period.
|
* Contains start and end date of the period.
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class DatePeriod extends BaseType
|
class DatePeriod extends BaseType
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ use Meritoo\Common\Type\Base\BaseType;
|
|||||||
/**
|
/**
|
||||||
* The visibility of a property, a method or (as of PHP 7.1.0) a constant
|
* The visibility of a property, a method or (as of PHP 7.1.0) a constant
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*
|
*
|
||||||
* @see http://php.net/manual/en/language.oop5.visibility.php
|
* @see http://php.net/manual/en/language.oop5.visibility.php
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ namespace Meritoo\Common\Utilities;
|
|||||||
/**
|
/**
|
||||||
* Useful arrays methods
|
* Useful arrays methods
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class Arrays
|
class Arrays
|
||||||
{
|
{
|
||||||
@@ -673,7 +673,7 @@ class Arrays
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$effect = $array;
|
$effect = &$array;
|
||||||
ksort($effect, $sortFlags);
|
ksort($effect, $sortFlags);
|
||||||
|
|
||||||
foreach ($effect as &$value) {
|
foreach ($effect as &$value) {
|
||||||
@@ -822,60 +822,66 @@ class Arrays
|
|||||||
*/
|
*/
|
||||||
public static function getLastElementsPaths(array $array, $separator = '.', $parentPath = '', $stopIfMatchedBy = '')
|
public static function getLastElementsPaths(array $array, $separator = '.', $parentPath = '', $stopIfMatchedBy = '')
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* No elements?
|
||||||
|
* Nothing to do
|
||||||
|
*/
|
||||||
|
if (empty($array)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($stopIfMatchedBy)) {
|
||||||
|
$stopIfMatchedBy = self::makeArray($stopIfMatchedBy);
|
||||||
|
}
|
||||||
|
|
||||||
$paths = [];
|
$paths = [];
|
||||||
|
|
||||||
if (!empty($array)) {
|
foreach ($array as $key => $value) {
|
||||||
if (!empty($stopIfMatchedBy)) {
|
$path = $key;
|
||||||
$stopIfMatchedBy = self::makeArray($stopIfMatchedBy);
|
$stopRecursion = false;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the path of parent element is delivered,
|
||||||
|
* I have to use it and build longer path
|
||||||
|
*/
|
||||||
|
if (!empty($parentPath)) {
|
||||||
|
$pathTemplate = '%s%s%s';
|
||||||
|
$path = sprintf($pathTemplate, $parentPath, $separator, $key);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($array as $key => $value) {
|
/*
|
||||||
$path = $key;
|
* Check if the key or current path matches one of patterns at which the process should be stopped,
|
||||||
$stopRecursion = false;
|
* the recursive not used. It means that I have to pass current value and stop processing of the
|
||||||
|
* array (don't go to the next step).
|
||||||
|
*/
|
||||||
|
if (!empty($stopIfMatchedBy)) {
|
||||||
|
foreach ($stopIfMatchedBy as $rawPattern) {
|
||||||
|
$pattern = sprintf('|%s|', $rawPattern);
|
||||||
|
|
||||||
/*
|
if (preg_match($pattern, $key) || preg_match($pattern, $path)) {
|
||||||
* If the path of parent element is delivered,
|
$stopRecursion = true;
|
||||||
* I have to use it and build longer path
|
break;
|
||||||
*/
|
|
||||||
if (!empty($parentPath)) {
|
|
||||||
$pathTemplate = '%s%s%s';
|
|
||||||
$path = sprintf($pathTemplate, $parentPath, $separator, $key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Check if the key or current path matches one of patterns at which the process should be stopped,
|
|
||||||
* the recursive not used. It means that I have to pass current value and stop processing of the
|
|
||||||
* array (don't go to the next step).
|
|
||||||
*/
|
|
||||||
if (!empty($stopIfMatchedBy)) {
|
|
||||||
foreach ($stopIfMatchedBy as $rawPattern) {
|
|
||||||
$pattern = sprintf('|%s|', $rawPattern);
|
|
||||||
|
|
||||||
if (preg_match($pattern, $key) || preg_match($pattern, $path)) {
|
|
||||||
$stopRecursion = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The value is passed to the returned array if:
|
* The value is passed to the returned array if:
|
||||||
* - it's not an array
|
* - it's not an array
|
||||||
* or
|
* or
|
||||||
* - the process is stopped, recursive is not used
|
* - the process is stopped, recursive is not used
|
||||||
*/
|
*/
|
||||||
if (!is_array($value) || (is_array($value) && empty($value)) || $stopRecursion) {
|
if (!is_array($value) || (is_array($value) && empty($value)) || $stopRecursion) {
|
||||||
$paths[$path] = $value;
|
$paths[$path] = $value;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Let's iterate through the next level, using recursive
|
* Let's iterate through the next level, using recursive
|
||||||
*/
|
*/
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
$recursivePaths = self::getLastElementsPaths($value, $separator, $path, $stopIfMatchedBy);
|
$recursivePaths = self::getLastElementsPaths($value, $separator, $path, $stopIfMatchedBy);
|
||||||
$paths += $recursivePaths;
|
$paths += $recursivePaths;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ use Meritoo\Common\Exception\Bundle\IncorrectBundleNameException;
|
|||||||
/**
|
/**
|
||||||
* Useful methods for bundle
|
* Useful methods for bundle
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class Bundle
|
class Bundle
|
||||||
{
|
{
|
||||||
@@ -41,7 +41,7 @@ class Bundle
|
|||||||
* Given name of bundle is invalid?
|
* Given name of bundle is invalid?
|
||||||
*/
|
*/
|
||||||
if (!Regex::isValidBundleName($bundleName)) {
|
if (!Regex::isValidBundleName($bundleName)) {
|
||||||
throw new IncorrectBundleNameException($bundleName);
|
throw IncorrectBundleNameException::create($bundleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ use stdClass;
|
|||||||
/**
|
/**
|
||||||
* Useful Composer-related methods (only static functions)
|
* Useful Composer-related methods (only static functions)
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class Composer
|
class Composer
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,15 +11,15 @@ namespace Meritoo\Common\Utilities;
|
|||||||
use DateInterval;
|
use DateInterval;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Meritoo\Common\Exception\Date\UnknownDatePartTypeException;
|
use Meritoo\Common\Exception\Type\UnknownDatePartTypeException;
|
||||||
use Meritoo\Common\Type\DatePartType;
|
use Meritoo\Common\Type\DatePartType;
|
||||||
use Meritoo\Common\Type\DatePeriod;
|
use Meritoo\Common\Type\DatePeriod;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Useful date methods
|
* Useful date methods
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class Date
|
class Date
|
||||||
{
|
{
|
||||||
@@ -255,21 +255,21 @@ class Date
|
|||||||
* Oops, incorrect year
|
* Oops, incorrect year
|
||||||
*/
|
*/
|
||||||
if ($year <= 0) {
|
if ($year <= 0) {
|
||||||
throw new UnknownDatePartTypeException(DatePartType::YEAR, $year);
|
throw UnknownDatePartTypeException::createException(DatePartType::YEAR, $year);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Oops, incorrect month
|
* Oops, incorrect month
|
||||||
*/
|
*/
|
||||||
if ($month < 1 || $month > 12) {
|
if ($month < 1 || $month > 12) {
|
||||||
throw new UnknownDatePartTypeException(DatePartType::MONTH, $month);
|
throw UnknownDatePartTypeException::createException(DatePartType::MONTH, $month);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Oops, incorrect day
|
* Oops, incorrect day
|
||||||
*/
|
*/
|
||||||
if ($day < 1 || $day > 31) {
|
if ($day < 1 || $day > 31) {
|
||||||
throw new UnknownDatePartTypeException(DatePartType::DAY, $day);
|
throw UnknownDatePartTypeException::createException(DatePartType::DAY, $day);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($month < 3) {
|
if ($month < 3) {
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ use Generator;
|
|||||||
/**
|
/**
|
||||||
* Useful methods for the Generator class (only static functions)
|
* Useful methods for the Generator class (only static functions)
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class GeneratorUtility
|
class GeneratorUtility
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ namespace Meritoo\Common\Utilities;
|
|||||||
/**
|
/**
|
||||||
* Useful locale methods
|
* Useful locale methods
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class Locale
|
class Locale
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ namespace Meritoo\Common\Utilities;
|
|||||||
/**
|
/**
|
||||||
* Useful methods for mime types of files
|
* Useful methods for mime types of files
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class MimeTypes
|
class MimeTypes
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ use Transliterator;
|
|||||||
/**
|
/**
|
||||||
* Miscellaneous methods (only static functions)
|
* Miscellaneous methods (only static functions)
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class Miscellaneous
|
class Miscellaneous
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ use Doctrine\ORM\QueryBuilder;
|
|||||||
/**
|
/**
|
||||||
* Useful methods for query builder (the Doctrine's QueryBuilder class)
|
* Useful methods for query builder (the Doctrine's QueryBuilder class)
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class QueryBuilderUtility
|
class QueryBuilderUtility
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ use ReflectionProperty;
|
|||||||
/**
|
/**
|
||||||
* Useful reflection methods
|
* Useful reflection methods
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class Reflection
|
class Reflection
|
||||||
{
|
{
|
||||||
@@ -206,7 +206,7 @@ class Reflection
|
|||||||
* while using "project.name" as property - $project has $name property ($project exists in the Deal class)
|
* while using "project.name" as property - $project has $name property ($project exists in the Deal class)
|
||||||
* and the $project equals null
|
* and the $project equals null
|
||||||
*
|
*
|
||||||
* Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* Meritoo <github@meritoo.pl>
|
||||||
* 2016-11-07
|
* 2016-11-07
|
||||||
*/
|
*/
|
||||||
if (null !== $object) {
|
if (null !== $object) {
|
||||||
@@ -524,7 +524,7 @@ class Reflection
|
|||||||
* Oops, cannot resolve class
|
* Oops, cannot resolve class
|
||||||
*/
|
*/
|
||||||
if (null === $className) {
|
if (null === $className) {
|
||||||
throw new CannotResolveClassNameException($class);
|
throw CannotResolveClassNameException::create($class);
|
||||||
}
|
}
|
||||||
|
|
||||||
$childClasses = [];
|
$childClasses = [];
|
||||||
@@ -558,7 +558,6 @@ class Reflection
|
|||||||
*
|
*
|
||||||
* @param array|object|string $parentClass Class who child class should be returned. An array of objects,
|
* @param array|object|string $parentClass Class who child class should be returned. An array of objects,
|
||||||
* namespaces, object or namespace.
|
* namespaces, object or namespace.
|
||||||
* @throws CannotResolveClassNameException
|
|
||||||
* @throws MissingChildClassesException
|
* @throws MissingChildClassesException
|
||||||
* @throws TooManyChildClassesException
|
* @throws TooManyChildClassesException
|
||||||
* @return mixed
|
* @return mixed
|
||||||
@@ -572,7 +571,7 @@ class Reflection
|
|||||||
* Oops, the base / parent class hasn't child class
|
* Oops, the base / parent class hasn't child class
|
||||||
*/
|
*/
|
||||||
if (empty($childClasses)) {
|
if (empty($childClasses)) {
|
||||||
throw new MissingChildClassesException($parentClass);
|
throw MissingChildClassesException::create($parentClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -580,7 +579,7 @@ class Reflection
|
|||||||
* Oops, the base / parent class has too many child classes
|
* Oops, the base / parent class has too many child classes
|
||||||
*/
|
*/
|
||||||
if (count($childClasses) > 1) {
|
if (count($childClasses) > 1) {
|
||||||
throw new TooManyChildClassesException($parentClass, $childClasses);
|
throw TooManyChildClassesException::create($parentClass, $childClasses);
|
||||||
}
|
}
|
||||||
|
|
||||||
return trim($childClasses[0]);
|
return trim($childClasses[0]);
|
||||||
@@ -621,7 +620,6 @@ class Reflection
|
|||||||
* @param bool $verifyParents If is set to true, parent classes are verified if they use given
|
* @param bool $verifyParents If is set to true, parent classes are verified if they use given
|
||||||
* trait. Otherwise - not.
|
* trait. Otherwise - not.
|
||||||
* @throws CannotResolveClassNameException
|
* @throws CannotResolveClassNameException
|
||||||
* @throws ReflectionException
|
|
||||||
* @return bool|null
|
* @return bool|null
|
||||||
*/
|
*/
|
||||||
public static function usesTrait($class, $trait, $verifyParents = false)
|
public static function usesTrait($class, $trait, $verifyParents = false)
|
||||||
@@ -633,7 +631,7 @@ class Reflection
|
|||||||
* Oops, cannot resolve class
|
* Oops, cannot resolve class
|
||||||
*/
|
*/
|
||||||
if (empty($className)) {
|
if (empty($className)) {
|
||||||
throw new CannotResolveClassNameException($class);
|
throw CannotResolveClassNameException::create($class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ use Meritoo\Common\Exception\Regex\InvalidColorHexValueException;
|
|||||||
/**
|
/**
|
||||||
* Useful regular expressions methods
|
* Useful regular expressions methods
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class Regex
|
class Regex
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ use Doctrine\ORM\QueryBuilder;
|
|||||||
/**
|
/**
|
||||||
* Useful methods for repository
|
* Useful methods for repository
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class Repository
|
class Repository
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ namespace Meritoo\Common\Utilities;
|
|||||||
/**
|
/**
|
||||||
* Useful uri methods (only static functions)
|
* Useful uri methods (only static functions)
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class Uri
|
class Uri
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ use SimpleXMLElement;
|
|||||||
/**
|
/**
|
||||||
* Useful XML-related methods (only static functions)
|
* Useful XML-related methods (only static functions)
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class Xml
|
class Xml
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ use Meritoo\Common\Type\OopVisibilityType;
|
|||||||
/**
|
/**
|
||||||
* Test case of the collection of elements
|
* Test case of the collection of elements
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class CollectionTest extends BaseTestCase
|
class CollectionTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ use Meritoo\Common\Type\OopVisibilityType;
|
|||||||
/**
|
/**
|
||||||
* Test case of the exception used while type of something is unknown
|
* Test case of the exception used while type of something is unknown
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class UnknownTypeExceptionTest extends BaseTestCase
|
class UnknownTypeExceptionTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testConstructorVisibilityAndArguments()
|
public function testConstructorVisibilityAndArguments()
|
||||||
{
|
{
|
||||||
static::assertConstructorVisibilityAndArguments(UnknownTestTypeException::class, OopVisibilityType::IS_PUBLIC, 1, 1);
|
static::assertConstructorVisibilityAndArguments(UnknownTestTypeException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWithoutException()
|
public function testWithoutException()
|
||||||
@@ -41,8 +41,8 @@ class UnknownTypeExceptionTest extends BaseTestCase
|
|||||||
/**
|
/**
|
||||||
* Type of something (for testing purposes)
|
* Type of something (for testing purposes)
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class TestType extends BaseType
|
class TestType extends BaseType
|
||||||
{
|
{
|
||||||
@@ -54,27 +54,31 @@ class TestType extends BaseType
|
|||||||
/**
|
/**
|
||||||
* An exception used while type of something is unknown (for testing purposes)
|
* An exception used while type of something is unknown (for testing purposes)
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class UnknownTestTypeException extends UnknownTypeException
|
class UnknownTestTypeException extends UnknownTypeException
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Class constructor
|
* Creates exception
|
||||||
*
|
*
|
||||||
* @param int|string $unknownType The unknown type of something (for testing purposes)
|
* @param string $unknownType The unknown type of something (for testing purposes)
|
||||||
|
* @return UnknownTestTypeException
|
||||||
*/
|
*/
|
||||||
public function __construct($unknownType)
|
public static function createException($unknownType)
|
||||||
{
|
{
|
||||||
parent::__construct($unknownType, new TestType(), 'type of something used for testing');
|
/* @var UnknownTestTypeException $exception */
|
||||||
|
$exception = parent::create($unknownType, new TestType(), 'type of something used for testing');
|
||||||
|
|
||||||
|
return $exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service used together with type of something (for testing purposes)
|
* Service used together with type of something (for testing purposes)
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class TestService
|
class TestService
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
namespace Meritoo\Common\Test\Exception\Date;
|
namespace Meritoo\Common\Test\Exception\Date;
|
||||||
|
|
||||||
use Generator;
|
use Generator;
|
||||||
use Meritoo\Common\Exception\Date\UnknownDatePartTypeException;
|
use Meritoo\Common\Exception\Type\UnknownDatePartTypeException;
|
||||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||||
use Meritoo\Common\Type\DatePartType;
|
use Meritoo\Common\Type\DatePartType;
|
||||||
use Meritoo\Common\Type\OopVisibilityType;
|
use Meritoo\Common\Type\OopVisibilityType;
|
||||||
@@ -17,14 +17,14 @@ use Meritoo\Common\Type\OopVisibilityType;
|
|||||||
/**
|
/**
|
||||||
* Test case of an exception used while type of date part, e.g. "year", is unknown
|
* Test case of an exception used while type of date part, e.g. "year", is unknown
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class UnknownDatePartTypeExceptionTest extends BaseTestCase
|
class UnknownDatePartTypeExceptionTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testConstructorVisibilityAndArguments()
|
public function testConstructorVisibilityAndArguments()
|
||||||
{
|
{
|
||||||
static::assertConstructorVisibilityAndArguments(UnknownDatePartTypeException::class, OopVisibilityType::IS_PUBLIC, 2, 2);
|
static::assertConstructorVisibilityAndArguments(UnknownDatePartTypeException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,9 +34,9 @@ class UnknownDatePartTypeExceptionTest extends BaseTestCase
|
|||||||
*
|
*
|
||||||
* @dataProvider provideDatePartAndValue
|
* @dataProvider provideDatePartAndValue
|
||||||
*/
|
*/
|
||||||
public function testConstructorMessage($unknownDatePart, $value, $expectedMessage)
|
public function testMessage($unknownDatePart, $value, $expectedMessage)
|
||||||
{
|
{
|
||||||
$exception = new UnknownDatePartTypeException($unknownDatePart, $value);
|
$exception = UnknownDatePartTypeException::createException($unknownDatePart, $value);
|
||||||
static::assertEquals($expectedMessage, $exception->getMessage());
|
static::assertEquals($expectedMessage, $exception->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ use Meritoo\Common\Type\OopVisibilityType;
|
|||||||
/**
|
/**
|
||||||
* Test case of an exception used while file with given path is empty (has no content)
|
* Test case of an exception used while file with given path is empty (has no content)
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class EmptyFileExceptionTest extends BaseTestCase
|
class EmptyFileExceptionTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testConstructorVisibilityAndArguments()
|
public function testConstructorVisibilityAndArguments()
|
||||||
{
|
{
|
||||||
static::assertConstructorVisibilityAndArguments(EmptyFileException::class, OopVisibilityType::IS_PUBLIC, 1, 1);
|
static::assertConstructorVisibilityAndArguments(EmptyFileException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,9 +32,9 @@ class EmptyFileExceptionTest extends BaseTestCase
|
|||||||
*
|
*
|
||||||
* @dataProvider providePathOfFile
|
* @dataProvider providePathOfFile
|
||||||
*/
|
*/
|
||||||
public function testConstructorMessage($emptyFilePath, $expectedMessage)
|
public function testMessage($emptyFilePath, $expectedMessage)
|
||||||
{
|
{
|
||||||
$exception = new EmptyFileException($emptyFilePath);
|
$exception = EmptyFileException::create($emptyFilePath);
|
||||||
static::assertEquals($expectedMessage, $exception->getMessage());
|
static::assertEquals($expectedMessage, $exception->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,19 +15,19 @@ use Meritoo\Common\Type\OopVisibilityType;
|
|||||||
/**
|
/**
|
||||||
* Test case of an exception used while path of given file is empty
|
* Test case of an exception used while path of given file is empty
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class EmptyFilePathExceptionTest extends BaseTestCase
|
class EmptyFilePathExceptionTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testConstructorVisibilityAndArguments()
|
public function testConstructorVisibilityAndArguments()
|
||||||
{
|
{
|
||||||
static::assertConstructorVisibilityAndArguments(EmptyFilePathException::class, OopVisibilityType::IS_PUBLIC);
|
static::assertConstructorVisibilityAndArguments(EmptyFilePathException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testConstructorMessage()
|
public function testConstructorMessage()
|
||||||
{
|
{
|
||||||
$exception = new EmptyFilePathException();
|
$exception = EmptyFilePathException::create();
|
||||||
static::assertEquals('Path of the file is empty. Did you provide path of proper file?', $exception->getMessage());
|
static::assertEquals('Path of the file is empty. Did you provide path of proper file?', $exception->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ use Meritoo\Common\Type\OopVisibilityType;
|
|||||||
/**
|
/**
|
||||||
* Test case of an exception used while file with given path does not exist
|
* Test case of an exception used while file with given path does not exist
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class NotExistingFileExceptionTest extends BaseTestCase
|
class NotExistingFileExceptionTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testConstructorVisibilityAndArguments()
|
public function testConstructorVisibilityAndArguments()
|
||||||
{
|
{
|
||||||
static::assertConstructorVisibilityAndArguments(NotExistingFileException::class, OopVisibilityType::IS_PUBLIC, 1, 1);
|
static::assertConstructorVisibilityAndArguments(NotExistingFileException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,7 +34,7 @@ class NotExistingFileExceptionTest extends BaseTestCase
|
|||||||
*/
|
*/
|
||||||
public function testConstructorMessage($notExistingFilePath, $expectedMessage)
|
public function testConstructorMessage($notExistingFilePath, $expectedMessage)
|
||||||
{
|
{
|
||||||
$exception = new NotExistingFileException($notExistingFilePath);
|
$exception = NotExistingFileException::create($notExistingFilePath);
|
||||||
static::assertEquals($expectedMessage, $exception->getMessage());
|
static::assertEquals($expectedMessage, $exception->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ use Meritoo\Common\Type\OopVisibilityType;
|
|||||||
/**
|
/**
|
||||||
* Test case of an exception used while method cannot be called, because is disabled
|
* Test case of an exception used while method cannot be called, because is disabled
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class DisabledMethodExceptionTest extends BaseTestCase
|
class DisabledMethodExceptionTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testConstructorVisibilityAndArguments()
|
public function testConstructorVisibilityAndArguments()
|
||||||
{
|
{
|
||||||
static::assertConstructorVisibilityAndArguments(DisabledMethodException::class, OopVisibilityType::IS_PUBLIC, 2, 1);
|
static::assertConstructorVisibilityAndArguments(DisabledMethodException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,7 +36,7 @@ class DisabledMethodExceptionTest extends BaseTestCase
|
|||||||
*/
|
*/
|
||||||
public function testConstructorMessage($disabledMethod, $alternativeMethod, $expectedMessage)
|
public function testConstructorMessage($disabledMethod, $alternativeMethod, $expectedMessage)
|
||||||
{
|
{
|
||||||
$exception = new DisabledMethodException($disabledMethod, $alternativeMethod);
|
$exception = DisabledMethodException::create($disabledMethod, $alternativeMethod);
|
||||||
static::assertEquals($expectedMessage, $exception->getMessage());
|
static::assertEquals($expectedMessage, $exception->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ use Meritoo\Common\Type\OopVisibilityType;
|
|||||||
/**
|
/**
|
||||||
* Test case of an exception used while name of class or trait cannot be resolved
|
* Test case of an exception used while name of class or trait cannot be resolved
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class CannotResolveClassNameExceptionTest extends BaseTestCase
|
class CannotResolveClassNameExceptionTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testConstructorVisibilityAndArguments()
|
public function testConstructorVisibilityAndArguments()
|
||||||
{
|
{
|
||||||
static::assertConstructorVisibilityAndArguments(CannotResolveClassNameException::class, OopVisibilityType::IS_PUBLIC, 2, 1);
|
static::assertConstructorVisibilityAndArguments(CannotResolveClassNameException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,7 +37,7 @@ class CannotResolveClassNameExceptionTest extends BaseTestCase
|
|||||||
*/
|
*/
|
||||||
public function testConstructorMessage($source, $forClass, $expectedMessage)
|
public function testConstructorMessage($source, $forClass, $expectedMessage)
|
||||||
{
|
{
|
||||||
$exception = new CannotResolveClassNameException($source, $forClass);
|
$exception = CannotResolveClassNameException::create($source, $forClass);
|
||||||
static::assertEquals($expectedMessage, $exception->getMessage());
|
static::assertEquals($expectedMessage, $exception->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ use Meritoo\Common\Type\OopVisibilityType;
|
|||||||
/**
|
/**
|
||||||
* Test case of an exception used while given class has no child classes
|
* Test case of an exception used while given class has no child classes
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class MissingChildClassesExceptionTest extends BaseTestCase
|
class MissingChildClassesExceptionTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testConstructorVisibilityAndArguments()
|
public function testConstructorVisibilityAndArguments()
|
||||||
{
|
{
|
||||||
static::assertConstructorVisibilityAndArguments(MissingChildClassesException::class, OopVisibilityType::IS_PUBLIC, 1, 1);
|
static::assertConstructorVisibilityAndArguments(MissingChildClassesException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,7 +35,7 @@ class MissingChildClassesExceptionTest extends BaseTestCase
|
|||||||
*/
|
*/
|
||||||
public function testConstructorMessage($parentClass, $expectedMessage)
|
public function testConstructorMessage($parentClass, $expectedMessage)
|
||||||
{
|
{
|
||||||
$exception = new MissingChildClassesException($parentClass);
|
$exception = MissingChildClassesException::create($parentClass);
|
||||||
static::assertEquals($expectedMessage, $exception->getMessage());
|
static::assertEquals($expectedMessage, $exception->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ use Meritoo\Common\Type\OopVisibilityType;
|
|||||||
/**
|
/**
|
||||||
* Test case of an exception used while given class has more than one child class
|
* Test case of an exception used while given class has more than one child class
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class TooManyChildClassesExceptionTest extends BaseTestCase
|
class TooManyChildClassesExceptionTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testConstructorVisibilityAndArguments()
|
public function testConstructorVisibilityAndArguments()
|
||||||
{
|
{
|
||||||
static::assertConstructorVisibilityAndArguments(TooManyChildClassesException::class, OopVisibilityType::IS_PUBLIC, 2, 2);
|
static::assertConstructorVisibilityAndArguments(TooManyChildClassesException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,7 +36,7 @@ class TooManyChildClassesExceptionTest extends BaseTestCase
|
|||||||
*/
|
*/
|
||||||
public function testConstructorMessage($parentClass, array $childClasses, $expectedMessage)
|
public function testConstructorMessage($parentClass, array $childClasses, $expectedMessage)
|
||||||
{
|
{
|
||||||
$exception = new TooManyChildClassesException($parentClass, $childClasses);
|
$exception = TooManyChildClassesException::create($parentClass, $childClasses);
|
||||||
static::assertEquals($expectedMessage, $exception->getMessage());
|
static::assertEquals($expectedMessage, $exception->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ use Meritoo\Common\Type\OopVisibilityType;
|
|||||||
/**
|
/**
|
||||||
* Test case of an exception used while length of given hexadecimal value of color is incorrect
|
* Test case of an exception used while length of given hexadecimal value of color is incorrect
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class IncorrectColorHexLengthExceptionTest extends BaseTestCase
|
class IncorrectColorHexLengthExceptionTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testConstructorVisibilityAndArguments()
|
public function testConstructorVisibilityAndArguments()
|
||||||
{
|
{
|
||||||
static::assertConstructorVisibilityAndArguments(IncorrectColorHexLengthException::class, OopVisibilityType::IS_PUBLIC, 1, 1);
|
static::assertConstructorVisibilityAndArguments(IncorrectColorHexLengthException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,7 +34,7 @@ class IncorrectColorHexLengthExceptionTest extends BaseTestCase
|
|||||||
*/
|
*/
|
||||||
public function testConstructorMessage($color, $expectedMessage)
|
public function testConstructorMessage($color, $expectedMessage)
|
||||||
{
|
{
|
||||||
$exception = new IncorrectColorHexLengthException($color);
|
$exception = IncorrectColorHexLengthException::create($color);
|
||||||
static::assertEquals($expectedMessage, $exception->getMessage());
|
static::assertEquals($expectedMessage, $exception->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,24 +10,20 @@ namespace Meritoo\Common\Test\Exception\Regex;
|
|||||||
|
|
||||||
use Generator;
|
use Generator;
|
||||||
use Meritoo\Common\Exception\Regex\InvalidColorHexValueException;
|
use Meritoo\Common\Exception\Regex\InvalidColorHexValueException;
|
||||||
use Meritoo\Common\Exception\Type\UnknownOopVisibilityTypeException;
|
|
||||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||||
use Meritoo\Common\Type\OopVisibilityType;
|
use Meritoo\Common\Type\OopVisibilityType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test case of an exception used while given hexadecimal value of color is invalid
|
* Test case of an exception used while given hexadecimal value of color is invalid
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class InvalidColorHexValueExceptionTest extends BaseTestCase
|
class InvalidColorHexValueExceptionTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @throws UnknownOopVisibilityTypeException
|
|
||||||
*/
|
|
||||||
public function testConstructorVisibilityAndArguments()
|
public function testConstructorVisibilityAndArguments()
|
||||||
{
|
{
|
||||||
static::assertConstructorVisibilityAndArguments(InvalidColorHexValueException::class, OopVisibilityType::IS_PUBLIC, 1, 1);
|
static::assertConstructorVisibilityAndArguments(InvalidColorHexValueException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,7 +34,7 @@ class InvalidColorHexValueExceptionTest extends BaseTestCase
|
|||||||
*/
|
*/
|
||||||
public function testConstructorMessage($color, $expectedMessage)
|
public function testConstructorMessage($color, $expectedMessage)
|
||||||
{
|
{
|
||||||
$exception = new InvalidColorHexValueException($color);
|
$exception = InvalidColorHexValueException::create($color);
|
||||||
static::assertEquals($expectedMessage, $exception->getMessage());
|
static::assertEquals($expectedMessage, $exception->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,24 +10,20 @@ namespace Meritoo\Common\Test\Exception\Regex;
|
|||||||
|
|
||||||
use Generator;
|
use Generator;
|
||||||
use Meritoo\Common\Exception\Regex\InvalidHtmlAttributesException;
|
use Meritoo\Common\Exception\Regex\InvalidHtmlAttributesException;
|
||||||
use Meritoo\Common\Exception\Type\UnknownOopVisibilityTypeException;
|
|
||||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||||
use Meritoo\Common\Type\OopVisibilityType;
|
use Meritoo\Common\Type\OopVisibilityType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test case of an exception used while html attributes are invalid
|
* Test case of an exception used while html attributes are invalid
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class InvalidHtmlAttributesExceptionTest extends BaseTestCase
|
class InvalidHtmlAttributesExceptionTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @throws UnknownOopVisibilityTypeException
|
|
||||||
*/
|
|
||||||
public function testConstructorVisibilityAndArguments()
|
public function testConstructorVisibilityAndArguments()
|
||||||
{
|
{
|
||||||
static::assertConstructorVisibilityAndArguments(InvalidHtmlAttributesException::class, OopVisibilityType::IS_PUBLIC, 1, 1);
|
static::assertConstructorVisibilityAndArguments(InvalidHtmlAttributesException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,7 +34,7 @@ class InvalidHtmlAttributesExceptionTest extends BaseTestCase
|
|||||||
*/
|
*/
|
||||||
public function testConstructorMessage($htmlAttributes, $expectedMessage)
|
public function testConstructorMessage($htmlAttributes, $expectedMessage)
|
||||||
{
|
{
|
||||||
$exception = new InvalidHtmlAttributesException($htmlAttributes);
|
$exception = InvalidHtmlAttributesException::create($htmlAttributes);
|
||||||
static::assertEquals($expectedMessage, $exception->getMessage());
|
static::assertEquals($expectedMessage, $exception->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ use Meritoo\Common\Type\OopVisibilityType;
|
|||||||
/**
|
/**
|
||||||
* Test case of an exception used while url is invalid
|
* Test case of an exception used while url is invalid
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class InvalidUrlExceptionTest extends BaseTestCase
|
class InvalidUrlExceptionTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testConstructorVisibilityAndArguments()
|
public function testConstructorVisibilityAndArguments()
|
||||||
{
|
{
|
||||||
static::assertConstructorVisibilityAndArguments(InvalidUrlException::class, OopVisibilityType::IS_PUBLIC, 1, 1);
|
static::assertConstructorVisibilityAndArguments(InvalidUrlException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,7 +34,7 @@ class InvalidUrlExceptionTest extends BaseTestCase
|
|||||||
*/
|
*/
|
||||||
public function testConstructorMessage($url, $expectedMessage)
|
public function testConstructorMessage($url, $expectedMessage)
|
||||||
{
|
{
|
||||||
$exception = new InvalidUrlException($url);
|
$exception = InvalidUrlException::create($url);
|
||||||
static::assertEquals($expectedMessage, $exception->getMessage());
|
static::assertEquals($expectedMessage, $exception->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,14 +17,14 @@ use Meritoo\Common\Type\OopVisibilityType;
|
|||||||
* Test case of an exception used while the visibility of a property, a method or (as of PHP 7.1.0) a constant is
|
* Test case of an exception used while the visibility of a property, a method or (as of PHP 7.1.0) a constant is
|
||||||
* unknown
|
* unknown
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class UnknownOopVisibilityTypeExceptionTest extends BaseTestCase
|
class UnknownOopVisibilityTypeExceptionTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
public function testConstructorVisibilityAndArguments()
|
public function testConstructorVisibilityAndArguments()
|
||||||
{
|
{
|
||||||
static::assertConstructorVisibilityAndArguments(UnknownOopVisibilityTypeException::class, OopVisibilityType::IS_PUBLIC, 1, 1);
|
static::assertConstructorVisibilityAndArguments(UnknownOopVisibilityTypeException::class, OopVisibilityType::IS_PUBLIC, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,7 +35,7 @@ class UnknownOopVisibilityTypeExceptionTest extends BaseTestCase
|
|||||||
*/
|
*/
|
||||||
public function testConstructorMessage($unknownType, $expectedMessage)
|
public function testConstructorMessage($unknownType, $expectedMessage)
|
||||||
{
|
{
|
||||||
$exception = new UnknownOopVisibilityTypeException($unknownType);
|
$exception = UnknownOopVisibilityTypeException::createException($unknownType);
|
||||||
static::assertEquals($expectedMessage, $exception->getMessage());
|
static::assertEquals($expectedMessage, $exception->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ use Meritoo\Common\Utilities\GeneratorUtility;
|
|||||||
/**
|
/**
|
||||||
* Test case of the base test case with common methods and data providers
|
* Test case of the base test case with common methods and data providers
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class BaseTestCaseTest extends BaseTestCase
|
class BaseTestCaseTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
@@ -168,8 +168,8 @@ class BaseTestCaseTest extends BaseTestCase
|
|||||||
/**
|
/**
|
||||||
* Simple test case
|
* Simple test case
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class SimpleTestCase extends BaseTestCase
|
class SimpleTestCase extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ use Meritoo\Common\Type\Base\BaseType;
|
|||||||
/**
|
/**
|
||||||
* Test case of the base / abstract type of something
|
* Test case of the base / abstract type of something
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class BaseTypeTest extends BaseTestCase
|
class BaseTypeTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
@@ -184,8 +184,8 @@ class BaseTypeTest extends BaseTestCase
|
|||||||
/**
|
/**
|
||||||
* Empty type of something used for testing
|
* Empty type of something used for testing
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class TestEmptyType extends BaseType
|
class TestEmptyType extends BaseType
|
||||||
{
|
{
|
||||||
@@ -194,8 +194,8 @@ class TestEmptyType extends BaseType
|
|||||||
/**
|
/**
|
||||||
* Type of something used for testing
|
* Type of something used for testing
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class TestType extends BaseType
|
class TestType extends BaseType
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ use Meritoo\Common\Type\DatePartType;
|
|||||||
/**
|
/**
|
||||||
* Test case of the type of date part, e.g. "year"
|
* Test case of the type of date part, e.g. "year"
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class DatePartTypeTest extends BaseTypeTestCase
|
class DatePartTypeTest extends BaseTypeTestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ use Meritoo\Common\Type\OopVisibilityType;
|
|||||||
/**
|
/**
|
||||||
* Test case of date's period
|
* Test case of date's period
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class DatePeriodTest extends BaseTypeTestCase
|
class DatePeriodTest extends BaseTypeTestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ use Meritoo\Common\Utilities\Arrays;
|
|||||||
/**
|
/**
|
||||||
* Test case of the useful arrays methods
|
* Test case of the useful arrays methods
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class ArraysTest extends BaseTestCase
|
class ArraysTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ use Meritoo\Common\Utilities\Bundle;
|
|||||||
/**
|
/**
|
||||||
* Test case of the useful methods for bundle
|
* Test case of the useful methods for bundle
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class BundleTest extends BaseTestCase
|
class BundleTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
@@ -42,7 +42,6 @@ class BundleTest extends BaseTestCase
|
|||||||
* @param string $viewPath Path of the view / template, e.g. "MyDirectory/my-template"
|
* @param string $viewPath Path of the view / template, e.g. "MyDirectory/my-template"
|
||||||
* @param string $bundleName Full name of the bundle, e.g. "MyExtraBundle"
|
* @param string $bundleName Full name of the bundle, e.g. "MyExtraBundle"
|
||||||
*
|
*
|
||||||
* @throws IncorrectBundleNameException
|
|
||||||
* @dataProvider provideViewPathAndIncorrectBundleName
|
* @dataProvider provideViewPathAndIncorrectBundleName
|
||||||
*/
|
*/
|
||||||
public function testGetBundleViewPathUsingIncorrectBundleName($viewPath, $bundleName)
|
public function testGetBundleViewPathUsingIncorrectBundleName($viewPath, $bundleName)
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ use Meritoo\Common\Utilities\Composer;
|
|||||||
/**
|
/**
|
||||||
* Test case of the useful Composer-related methods
|
* Test case of the useful Composer-related methods
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class ComposerTest extends BaseTestCase
|
class ComposerTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace Meritoo\Common\Test\Utilities;
|
|||||||
use DateInterval;
|
use DateInterval;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Generator;
|
use Generator;
|
||||||
use Meritoo\Common\Exception\Date\UnknownDatePartTypeException;
|
use Meritoo\Common\Exception\Type\UnknownDatePartTypeException;
|
||||||
use Meritoo\Common\Test\Base\BaseTestCase;
|
use Meritoo\Common\Test\Base\BaseTestCase;
|
||||||
use Meritoo\Common\Type\DatePeriod;
|
use Meritoo\Common\Type\DatePeriod;
|
||||||
use Meritoo\Common\Utilities\Date;
|
use Meritoo\Common\Utilities\Date;
|
||||||
@@ -19,8 +19,8 @@ use Meritoo\Common\Utilities\Date;
|
|||||||
/**
|
/**
|
||||||
* Test case of the Date methods (only static functions)
|
* Test case of the Date methods (only static functions)
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class DateTest extends BaseTestCase
|
class DateTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ use Meritoo\Common\Utilities\GeneratorUtility;
|
|||||||
/**
|
/**
|
||||||
* Test case of the useful methods for the Generator class
|
* Test case of the useful methods for the Generator class
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class GeneratorUtilityTest extends BaseTestCase
|
class GeneratorUtilityTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ use ReflectionException;
|
|||||||
/**
|
/**
|
||||||
* Test case of the useful locale methods
|
* Test case of the useful locale methods
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class LocaleTest extends BaseTestCase
|
class LocaleTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ use Meritoo\Common\Utilities\MimeTypes;
|
|||||||
/**
|
/**
|
||||||
* Test case of the useful methods for mime types of files
|
* Test case of the useful methods for mime types of files
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class MimeTypesTest extends BaseTestCase
|
class MimeTypesTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ use stdClass;
|
|||||||
/**
|
/**
|
||||||
* Test case of the Miscellaneous methods (only static functions)
|
* Test case of the Miscellaneous methods (only static functions)
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class MiscellaneousTest extends BaseTestCase
|
class MiscellaneousTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ use Meritoo\Common\Utilities\QueryBuilderUtility;
|
|||||||
/**
|
/**
|
||||||
* Test case of the useful methods for query builder (the Doctrine's QueryBuilder class)
|
* Test case of the useful methods for query builder (the Doctrine's QueryBuilder class)
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class QueryBuilderUtilityTest extends BaseTestCase
|
class QueryBuilderUtilityTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ namespace Meritoo\Common\Test\Utilities\Reflection;
|
|||||||
* The A class.
|
* The A class.
|
||||||
* Used for testing the Reflection class.
|
* Used for testing the Reflection class.
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class A
|
class A
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ namespace Meritoo\Common\Test\Utilities\Reflection;
|
|||||||
* The B class.
|
* The B class.
|
||||||
* Used for testing the Reflection class.
|
* Used for testing the Reflection class.
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class B extends A implements I
|
class B extends A implements I
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ namespace Meritoo\Common\Test\Utilities\Reflection;
|
|||||||
* The C class.
|
* The C class.
|
||||||
* Used for testing the Reflection class.
|
* Used for testing the Reflection class.
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class C extends B
|
class C extends B
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ namespace Meritoo\Common\Test\Utilities\Reflection;
|
|||||||
* The D class.
|
* The D class.
|
||||||
* Used for testing the Reflection class.
|
* Used for testing the Reflection class.
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class D
|
class D
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ namespace Meritoo\Common\Test\Utilities\Reflection;
|
|||||||
* The E trait.
|
* The E trait.
|
||||||
* Used for testing the Reflection class.
|
* Used for testing the Reflection class.
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
trait E
|
trait E
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ namespace Meritoo\Common\Test\Utilities\Reflection;
|
|||||||
* The F class.
|
* The F class.
|
||||||
* Used for testing the Reflection class.
|
* Used for testing the Reflection class.
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class F
|
class F
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ namespace Meritoo\Common\Test\Utilities\Reflection;
|
|||||||
* The G class.
|
* The G class.
|
||||||
* Used for testing the Reflection class.
|
* Used for testing the Reflection class.
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class G
|
class G
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ namespace Meritoo\Common\Test\Utilities\Reflection;
|
|||||||
* The H class.
|
* The H class.
|
||||||
* Used for testing the Reflection class.
|
* Used for testing the Reflection class.
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class H
|
class H
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ namespace Meritoo\Common\Test\Utilities\Reflection;
|
|||||||
* The H interface.
|
* The H interface.
|
||||||
* Used for testing the Reflection class.
|
* Used for testing the Reflection class.
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
interface I
|
interface I
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ use ReflectionProperty;
|
|||||||
/**
|
/**
|
||||||
* Test case of the useful reflection methods
|
* Test case of the useful reflection methods
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class ReflectionTest extends BaseTestCase
|
class ReflectionTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ use ReflectionException;
|
|||||||
/**
|
/**
|
||||||
* Test case of the useful regular expressions methods
|
* Test case of the useful regular expressions methods
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class RegexTest extends BaseTestCase
|
class RegexTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ namespace Meritoo\Common\Test\Utilities\Repository;
|
|||||||
* Sortable object/entity.
|
* Sortable object/entity.
|
||||||
* Used for testing the Repository class.
|
* Used for testing the Repository class.
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class Sortable
|
class Sortable
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ use stdClass;
|
|||||||
/**
|
/**
|
||||||
* Test case of the useful methods for repository
|
* Test case of the useful methods for repository
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class RepositoryTest extends BaseTestCase
|
class RepositoryTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ use Meritoo\Common\Utilities\Uri;
|
|||||||
/**
|
/**
|
||||||
* Test case of the useful uri methods (only static functions)
|
* Test case of the useful uri methods (only static functions)
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class UriTest extends BaseTestCase
|
class UriTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ use SimpleXMLElement;
|
|||||||
/**
|
/**
|
||||||
* Test case of the useful XML-related methods (only static functions)
|
* Test case of the useful XML-related methods (only static functions)
|
||||||
*
|
*
|
||||||
* @author Krzysztof Niziol <krzysztof.niziol@meritoo.pl>
|
* @author Meritoo <github@meritoo.pl>
|
||||||
* @copyright Meritoo.pl
|
* @copyright Meritoo <http://www.meritoo.pl>
|
||||||
*/
|
*/
|
||||||
class XmlTest extends BaseTestCase
|
class XmlTest extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user