Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
4 / 4 |
DateTimeTrait | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
4 / 4 |
getTime | |
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
|||
withTime | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
<?php | |
namespace Popy\Calendar\ValueObject\DateRepresentation; | |
use Popy\Calendar\ValueObject\Time; | |
/** | |
* Popy\Calendar\ValueObject\DateTimeRepresentationInterface implementation. | |
*/ | |
trait DateTimeTrait | |
{ | |
/** | |
* Time. | |
* | |
* @var Time | |
*/ | |
protected $time; | |
/** | |
* @inheritDoc | |
*/ | |
public function getTime() | |
{ | |
return $this->time ?: new Time(); | |
} | |
/** | |
* @inheritDoc | |
*/ | |
public function withTime(Time $time) | |
{ | |
$res = clone $this; | |
$res->time = $time; | |
return $res; | |
} | |
} |