Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
4 / 4 |
DateFragmentedTrait | |
100.00% |
1 / 1 |
|
100.00% |
2 / 2 |
3 | |
100.00% |
4 / 4 |
getDateParts | |
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
|||
withDateParts | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
<?php | |
namespace Popy\Calendar\ValueObject\DateRepresentation; | |
use Popy\Calendar\ValueObject\DateParts; | |
/** | |
* Popy\Calendar\ValueObject\DateFragmentedRepresentationInterface implementation. | |
*/ | |
trait DateFragmentedTrait | |
{ | |
/** | |
* Date parts. | |
* | |
* @var DateParts | |
*/ | |
protected $dateParts; | |
/** | |
* @inheritDoc | |
*/ | |
public function getDateParts() | |
{ | |
return $this->dateParts ?: new DateParts(); | |
} | |
/** | |
* @inheritDoc | |
*/ | |
public function withDateParts(DateParts $dateParts) | |
{ | |
$res = clone $this; | |
$res->dateParts = $dateParts; | |
return $res; | |
} | |
} |