Documentation > Value Objects

This commit is contained in:
Meritoo
2018-07-02 21:22:29 +02:00
parent cc30ad8d9e
commit a448d592d2
8 changed files with 63 additions and 1 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -1 +1 @@
0.1.1 0.1.2

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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
View 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)