‪TYPO3CMS  9.5
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 {
23  protected ‪$eltsSupport;
24 
25  public function ‪__construct(?\DateTimeInterface ‪$communitySupport, ?\DateTimeInterface ‪$eltsSupport)
26  {
27  $this->communitySupport = ‪$communitySupport;
28  $this->eltsSupport = ‪$eltsSupport;
29  }
30 
31  public static function ‪fromApiResponse(array $response): self
32  {
33  $maintainedUntil = isset($response['maintained_until']) ? new \DateTimeImmutable($response['maintained_until']) : null;
34  $eltsUntil = isset($response['elts_until']) ? new \DateTimeImmutable($response['elts_until']) : null;
35 
36  return new self($maintainedUntil, $eltsUntil);
37  }
38 
39  public function ‪isSupportedByCommunity(): bool
40  {
41  return $this->‪isSupported($this->communitySupport);
42  }
43 
44  public function ‪isSupportedByElts(): bool
45  {
46  return $this->‪isSupported($this->eltsSupport);
47  }
48 
49  protected function ‪isSupported(?\DateTimeInterface $supportedUntil): bool
50  {
51  return $supportedUntil !== null
52  && (
53  $supportedUntil >=
54  new \DateTimeImmutable('now', new \DateTimeZone('UTC'))
55  );
56  }
57 }
‪TYPO3\CMS\Install\CoreVersion\MaintenanceWindow\isSupportedByElts
‪isSupportedByElts()
Definition: MaintenanceWindow.php:44
‪TYPO3\CMS\Install\CoreVersion
Definition: CoreRelease.php:18
‪TYPO3\CMS\Install\CoreVersion\MaintenanceWindow\$eltsSupport
‪$eltsSupport
Definition: MaintenanceWindow.php:23
‪TYPO3\CMS\Install\CoreVersion\MaintenanceWindow
Definition: MaintenanceWindow.php:21
‪TYPO3\CMS\Install\CoreVersion\MaintenanceWindow\$communitySupport
‪$communitySupport
Definition: MaintenanceWindow.php:22
‪TYPO3\CMS\Install\CoreVersion\MaintenanceWindow\isSupported
‪isSupported(?\DateTimeInterface $supportedUntil)
Definition: MaintenanceWindow.php:49
‪TYPO3\CMS\Install\CoreVersion\MaintenanceWindow\fromApiResponse
‪static fromApiResponse(array $response)
Definition: MaintenanceWindow.php:31
‪TYPO3\CMS\Install\CoreVersion\MaintenanceWindow\isSupportedByCommunity
‪isSupportedByCommunity()
Definition: MaintenanceWindow.php:39
‪TYPO3\CMS\Install\CoreVersion\MaintenanceWindow\__construct
‪__construct(?\DateTimeInterface $communitySupport, ?\DateTimeInterface $eltsSupport)
Definition: MaintenanceWindow.php:25