mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 09:31:51 +01:00
Reformat code automatically
This commit is contained in:
@@ -10,7 +10,7 @@ Located here: `Meritoo\Common\Test\Base\BaseTestCase`.
|
||||
|
||||
1. Just extend the `BaseTestCase` class or implement `Meritoo\Common\Traits\Test\Base\BaseTestCaseTrait` trait.
|
||||
2. Use one of available data providers, e.g. `@dataProvider provideEmptyValue`, or asserts,
|
||||
e.g. `static::assertMethodVisibility($method, $visibilityType);`
|
||||
e.g. `static::assertMethodVisibility($method, $visibilityType);`
|
||||
|
||||
##### Examples
|
||||
|
||||
@@ -55,9 +55,9 @@ class MimeTypesTest extends BaseTestCase
|
||||
3. [Templates](Collection/Templates.md)
|
||||
4. [Exceptions](Exceptions.md)
|
||||
5. [Static methods](Static-methods.md)
|
||||
1. [Arrays](Static-methods/Arrays.md)
|
||||
2. [Regex](Static-methods/Regex.md)
|
||||
3. [Uri](Static-methods/Uri.md)
|
||||
1. [Arrays](Static-methods/Arrays.md)
|
||||
2. [Regex](Static-methods/Regex.md)
|
||||
3. [Uri](Static-methods/Uri.md)
|
||||
6. [Value Objects](Value-Objects.md)
|
||||
|
||||
[‹ Back to `Readme`](../README.md)
|
||||
|
||||
@@ -10,8 +10,9 @@ Common and useful classes, methods, exceptions etc.
|
||||
|
||||
### Info
|
||||
|
||||
It's a set of some elements with the same type, e.g. objects. It's iterable and countable. Provides very useful
|
||||
methods. Some of them:
|
||||
It's a set of some elements with the same type, e.g. objects. It's iterable and countable. Provides very useful methods.
|
||||
Some of them:
|
||||
|
||||
- `getFirst()` - returns the first element in the collection
|
||||
- `getLast()` - returns the last element in the collection
|
||||
- `isEmpty()` - returns information if collection is empty
|
||||
@@ -82,8 +83,8 @@ var_dump($simpleCollection->has('dolor')); // bool(true)
|
||||
3. [Templates](Templates.md)
|
||||
4. [Exceptions](../Exceptions.md)
|
||||
5. [Static methods](../Static-methods.md)
|
||||
1. [Arrays](../Static-methods/Arrays.md)
|
||||
2. [Regex](../Static-methods/Regex.md)
|
||||
1. [Arrays](../Static-methods/Arrays.md)
|
||||
2. [Regex](../Static-methods/Regex.md)
|
||||
6. [Value Objects](../Value-Objects.md)
|
||||
|
||||
[‹ Back to `Readme`](../../README.md)
|
||||
|
||||
@@ -18,25 +18,26 @@ New instance can be created using:
|
||||
|
||||
1. Constructor:
|
||||
|
||||
```php
|
||||
new Templates([
|
||||
'first' => new Template('First name: %first_name%'),
|
||||
'last' => new Template('Last name: %last_name%'),
|
||||
]);
|
||||
```
|
||||
```php
|
||||
new Templates([
|
||||
'first' => new Template('First name: %first_name%'),
|
||||
'last' => new Template('Last name: %last_name%'),
|
||||
]);
|
||||
```
|
||||
|
||||
2. Static method `fromArray(array $templates)` - creates and returns the collection from given array
|
||||
|
||||
```php
|
||||
Templates::fromArray([
|
||||
'first' => 'First name: %first_name%',
|
||||
'last' => 'Last name: %last_name%',
|
||||
]);
|
||||
```
|
||||
```php
|
||||
Templates::fromArray([
|
||||
'first' => 'First name: %first_name%',
|
||||
'last' => 'Last name: %last_name%',
|
||||
]);
|
||||
```
|
||||
|
||||
##### Methods
|
||||
|
||||
Has all methods of parent class `Meritoo\Common\Collection\Collection` + `findTemplate(string $index)` method that finds and returns template with given index.
|
||||
Has all methods of parent class `Meritoo\Common\Collection\Collection` + `findTemplate(string $index)` method that finds
|
||||
and returns template with given index.
|
||||
|
||||
Example of usage:
|
||||
|
||||
@@ -49,7 +50,8 @@ $templates = new Templates([
|
||||
$template = $templates->findTemplate('first'); // new Template('First name: %first_name%')
|
||||
```
|
||||
|
||||
Throws an `Meritoo\Common\Exception\ValueObject\Template\TemplateNotFoundException` exception if template with given index was not found.
|
||||
Throws an `Meritoo\Common\Exception\ValueObject\Template\TemplateNotFoundException` exception if template with given
|
||||
index was not found.
|
||||
|
||||
# More
|
||||
|
||||
@@ -58,8 +60,8 @@ Throws an `Meritoo\Common\Exception\ValueObject\Template\TemplateNotFoundExcepti
|
||||
3. [**Templates**](Templates.md)
|
||||
4. [Exceptions](../Exceptions.md)
|
||||
5. [Static methods](../Static-methods.md)
|
||||
1. [Arrays](../Static-methods/Arrays.md)
|
||||
2. [Regex](../Static-methods/Regex.md)
|
||||
1. [Arrays](../Static-methods/Arrays.md)
|
||||
2. [Regex](../Static-methods/Regex.md)
|
||||
6. [Value Objects](../Value-Objects.md)
|
||||
|
||||
[‹ Back to `Readme`](../../README.md)
|
||||
|
||||
@@ -17,9 +17,9 @@ Development-related information
|
||||
|
||||
2. Rebuild project by running command (installs packages, prepares required directories and runs tests):
|
||||
|
||||
```bash
|
||||
docker-compose exec php phing
|
||||
```
|
||||
```bash
|
||||
docker-compose exec php phing
|
||||
```
|
||||
|
||||
> [What is Docker?](https://www.docker.com/what-docker)
|
||||
|
||||
@@ -128,6 +128,7 @@ root@18f2f0cfaa5d:/var/www/application# XDEBUG_MODE=coverage phing -f phing/test
|
||||
##### Terminal
|
||||
|
||||
Example of output:
|
||||
|
||||
```bash
|
||||
125 mutations were generated:
|
||||
105 mutants were killed
|
||||
|
||||
@@ -6,7 +6,8 @@ Common and useful classes, methods, exceptions etc.
|
||||
|
||||
### 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:
|
||||
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;
|
||||
@@ -17,11 +18,14 @@ throw IncorrectBundleNameException::create('RisusIpsum');
|
||||
|
||||
##### 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.
|
||||
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.
|
||||
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
|
||||
|
||||
@@ -58,9 +62,9 @@ class UnknownSimpleTypeException extends UnknownTypeException
|
||||
3. [Templates](Collection/Templates.md)
|
||||
4. [**Exceptions**](Exceptions.md)
|
||||
5. [Static methods](Static-methods.md)
|
||||
1. [Arrays](Static-methods/Arrays.md)
|
||||
2. [Regex](Static-methods/Regex.md)
|
||||
3. [Uri](Static-methods/Uri.md)
|
||||
1. [Arrays](Static-methods/Arrays.md)
|
||||
2. [Regex](Static-methods/Regex.md)
|
||||
3. [Uri](Static-methods/Uri.md)
|
||||
6. [Value Objects](Value-Objects.md)
|
||||
|
||||
[‹ Back to `Readme`](../README.md)
|
||||
|
||||
@@ -4,7 +4,8 @@ Common and useful classes, methods, exceptions etc.
|
||||
|
||||
# Static methods
|
||||
|
||||
This package contains a lot of class with static methods, so usage is not so complicated. Just run the static method who would you like to use. Example:
|
||||
This package contains a lot of class with static methods, so usage is not so complicated. Just run the static method who
|
||||
would you like to use. Example:
|
||||
|
||||
```php
|
||||
use Meritoo\Common\Utilities\Arrays;
|
||||
@@ -20,9 +21,9 @@ var_dump($firstElement); // string(5) "lorem"
|
||||
3. [Templates](Collection/Templates.md)
|
||||
4. [Exceptions](Exceptions.md)
|
||||
5. [**Static methods**](Static-methods.md)
|
||||
1. [Arrays](Static-methods/Arrays.md)
|
||||
2. [Regex](Static-methods/Regex.md)
|
||||
3. [Uri](Static-methods/Uri.md)
|
||||
1. [Arrays](Static-methods/Arrays.md)
|
||||
2. [Regex](Static-methods/Regex.md)
|
||||
3. [Uri](Static-methods/Uri.md)
|
||||
6. [Value Objects](Value-Objects.md)
|
||||
|
||||
[‹ Back to `Readme`](../README.md)
|
||||
|
||||
@@ -21,16 +21,18 @@ File: `src/Utilities/Arrays.php`
|
||||
|
||||
1)
|
||||
|
||||
- array: `[]` (an empty array)
|
||||
- result: `false`
|
||||
- array: `[]` (an empty array)
|
||||
- result: `false`
|
||||
|
||||
2)
|
||||
- array: `["", -1]`
|
||||
- result: `false`
|
||||
|
||||
- array: `["", -1]`
|
||||
- result: `false`
|
||||
|
||||
3)
|
||||
- array: `["", null, ""]`
|
||||
- result: `true`
|
||||
|
||||
- array: `["", null, ""]`
|
||||
- result: `true`
|
||||
|
||||
### getNonEmptyValues(array $values)
|
||||
|
||||
@@ -44,18 +46,18 @@ File: `src/Utilities/Arrays.php`
|
||||
|
||||
1)
|
||||
|
||||
- values: `[]` (no values)
|
||||
- result: `[]` (an empty array)
|
||||
- values: `[]` (no values)
|
||||
- result: `[]` (an empty array)
|
||||
|
||||
2)
|
||||
|
||||
- values: `[null, ""]` (all empty values)
|
||||
- result: `[]` (an empty array)
|
||||
- values: `[null, ""]` (all empty values)
|
||||
- result: `[]` (an empty array)
|
||||
|
||||
3)
|
||||
|
||||
- values: `["test 1", "", 123, null, 0]`
|
||||
- result: `["test 1", 123, 0]`
|
||||
- values: `["test 1", "", 123, null, 0]`
|
||||
- result: `["test 1", 123, 0]`
|
||||
|
||||
### getNonEmptyValuesAsString(array $values, $separator = ', ')
|
||||
|
||||
@@ -70,27 +72,27 @@ File: `src/Utilities/Arrays.php`
|
||||
|
||||
1)
|
||||
|
||||
- values: `[]` (no values)
|
||||
- separator: default or any other string
|
||||
- result: `""` (an empty string)
|
||||
- values: `[]` (no values)
|
||||
- separator: default or any other string
|
||||
- result: `""` (an empty string)
|
||||
|
||||
2)
|
||||
|
||||
- values: `[null, ""]` (all empty values)
|
||||
- separator: default or any other string
|
||||
- result: `""` (an empty string)
|
||||
- values: `[null, ""]` (all empty values)
|
||||
- separator: default or any other string
|
||||
- result: `""` (an empty string)
|
||||
|
||||
3)
|
||||
|
||||
- values: `["test 1", "", 123, null, 0]`
|
||||
- separator: `", "` (default)
|
||||
- result: `"test 1, 123, 0"`
|
||||
- values: `["test 1", "", 123, null, 0]`
|
||||
- separator: `", "` (default)
|
||||
- result: `"test 1, 123, 0"`
|
||||
|
||||
4)
|
||||
|
||||
- values: `["test 1", "", 123, null, 0]`
|
||||
- separator: `" | "`
|
||||
- result: `"test 1 | 123 | 0"`
|
||||
- values: `["test 1", "", 123, null, 0]`
|
||||
- separator: `" | "`
|
||||
- result: `"test 1 | 123 | 0"`
|
||||
|
||||
# More
|
||||
|
||||
@@ -99,9 +101,9 @@ File: `src/Utilities/Arrays.php`
|
||||
3. [Templates](../Collection/Templates.md)
|
||||
4. [Exceptions](../Exceptions.md)
|
||||
5. [Static methods](../Static-methods.md)
|
||||
1. [**Arrays**](Arrays.md)
|
||||
2. [Regex](Regex.md)
|
||||
3. [Uri](Uri.md)
|
||||
1. [**Arrays**](Arrays.md)
|
||||
2. [Regex](Regex.md)
|
||||
3. [Uri](Uri.md)
|
||||
6. [Value Objects](../Value-Objects.md)
|
||||
|
||||
[‹ Back to `Readme`](../../README.md)
|
||||
|
||||
@@ -21,18 +21,18 @@ File: `src/Utilities/Regex.php`
|
||||
|
||||
1)
|
||||
|
||||
- value: non-scalar or `null`
|
||||
- result: `false`
|
||||
- value: non-scalar or `null`
|
||||
- result: `false`
|
||||
|
||||
2)
|
||||
|
||||
- value: `""` (an empty string)
|
||||
- result: `""` (an empty string)
|
||||
- value: `""` (an empty string)
|
||||
- result: `""` (an empty string)
|
||||
|
||||
3)
|
||||
|
||||
- value: `"Lorem ipsum. Dolor sit 12.34 amet."`
|
||||
- result: `"lorem-ipsum-dolor-sit-1234-amet"`
|
||||
- value: `"Lorem ipsum. Dolor sit 12.34 amet."`
|
||||
- result: `"lorem-ipsum-dolor-sit-1234-amet"`
|
||||
|
||||
### clearBeginningSlash(string): string
|
||||
|
||||
@@ -46,18 +46,18 @@ File: `src/Utilities/Regex.php`
|
||||
|
||||
1)
|
||||
|
||||
- string: `"lorem ipsum"`
|
||||
- result: `"lorem ipsum"`
|
||||
- string: `"lorem ipsum"`
|
||||
- result: `"lorem ipsum"`
|
||||
|
||||
2)
|
||||
|
||||
- string: `"/lorem ipsum"`
|
||||
- result: `"lorem ipsum"`
|
||||
- string: `"/lorem ipsum"`
|
||||
- result: `"lorem ipsum"`
|
||||
|
||||
3)
|
||||
|
||||
- string: `"/ lorem 123 ipsum"`
|
||||
- result: `" lorem 123 ipsum"`
|
||||
- string: `"/ lorem 123 ipsum"`
|
||||
- result: `" lorem 123 ipsum"`
|
||||
|
||||
### clearEndingSlash(string): string
|
||||
|
||||
@@ -71,18 +71,18 @@ File: `src/Utilities/Regex.php`
|
||||
|
||||
1)
|
||||
|
||||
- string: `"lorem ipsum"`
|
||||
- result: `"lorem ipsum"`
|
||||
- string: `"lorem ipsum"`
|
||||
- result: `"lorem ipsum"`
|
||||
|
||||
2)
|
||||
|
||||
- string: `"lorem ipsum/"`
|
||||
- result: `"lorem ipsum"`
|
||||
- string: `"lorem ipsum/"`
|
||||
- result: `"lorem ipsum"`
|
||||
|
||||
3)
|
||||
|
||||
- string: `"lorem 123 ipsum /"`
|
||||
- result: `"lorem 123 ipsum "`
|
||||
- string: `"lorem 123 ipsum /"`
|
||||
- result: `"lorem 123 ipsum "`
|
||||
|
||||
# More
|
||||
|
||||
@@ -91,9 +91,9 @@ File: `src/Utilities/Regex.php`
|
||||
3. [Templates](../Collection/Templates.md)
|
||||
4. [Exceptions](../Exceptions.md)
|
||||
5. [Static methods](../Static-methods.md)
|
||||
1. [Arrays](../Static-methods/Arrays.md)
|
||||
2. [**Regex**](Regex.md)
|
||||
3. [Uri](Uri.md)
|
||||
1. [Arrays](../Static-methods/Arrays.md)
|
||||
2. [**Regex**](Regex.md)
|
||||
3. [Uri](Uri.md)
|
||||
6. [Value Objects](../Value-Objects.md)
|
||||
|
||||
[‹ Back to `Readme`](../../README.md)
|
||||
|
||||
@@ -22,15 +22,15 @@ File: `src/Utilities/Uri.php`
|
||||
|
||||
1)
|
||||
|
||||
- rootUrl: `"http://my.example"`
|
||||
- urlParts: `""` (an empty string)
|
||||
- result: `"http://my.example"`
|
||||
- rootUrl: `"http://my.example"`
|
||||
- urlParts: `""` (an empty string)
|
||||
- result: `"http://my.example"`
|
||||
|
||||
2)
|
||||
|
||||
- rootUrl: `"http://my.example"`
|
||||
- urlParts: `"/test", "/123"`
|
||||
- result: `"http://my.example/test/123"`
|
||||
- rootUrl: `"http://my.example"`
|
||||
- urlParts: `"/test", "/123"`
|
||||
- result: `"http://my.example/test/123"`
|
||||
|
||||
# More
|
||||
|
||||
@@ -39,9 +39,9 @@ File: `src/Utilities/Uri.php`
|
||||
3. [Templates](../Collection/Templates.md)
|
||||
4. [Exceptions](../Exceptions.md)
|
||||
5. [Static methods](../Static-methods.md)
|
||||
1. [Arrays](Arrays.md)
|
||||
2. [Regex](Regex.md)
|
||||
3. [**Uri**](Uri.md)
|
||||
1. [Arrays](Arrays.md)
|
||||
2. [Regex](Regex.md)
|
||||
3. [**Uri**](Uri.md)
|
||||
6. [Value Objects](../Value-Objects.md)
|
||||
|
||||
[‹ Back to `Readme`](../../README.md)
|
||||
|
||||
@@ -15,6 +15,7 @@ Located in `Meritoo\Common\ValueObject` namespace and in `src/ValueObject/` dire
|
||||
##### Info
|
||||
|
||||
Represents address of company, institution, user etc. Contains properties:
|
||||
|
||||
1. `$street` - the street
|
||||
2. `$buildingNumber` - the number of building
|
||||
3. `$flatNumber` - the number of flat
|
||||
@@ -66,6 +67,7 @@ $asString = (string)$address; // "4th Avenue 10/200, 00123, New York"
|
||||
##### Info
|
||||
|
||||
Represents bank account. Contains properties:
|
||||
|
||||
1. `$bankName` - name of bank
|
||||
2. `$accountNumber` - number of bank's account
|
||||
|
||||
@@ -101,6 +103,7 @@ $asString = (string)$bank; // "Bank of America, 1234567890"
|
||||
##### Info
|
||||
|
||||
Represents a company. Contains properties:
|
||||
|
||||
1. `$name` - name of company
|
||||
2. `$address` - address of company
|
||||
3. `$bankAccount` - bank account of company
|
||||
@@ -145,7 +148,9 @@ $asString = (string)$company; // "Test 1, 4th Avenue 10/200, 00123, New York, Ba
|
||||
|
||||
##### Info
|
||||
|
||||
Represents human. Based on `\Meritoo\Common\Traits\ValueObject\HumanTrait` trait. Contains properties same as `HumanTrait` trait:
|
||||
Represents human. Based on `\Meritoo\Common\Traits\ValueObject\HumanTrait` trait. Contains properties same
|
||||
as `HumanTrait` trait:
|
||||
|
||||
1. `$firstName` - first name
|
||||
2. `$lastName` - last name
|
||||
3. `$email` - email address
|
||||
@@ -186,6 +191,7 @@ $asString2 = (string)$human2; // "John Scott <john@scott.com>"
|
||||
##### Info
|
||||
|
||||
Size, e.g. of image. Contains properties:
|
||||
|
||||
1. `width` - the width
|
||||
2. `height` - the height
|
||||
3. `unit` - unit used when width or height should be returned with unit, default: `"px"`
|
||||
@@ -218,13 +224,15 @@ New instance can be created using static methods:
|
||||
##### Methods
|
||||
|
||||
Has:
|
||||
|
||||
- getters and setters for `width` and `height` properties.
|
||||
- setter for `separator` property
|
||||
- `toString()` and `toArray()` methods that returns size represented as string and array
|
||||
|
||||
##### Conversion to string (using `__toString()` method)
|
||||
|
||||
Instance of `Size` may be represented as string that contains width and height separated by separator (default: `" x "`).
|
||||
Instance of `Size` may be represented as string that contains width and height separated by separator (default: `" x "`)
|
||||
.
|
||||
|
||||
Example:
|
||||
|
||||
@@ -248,6 +256,7 @@ $asString2 = (string)$size; // "200X100"
|
||||
##### Info
|
||||
|
||||
Template with placeholders that may be filled by real data. Contains properties:
|
||||
|
||||
1. `$content` - raw string with placeholders (content of the template)
|
||||
|
||||
##### New instance
|
||||
@@ -258,7 +267,9 @@ New instance can be created using constructor:
|
||||
new Template('First name: %first_name%');
|
||||
```
|
||||
|
||||
Each placeholder should be wrapped by `%` character, e.g. `%first_name%`. If content of template is an empty string or does not contain 1 placeholder at least, an `Meritoo\Common\Exception\ValueObject\Template\InvalidContentException` exception will be thrown.
|
||||
Each placeholder should be wrapped by `%` character, e.g. `%first_name%`. If content of template is an empty string or
|
||||
does not contain 1 placeholder at least, an `Meritoo\Common\Exception\ValueObject\Template\InvalidContentException`
|
||||
exception will be thrown.
|
||||
|
||||
Examples of invalid content of template:
|
||||
|
||||
@@ -270,7 +281,8 @@ new Template('This is %test'); // With starting tag only (invalid placeholder)
|
||||
|
||||
##### Methods
|
||||
|
||||
Has 1 public method: `fill(array $values)`. Returns content of the template filled with given values (by replacing placeholders with their proper values).
|
||||
Has 1 public method: `fill(array $values)`. Returns content of the template filled with given values (by replacing
|
||||
placeholders with their proper values).
|
||||
|
||||
Example of usage:
|
||||
|
||||
@@ -282,7 +294,8 @@ $result = $template->fill([
|
||||
]); // "My name is Jane and I am photographer"
|
||||
```
|
||||
|
||||
Throws an `Meritoo\Common\Exception\ValueObject\Template\NotEnoughValuesException` exception if there is not enough values (iow. more placeholders than values).
|
||||
Throws an `Meritoo\Common\Exception\ValueObject\Template\NotEnoughValuesException` exception if there is not enough
|
||||
values (iow. more placeholders than values).
|
||||
|
||||
### Version
|
||||
|
||||
@@ -293,6 +306,7 @@ Throws an `Meritoo\Common\Exception\ValueObject\Template\NotEnoughValuesExceptio
|
||||
##### Info
|
||||
|
||||
Represents version of software. Contains properties:
|
||||
|
||||
1. `$majorPart` - the "major" part of version
|
||||
2. `$minorPart` - the "minor" part of version
|
||||
3. `$patchPart` - the "patch" part of version
|
||||
@@ -303,22 +317,22 @@ New instance can be created using:
|
||||
|
||||
1. Constructor:
|
||||
|
||||
```php
|
||||
new Version(1, 0, 2);
|
||||
```
|
||||
```php
|
||||
new Version(1, 0, 2);
|
||||
```
|
||||
|
||||
2. Static methods:
|
||||
1. `fromArray(array $version)` - creates new instance using given version as array
|
||||
1. `fromArray(array $version)` - creates new instance using given version as array
|
||||
|
||||
```php
|
||||
Version::fromArray([1, 0, 2]);
|
||||
```
|
||||
```php
|
||||
Version::fromArray([1, 0, 2]);
|
||||
```
|
||||
|
||||
2. `fromString(string $version)` - creates new instance using given version as string:
|
||||
2. `fromString(string $version)` - creates new instance using given version as string:
|
||||
|
||||
```php
|
||||
Version::fromString('1.0.2');
|
||||
```
|
||||
```php
|
||||
Version::fromString('1.0.2');
|
||||
```
|
||||
|
||||
##### Methods
|
||||
|
||||
@@ -326,7 +340,8 @@ Has getters for each property: `getMajorPart()`, `getMinorPart()`, `getPatchPart
|
||||
|
||||
##### Conversion to string (using `__toString()` method)
|
||||
|
||||
Instance of `Version` may be represented as string that contains all properties separated by `.` (`$majorPart`.`$minorPart`.`$patchPart`).
|
||||
Instance of `Version` may be represented as string that contains all properties separated by `.` (`$majorPart`
|
||||
.`$minorPart`.`$patchPart`).
|
||||
|
||||
Example:
|
||||
|
||||
@@ -342,9 +357,9 @@ $asString = (string)$version; // "1.0.2"
|
||||
3. [Templates](Collection/Templates.md)
|
||||
4. [Exceptions](Exceptions.md)
|
||||
5. [Static methods](Static-methods.md)
|
||||
1. [Arrays](Static-methods/Arrays.md)
|
||||
2. [Regex](Static-methods/Regex.md)
|
||||
3. [Uri](Static-methods/Uri.md)
|
||||
1. [Arrays](Static-methods/Arrays.md)
|
||||
2. [Regex](Static-methods/Regex.md)
|
||||
3. [Uri](Static-methods/Uri.md)
|
||||
6. [**Value Objects**](Value-Objects.md)
|
||||
|
||||
[‹ Back to `Readme`](../README.md)
|
||||
|
||||
Reference in New Issue
Block a user