‪TYPO3CMS  ‪main
MaintenanceWindow.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 {
22  public function ‪__construct(
23  protected readonly ?\DateTimeInterface $communitySupport,
24  protected readonly ?\DateTimeInterface $eltsSupport
25  ) {}
26 
27  public static function ‪fromApiResponse(array $response): self
28  {
29  $maintainedUntil = isset($response['maintained_until']) ? new \DateTimeImmutable($response['maintained_until']) : null;
30  $eltsUntil = isset($response['elts_until']) ? new \DateTimeImmutable($response['elts_until']) : null;
31 
32  return new self($maintainedUntil, $eltsUntil);
33  }
34 
35  public function ‪isSupportedByCommunity(): bool
36  {
37  return $this->‪isSupported($this->communitySupport);
38  }
39 
40  public function ‪isSupportedByElts(): bool
41  {
42  return $this->‪isSupported($this->eltsSupport);
43  }
44 
45  protected function ‪isSupported(?\DateTimeInterface $supportedUntil): bool
46  {
47  return $supportedUntil !== null
48  && (
49  $supportedUntil >=
50  new \DateTimeImmutable('now', new \DateTimeZone('UTC'))
51  );
52  }
53 }
‪TYPO3\CMS\Install\CoreVersion\MaintenanceWindow\isSupportedByElts
‪isSupportedByElts()
Definition: MaintenanceWindow.php:40
‪TYPO3\CMS\Install\CoreVersion
Definition: CoreRelease.php:18
‪TYPO3\CMS\Install\CoreVersion\MaintenanceWindow
Definition: MaintenanceWindow.php:21
‪TYPO3\CMS\Install\CoreVersion\MaintenanceWindow\isSupported
‪isSupported(?\DateTimeInterface $supportedUntil)
Definition: MaintenanceWindow.php:45
‪TYPO3\CMS\Install\CoreVersion\MaintenanceWindow\__construct
‪__construct(protected readonly ?\DateTimeInterface $communitySupport, protected readonly ?\DateTimeInterface $eltsSupport)
Definition: MaintenanceWindow.php:22
‪TYPO3\CMS\Install\CoreVersion\MaintenanceWindow\fromApiResponse
‪static fromApiResponse(array $response)
Definition: MaintenanceWindow.php:27
‪TYPO3\CMS\Install\CoreVersion\MaintenanceWindow\isSupportedByCommunity
‪isSupportedByCommunity()
Definition: MaintenanceWindow.php:35