-
Notifications
You must be signed in to change notification settings - Fork 5
Pull up non-internal functions into Contracts #93
New issue
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,75 @@ | ||
| <?php | ||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * Pimcore | ||
| * | ||
| * This source file is available under two different licenses: | ||
| * - GNU General Public License version 3 (GPLv3) | ||
| * - Pimcore Commercial License (PCL) | ||
| * Full copyright and license information is available in | ||
| * LICENSE.md which is distributed with this source code. | ||
| * | ||
| * @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
| * @license http://www.pimcore.org/license GPLv3 and PCL | ||
| */ | ||
|
|
||
| namespace Pimcore\Bundle\StaticResolverBundle\Contract\Lib\Cache; | ||
|
|
||
| use Pimcore\Cache\RuntimeCache; | ||
|
|
||
| class RuntimeCacheResolverContract implements RuntimeCacheResolverContractInterface | ||
| { | ||
| public function load(string $id): mixed | ||
| { | ||
| return RuntimeCache::load($id); | ||
| } | ||
|
|
||
| public function save(mixed $data, string $id): void | ||
| { | ||
| RuntimeCache::save($data, $id); | ||
| } | ||
|
|
||
| public function isRegistered(string $index): bool | ||
| { | ||
| return RuntimeCache::isRegistered($index); | ||
| } | ||
|
|
||
| public function clear(array $keepItems = []): void | ||
| { | ||
| RuntimeCache::clear($keepItems); | ||
| } | ||
|
|
||
| /** | ||
| * @throws \Exception | ||
| */ | ||
| public function get(string $index): mixed | ||
| { | ||
| return RuntimeCache::get($index); | ||
| } | ||
|
|
||
| public function set(string $index, mixed $value): void | ||
| { | ||
| RuntimeCache::set($index, $value); | ||
| } | ||
|
|
||
| public function enable(): void | ||
| { | ||
| RuntimeCache::enable(); | ||
| } | ||
|
|
||
| public function disable(): void | ||
| { | ||
| RuntimeCache::disable(); | ||
| } | ||
|
|
||
| public function isEnabled(): bool | ||
| { | ||
| return RuntimeCache::isEnabled(); | ||
| } | ||
|
|
||
| public function getInstance(): RuntimeCache | ||
| { | ||
| return RuntimeCache::getInstance(); | ||
| } | ||
| } |
45 changes: 45 additions & 0 deletions
45
src/Contract/Lib/Cache/RuntimeCacheResolverContractInterface.php
This file contains hidden or 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,45 @@ | ||
| <?php | ||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * Pimcore | ||
| * | ||
| * This source file is available under two different licenses: | ||
| * - GNU General Public License version 3 (GPLv3) | ||
| * - Pimcore Commercial License (PCL) | ||
| * Full copyright and license information is available in | ||
| * LICENSE.md which is distributed with this source code. | ||
| * | ||
| * @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
| * @license http://www.pimcore.org/license GPLv3 and PCL | ||
| */ | ||
|
|
||
| namespace Pimcore\Bundle\StaticResolverBundle\Contract\Lib\Cache; | ||
|
|
||
| use Pimcore\Cache\RuntimeCache; | ||
|
|
||
| interface RuntimeCacheResolverContractInterface | ||
| { | ||
| public function load(string $id): mixed; | ||
|
|
||
| public function save(mixed $data, string $id): void; | ||
|
|
||
| public function isRegistered(string $index): bool; | ||
|
|
||
| public function clear(array $keepItems = []): void; | ||
|
|
||
| /** | ||
| * @throws \Exception | ||
| */ | ||
| public function get(string $index): mixed; | ||
|
|
||
| public function set(string $index, mixed $value): void; | ||
|
|
||
| public function enable(): void; | ||
|
|
||
| public function disable(): void; | ||
|
|
||
| public function isEnabled(): bool; | ||
|
|
||
| public function getInstance(): RuntimeCache; | ||
| } | ||
This file contains hidden or 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,109 @@ | ||
| <?php | ||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * Pimcore | ||
| * | ||
| * This source file is available under two different licenses: | ||
| * - GNU General Public License version 3 (GPLv3) | ||
| * - Pimcore Commercial License (PCL) | ||
| * Full copyright and license information is available in | ||
| * LICENSE.md which is distributed with this source code. | ||
| * | ||
| * @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
| * @license http://www.pimcore.org/license GPLv3 and PCL | ||
| */ | ||
|
|
||
| namespace Pimcore\Bundle\StaticResolverBundle\Contract\Lib; | ||
|
|
||
| use DateInterval; | ||
| use Pimcore\Cache; | ||
|
|
||
| class CacheResolverContract implements CacheResolverContractInterface | ||
| { | ||
| public function load(string $key): mixed | ||
| { | ||
| return Cache::load($key); | ||
| } | ||
|
|
||
| public function remove(string $key): bool | ||
| { | ||
| return Cache::remove($key); | ||
| } | ||
|
|
||
| public function clearAll(): bool | ||
| { | ||
| return Cache::clearAll(); | ||
| } | ||
|
|
||
| public function clearTag(string $tag): bool | ||
| { | ||
| return Cache::clearTag($tag); | ||
| } | ||
|
|
||
| public function disable(): void | ||
| { | ||
| Cache::disable(); | ||
| } | ||
|
|
||
| public function save( | ||
| mixed $data, | ||
| string $key, | ||
| array $tags = [], | ||
| DateInterval|int|null $lifetime = null, | ||
| int $priority = 0, | ||
| bool $force = false | ||
| ): void { | ||
| Cache::save($data, $key, $tags, $lifetime, $priority, $force); | ||
| } | ||
|
|
||
| public function isEnabled(): bool | ||
| { | ||
| return Cache::isEnabled(); | ||
| } | ||
|
|
||
| public function enable(): void | ||
| { | ||
| Cache::enable(); | ||
| } | ||
|
|
||
| public function clearTags(array $tag = []): bool | ||
| { | ||
| return Cache::clearTags($tag); | ||
| } | ||
|
|
||
| public function addClearTagOnShutdown(string $tag): void | ||
| { | ||
| Cache::addClearTagOnShutdown($tag); | ||
| } | ||
|
|
||
| public function addIgnoredTagOnSave(string $tag): void | ||
| { | ||
| Cache::addIgnoredTagOnSave($tag); | ||
| } | ||
|
|
||
| public function removeIgnoredTagOnSave(string $tag): void | ||
| { | ||
| Cache::removeIgnoredTagOnSave($tag); | ||
| } | ||
|
|
||
| public function addIgnoredTagOnClear(string $tag): void | ||
| { | ||
| Cache::addIgnoredTagOnClear($tag); | ||
| } | ||
|
|
||
| public function removeIgnoredTagOnClear(string $tag): void | ||
| { | ||
| Cache::removeIgnoredTagOnClear($tag); | ||
| } | ||
|
|
||
| public function setForceImmediateWrite(bool $force): void | ||
| { | ||
| Cache::setForceImmediateWrite($force); | ||
| } | ||
|
|
||
| public function getForceImmediateWrite(): bool | ||
| { | ||
| return Cache::getForceImmediateWrite(); | ||
| } | ||
| } |
This file contains hidden or 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,61 @@ | ||
| <?php | ||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * Pimcore | ||
| * | ||
| * This source file is available under two different licenses: | ||
| * - GNU General Public License version 3 (GPLv3) | ||
| * - Pimcore Commercial License (PCL) | ||
| * Full copyright and license information is available in | ||
| * LICENSE.md which is distributed with this source code. | ||
| * | ||
| * @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
| * @license http://www.pimcore.org/license GPLv3 and PCL | ||
| */ | ||
|
|
||
| namespace Pimcore\Bundle\StaticResolverBundle\Contract\Lib; | ||
|
|
||
| use DateInterval; | ||
|
|
||
| interface CacheResolverContractInterface | ||
| { | ||
| public function load(string $key): mixed; | ||
|
|
||
| public function remove(string $key): bool; | ||
|
|
||
| public function clearAll(): bool; | ||
|
|
||
| public function clearTag(string $tag): bool; | ||
|
|
||
| public function disable(): void; | ||
|
|
||
| public function save( | ||
| mixed $data, | ||
| string $key, | ||
| array $tags = [], | ||
| DateInterval|int|null $lifetime = null, | ||
| int $priority = 0, | ||
| bool $force = false | ||
| ): void; | ||
|
|
||
| public function isEnabled(): bool; | ||
|
|
||
| public function enable(): void; | ||
|
|
||
| public function clearTags(array $tag = []): bool; | ||
|
|
||
| public function addClearTagOnShutdown(string $tag): void; | ||
|
|
||
| public function addIgnoredTagOnSave(string $tag): void; | ||
|
|
||
| public function removeIgnoredTagOnSave(string $tag): void; | ||
|
|
||
| public function addIgnoredTagOnClear(string $tag): void; | ||
|
|
||
| public function removeIgnoredTagOnClear(string $tag): void; | ||
|
|
||
| public function setForceImmediateWrite(bool $force): void; | ||
|
|
||
| public function getForceImmediateWrite(): bool; | ||
| } |
This file contains hidden or 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,40 @@ | ||
| <?php | ||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * Pimcore | ||
| * | ||
| * This source file is available under two different licenses: | ||
| * - GNU General Public License version 3 (GPLv3) | ||
| * - Pimcore Commercial License (PCL) | ||
| * Full copyright and license information is available in | ||
| * LICENSE.md which is distributed with this source code. | ||
| * | ||
| * @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
| * @license http://www.pimcore.org/license GPLv3 and PCL | ||
| */ | ||
|
|
||
| namespace Pimcore\Bundle\StaticResolverBundle\Contract\Lib; | ||
|
|
||
| use Pimcore\Config; | ||
|
|
||
| class ConfigResolverContract implements ConfigResolverContractInterface | ||
| { | ||
| public function getWebsiteConfigValue( | ||
| ?string $key = null, | ||
| mixed $default = null, | ||
| ?string $language = null | ||
| ): mixed { | ||
| return Config::getWebsiteConfigValue($key, $default, $language); | ||
| } | ||
|
|
||
| public function getWebsiteConfig(?string $language = null): array | ||
| { | ||
| return Config::getWebsiteConfig($language); | ||
| } | ||
|
|
||
| public function getEnvironment(): string | ||
| { | ||
| return Config::getEnvironment(); | ||
| } | ||
| } |
This file contains hidden or 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,26 @@ | ||
| <?php | ||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * Pimcore | ||
| * | ||
| * This source file is available under two different licenses: | ||
| * - GNU General Public License version 3 (GPLv3) | ||
| * - Pimcore Commercial License (PCL) | ||
| * Full copyright and license information is available in | ||
| * LICENSE.md which is distributed with this source code. | ||
| * | ||
| * @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
| * @license http://www.pimcore.org/license GPLv3 and PCL | ||
| */ | ||
|
|
||
| namespace Pimcore\Bundle\StaticResolverBundle\Contract\Lib; | ||
|
|
||
| interface ConfigResolverContractInterface | ||
| { | ||
| public function getEnvironment(): string; | ||
|
|
||
| public function getWebsiteConfigValue(?string $key = null, mixed $default = null, ?string $language = null): mixed; | ||
|
|
||
| public function getWebsiteConfig(?string $language = null): array; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.