-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Enable basic HTTP caching and use Symfony's reverse proxy
Related: #136
- Loading branch information
1 parent
31b924c
commit 419e070
Showing
12 changed files
with
242 additions
and
25 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,77 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Symfony project "eliashaeussler/typo3-badges". | ||
* | ||
* Copyright (C) 2022 Elias Häußler <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
namespace App\Entity\Dto; | ||
|
||
/** | ||
* ExtensionMetadata. | ||
* | ||
* @author Elias Häußler <[email protected]> | ||
* @license GPL-3.0-or-later | ||
* | ||
* @implements \ArrayAccess<int|string, mixed> | ||
*/ | ||
final class ExtensionMetadata implements \ArrayAccess | ||
{ | ||
public function __construct( | ||
/** | ||
* @var array<int|string, mixed> | ||
*/ | ||
private array $metadata, | ||
private ?\DateTime $expiryDate = null, | ||
) { | ||
} | ||
|
||
/** | ||
* @return array<int|string, mixed> | ||
*/ | ||
public function getMetadata(): array | ||
{ | ||
return $this->metadata; | ||
} | ||
|
||
public function getExpiryDate(): ?\DateTime | ||
{ | ||
return $this->expiryDate; | ||
} | ||
|
||
public function offsetExists(mixed $offset): bool | ||
{ | ||
return isset($this->metadata[$offset]); | ||
} | ||
|
||
public function offsetGet(mixed $offset): mixed | ||
{ | ||
return $this->metadata[$offset] ?? null; | ||
} | ||
|
||
public function offsetSet(mixed $offset, mixed $value): void | ||
{ | ||
$this->metadata[$offset] = $value; | ||
} | ||
|
||
public function offsetUnset(mixed $offset): void | ||
{ | ||
unset($this->metadata[$offset]); | ||
} | ||
} |
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,83 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Symfony project "eliashaeussler/typo3-badges". | ||
* | ||
* Copyright (C) 2022 Elias Häußler <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
namespace App\Tests\Entity\Dto; | ||
|
||
use App\Entity\Dto\ExtensionMetadata; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* ExtensionMetadataTest. | ||
* | ||
* @author Elias Häußler <[email protected]> | ||
* @license GPL-3.0-or-later | ||
*/ | ||
final class ExtensionMetadataTest extends TestCase | ||
{ | ||
private \DateTime $expiryDate; | ||
private ExtensionMetadata $subject; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->expiryDate = new \DateTime(); | ||
$this->subject = new ExtensionMetadata(['foo' => 'baz'], $this->expiryDate); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function getMetadataReturnsExtensionMetadata(): void | ||
{ | ||
self::assertSame(['foo' => 'baz'], $this->subject->getMetadata()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function getExpiryDateReturnsExpiryDate(): void | ||
{ | ||
self::assertSame($this->expiryDate, $this->subject->getExpiryDate()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function subjectCanBeAccessedAsArray(): void | ||
{ | ||
// offsetExists() | ||
self::assertTrue(isset($this->subject['foo'])); | ||
self::assertFalse(isset($this->subject['baz'])); | ||
|
||
// offsetGet() | ||
self::assertSame('baz', $this->subject['foo']); | ||
self::assertNull($this->subject['baz']); | ||
|
||
// offsetSet() | ||
$this->subject['baz'] = 'foo'; | ||
self::assertSame('foo', $this->subject['baz']); | ||
|
||
// offsetUnset() | ||
unset($this->subject['baz']); | ||
self::assertFalse(isset($this->subject['baz'])); | ||
} | ||
} |
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