mirror of
https://github.com/wiosna-dev/common-library.git
synced 2026-03-12 09:31:51 +01:00
Documentation > Value Objects
This commit is contained in:
@@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
Common and useful classes, methods, exceptions etc.
|
Common and useful classes, methods, exceptions etc.
|
||||||
|
|
||||||
|
# 0.1.2
|
||||||
|
|
||||||
|
1. Documentation > Value Objects
|
||||||
|
|
||||||
# 0.1.1
|
# 0.1.1
|
||||||
|
|
||||||
1. TravisCI > run using PHP 7.2 too
|
1. TravisCI > run using PHP 7.2 too
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ composer require meritoo/common-library
|
|||||||
2. [Collection of elements](docs/Collection-of-elements.md)
|
2. [Collection of elements](docs/Collection-of-elements.md)
|
||||||
3. [Exceptions](docs/Static-methods.md)
|
3. [Exceptions](docs/Static-methods.md)
|
||||||
4. [Static methods](docs/Static-methods.md)
|
4. [Static methods](docs/Static-methods.md)
|
||||||
|
5. [Value Objects](docs/Value-Objects.md)
|
||||||
|
|
||||||
# Development
|
# Development
|
||||||
|
|
||||||
|
|||||||
@@ -48,5 +48,6 @@ class MimeTypesTest extends BaseTestCase
|
|||||||
2. [Collection of elements](Collection-of-elements.md)
|
2. [Collection of elements](Collection-of-elements.md)
|
||||||
3. [Exceptions](Exceptions.md)
|
3. [Exceptions](Exceptions.md)
|
||||||
4. [Static methods](Static-methods.md)
|
4. [Static methods](Static-methods.md)
|
||||||
|
5. [Value Objects](Value-Objects.md)
|
||||||
|
|
||||||
[‹ Back to `Readme`](../README.md)
|
[‹ Back to `Readme`](../README.md)
|
||||||
|
|||||||
@@ -46,5 +46,6 @@ var_dump($simpleCollection->has('dolor')); // bool(true)
|
|||||||
2. [**Collection of elements**](Collection-of-elements.md)
|
2. [**Collection of elements**](Collection-of-elements.md)
|
||||||
3. [Exceptions](Exceptions.md)
|
3. [Exceptions](Exceptions.md)
|
||||||
4. [Static methods](Static-methods.md)
|
4. [Static methods](Static-methods.md)
|
||||||
|
5. [Value Objects](Value-Objects.md)
|
||||||
|
|
||||||
[‹ Back to `Readme`](../README.md)
|
[‹ Back to `Readme`](../README.md)
|
||||||
|
|||||||
@@ -57,5 +57,6 @@ class UnknownSimpleTypeException extends UnknownTypeException
|
|||||||
2. [Collection of elements](Collection-of-elements.md)
|
2. [Collection of elements](Collection-of-elements.md)
|
||||||
3. [**Exceptions**](Exceptions.md)
|
3. [**Exceptions**](Exceptions.md)
|
||||||
4. [Static methods](Static-methods.md)
|
4. [Static methods](Static-methods.md)
|
||||||
|
5. [Value Objects](Value-Objects.md)
|
||||||
|
|
||||||
[‹ Back to `Readme`](../README.md)
|
[‹ Back to `Readme`](../README.md)
|
||||||
|
|||||||
@@ -19,5 +19,6 @@ var_dump($firstElement); // string(5) "lorem"
|
|||||||
2. [Collection of elements](Collection-of-elements.md)
|
2. [Collection of elements](Collection-of-elements.md)
|
||||||
3. [Exceptions](Exceptions.md)
|
3. [Exceptions](Exceptions.md)
|
||||||
4. [**Static methods**](Static-methods.md)
|
4. [**Static methods**](Static-methods.md)
|
||||||
|
5. [Value Objects](Value-Objects.md)
|
||||||
|
|
||||||
[‹ Back to `Readme`](../README.md)
|
[‹ Back to `Readme`](../README.md)
|
||||||
|
|||||||
53
docs/Value-Objects.md
Normal file
53
docs/Value-Objects.md
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# Meritoo Common Library
|
||||||
|
|
||||||
|
Common and useful classes, methods, exceptions etc.
|
||||||
|
|
||||||
|
# Value Objects
|
||||||
|
|
||||||
|
Located in `Meritoo\Common\ValueObject` namespace.
|
||||||
|
|
||||||
|
### Version
|
||||||
|
|
||||||
|
##### Namespace
|
||||||
|
|
||||||
|
`Meritoo\Common\ValueObject\Version`
|
||||||
|
|
||||||
|
##### Info
|
||||||
|
|
||||||
|
Represents version of software. Contains 3 properties:
|
||||||
|
1. `$majorPart` - the "major" part of version
|
||||||
|
2. `$minorPart` - the "minor" part of version
|
||||||
|
3. `$patchPart` - the "patch" part of version
|
||||||
|
|
||||||
|
##### New instance
|
||||||
|
|
||||||
|
New instance can be created using:
|
||||||
|
|
||||||
|
1. Constructor:
|
||||||
|
|
||||||
|
```php
|
||||||
|
new Version(1, 0, 2);
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Static methods:
|
||||||
|
1. `fromArray()` - creates new instance using given version as array
|
||||||
|
|
||||||
|
```php
|
||||||
|
Version::fromArray([1, 0, 2]);
|
||||||
|
```
|
||||||
|
|
||||||
|
2. `fromString()` - creates new instance using given version as string:
|
||||||
|
|
||||||
|
```php
|
||||||
|
Version::fromString('1.0.2');
|
||||||
|
```
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
5. [**Value Objects**](Value-Objects.md)
|
||||||
|
|
||||||
|
[‹ Back to `Readme`](../README.md)
|
||||||
Reference in New Issue
Block a user