CarbonConverter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 22
ccs 4
cts 4
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fromDto() 0 3 1
A toDto() 0 3 1
1
<?php
2
3
namespace Cerbero\LaravelDto\Manipulators;
4
5
use Carbon\Carbon;
6
use Cerbero\Dto\Manipulators\ValueConverter;
7
8
/**
9
 * The date time converter.
10
 *
11
 */
12
class CarbonConverter implements ValueConverter
13
{
14
    /**
15
     * Convert the given value to be exported from a DTO.
16
     *
17
     * @param mixed $value
18
     * @return mixed
19
     */
20 1
    public function fromDto($value)
21
    {
22 1
        return $value->toAtomString();
23
    }
24
25
    /**
26
     * Convert the given value to be imported into a DTO.
27
     *
28
     * @param mixed $value
29
     * @return mixed
30
     */
31 4
    public function toDto($value)
32
    {
33 4
        return Carbon::parse($value);
34
    }
35
}
36