-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e4130c
commit a8d9de2
Showing
29 changed files
with
832 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the eluceo/iCal package. | ||
* | ||
* (c) 2020 Markus Poerschke <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Eluceo\iCal\Domain\ValueObject; | ||
|
||
use DateInterval; | ||
use Eluceo\iCal\Domain\ValueObject\Alarm\Action; | ||
use Eluceo\iCal\Domain\ValueObject\Alarm\Trigger; | ||
|
||
class Alarm | ||
{ | ||
private Action $action; | ||
private Trigger $trigger; | ||
|
||
private int $repeatCount = 0; | ||
private ?DateInterval $repeatInterval = null; | ||
|
||
public function __construct(Action $action, Trigger $trigger) | ||
{ | ||
$this->action = $action; | ||
$this->trigger = $trigger; | ||
} | ||
|
||
public function getAction(): Action | ||
{ | ||
return $this->action; | ||
} | ||
|
||
public function getTrigger(): Trigger | ||
{ | ||
return $this->trigger; | ||
} | ||
|
||
public function isRepeated(): bool | ||
{ | ||
return $this->repeatCount > 0; | ||
} | ||
|
||
public function withRepeat(int $repeatCount, DateInterval $repeatInterval): self | ||
{ | ||
$this->repeatCount = $repeatCount; | ||
$this->repeatInterval = $repeatInterval; | ||
|
||
return $this; | ||
} | ||
|
||
public function withoutRepeat(): self | ||
{ | ||
$this->repeatCount = 0; | ||
$this->repeatInterval = null; | ||
|
||
return $this; | ||
} | ||
|
||
public function getRepeatCount(): int | ||
{ | ||
return $this->repeatCount; | ||
} | ||
|
||
public function getRepeatInterval(): DateInterval | ||
{ | ||
assert($this->repeatInterval !== null); | ||
|
||
return $this->repeatInterval; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the eluceo/iCal package. | ||
* | ||
* (c) 2020 Markus Poerschke <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Eluceo\iCal\Domain\ValueObject\Alarm; | ||
|
||
use Eluceo\iCal\Domain\ValueObject\Timestamp; | ||
|
||
final class AbsoluteDateTimeTrigger extends Trigger | ||
{ | ||
private Timestamp $dateTime; | ||
|
||
public function __construct(Timestamp $dateTime) | ||
{ | ||
$this->dateTime = $dateTime; | ||
} | ||
|
||
public function getDateTime(): Timestamp | ||
{ | ||
return $this->dateTime; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the eluceo/iCal package. | ||
* | ||
* (c) 2020 Markus Poerschke <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Eluceo\iCal\Domain\ValueObject\Alarm; | ||
|
||
abstract class Action | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the eluceo/iCal package. | ||
* | ||
* (c) 2020 Markus Poerschke <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Eluceo\iCal\Domain\ValueObject\Alarm; | ||
|
||
final class AudioAction extends Action | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the eluceo/iCal package. | ||
* | ||
* (c) 2020 Markus Poerschke <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Eluceo\iCal\Domain\ValueObject\Alarm; | ||
|
||
final class DisplayAction extends Action | ||
{ | ||
private string $description; | ||
|
||
public function __construct(string $description) | ||
{ | ||
$this->description = $description; | ||
} | ||
|
||
public function getDescription(): string | ||
{ | ||
return $this->description; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the eluceo/iCal package. | ||
* | ||
* (c) 2020 Markus Poerschke <[email protected]> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
namespace Eluceo\iCal\Domain\ValueObject\Alarm; | ||
|
||
final class EmailAction extends Action | ||
{ | ||
private string $summary; | ||
private string $description; | ||
|
||
public function __construct(string $summary, string $description) | ||
{ | ||
$this->summary = $summary; | ||
$this->description = $description; | ||
} | ||
|
||
public function getDescription(): string | ||
{ | ||
return $this->description; | ||
} | ||
|
||
public function getSummary(): string | ||
{ | ||
return $this->summary; | ||
} | ||
} |
Oops, something went wrong.