__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Packback\Lti1p3\DeepLinkResources;
use DateTime;
use Packback\Lti1p3\Concerns\Arrayable;
use Packback\Lti1p3\LtiException;
class DateTimeInterval
{
use Arrayable;
public const ERROR_NO_START_OR_END = 'Either a start or end time must be specified.';
public const ERROR_START_GT_END = 'The start time cannot be greater than end time.';
public function __construct(
private ?DateTime $start = null,
private ?DateTime $end = null
) {
$this->validateStartAndEnd();
}
public static function new(): self
{
return new DateTimeInterval();
}
public function getArray(): array
{
if (!isset($this->start) && !isset($this->end)) {
throw new LtiException(self::ERROR_NO_START_OR_END);
}
$this->validateStartAndEnd();
return [
'startDateTime' => $this->start?->format(DateTime::ATOM),
'endDateTime' => $this->end?->format(DateTime::ATOM),
];
}
public function setStart(?DateTime $start): self
{
$this->start = $start;
return $this;
}
public function getStart(): ?DateTime
{
return $this->start;
}
public function setEnd(?DateTime $end): self
{
$this->end = $end;
return $this;
}
public function getEnd(): ?DateTime
{
return $this->end;
}
/**
* @throws LtiException
*/
private function validateStartAndEnd(): void
{
if (isset($this->start) && isset($this->end) && $this->start > $this->end) {
throw new LtiException(self::ERROR_START_GT_END);
}
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| DateTimeInterval.php | File | 1.63 KB | 0777 |
|
| HasDimensions.php | File | 470 B | 0777 |
|
| Icon.php | File | 786 B | 0777 |
|
| Iframe.php | File | 759 B | 0777 |
|
| Resource.php | File | 4.55 KB | 0777 |
|
| Window.php | File | 1.16 KB | 0777 |
|