We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
And make a point about construction from \DateTimeImmutable in the infrastructure layer (another assignment)?
The text was updated successfully, but these errors were encountered:
Something like?
final class ScheduledDate { private const DATE_TIME_FORMAT = \DateTime::ATOM; /** * @var string */ private $dateTime; private function __construct(string $dateTime) { $this->dateTime = $dateTime; } public static function fromPhpDateString(string $phpDateString): ScheduledDate { try { $dateTimeImmutable = new \DateTimeImmutable($phpDateString); } catch (\Throwable $throwable) { throw new \InvalidArgumentException( 'Invalid PHP date time format', null, $throwable ); } return self::fromDateTime($dateTimeImmutable); } public static function fromDateTime(\DateTimeImmutable $dateTime): ScheduledDate { return new self($dateTime->format(self::DATE_TIME_FORMAT)); } public function __toString() { return $this->dateTime; } }
Sorry, something went wrong.
dae82a6
No branches or pull requests
And make a point about construction from \DateTimeImmutable in the infrastructure layer (another assignment)?
The text was updated successfully, but these errors were encountered: