コード例 #1
0
 /**
  * @param \AGmakonts\DddBricks\Service\ServiceInterface $target
  * @param array                                         $params
  */
 public function __construct(ServiceInterface $target, array $params = [])
 {
     $this->target = $target;
     $this->occurrenceTime = DateTime::get();
     $this->identifier = Text::get(Uuid::uuid4()->toString());
     $this->params = $params;
 }
コード例 #2
0
ファイル: DateTimeTest.php プロジェクト: agmakonts/stl
 /**
  * @covers ::getTimestamp()
  */
 public function testGetTimestamp()
 {
     $testClass1 = \AGmakonts\STL\DateTime\DateTime::get(Integer::get(1));
     $this->assertInstanceOf(Integer::class, $testClass1->getTimestamp());
     $this->assertEquals(1, $testClass1->getTimestamp()->value());
 }
コード例 #3
0
 /**
  * @return \AGmakonts\STL\DateTime\DateTime
  */
 public function nextAnniversary() : DateTime
 {
     $nativeDate = new \DateTime($this->date()->getTimestamp()->value());
     $now = new \DateTime();
     $interval = new \DateInterval('P1Y');
     while ($nativeDate->getTimestamp() < $now->getTimestamp()) {
         $nativeDate = $nativeDate->add($interval);
     }
     return DateTime::get(Integer::get($nativeDate->getTimestamp()));
 }
コード例 #4
0
 /**
  * @param \AGmakonts\DddBricks\Entity\EntityInterface $target
  */
 public function __construct(EntityInterface $target)
 {
     $this->target = $target;
     $this->occurrenceTime = DateTime::get();
     $this->identifier = Text::get(Uuid::uuid4()->toString());
 }