From 32d3a8b94460607e105c32480b15193fcfbe3e0a Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Sat, 15 Apr 2023 17:05:14 +0200 Subject: [PATCH] first commit --- README.md | 77 ++++++++++++ .../README.md | 98 +++++++++++++++ .../code.php | 114 ++++++++++++++++++ .../code.power | 79 ++++++++++++ .../settings.json | 18 +++ super-powers.json | 12 ++ 6 files changed, 398 insertions(+) create mode 100644 README.md create mode 100644 src/171fcb39-ae27-4c2b-b091-2f70b824288b/README.md create mode 100644 src/171fcb39-ae27-4c2b-b091-2f70b824288b/code.php create mode 100644 src/171fcb39-ae27-4c2b-b091-2f70b824288b/code.power create mode 100644 src/171fcb39-ae27-4c2b-b091-2f70b824288b/settings.json create mode 100644 super-powers.json diff --git a/README.md b/README.md new file mode 100644 index 0000000..6fd86c3 --- /dev/null +++ b/README.md @@ -0,0 +1,77 @@ +``` +███████╗██╗ ██╗██████╗ ███████╗██████╗ +██╔════╝██║ ██║██╔══██╗██╔════╝██╔══██╗ +███████╗██║ ██║██████╔╝█████╗ ██████╔╝ +╚════██║██║ ██║██╔═══╝ ██╔══╝ ██╔══██╗ +███████║╚██████╔╝██║ ███████╗██║ ██║ +╚══════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ ███████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗██╔════╝ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝███████╗ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗╚════██║ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║███████║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝╚══════╝ +``` + +### What is JCB Super Powers? +The Joomla Component Builder (JCB) Super Power features are designed to enhance JCB's functionality and streamline the development process. These Super Powers enable developers to efficiently manage and share their custom powers across multiple JCB instances through repositories hosted on [https://git.vdm.dev/[username]/[repository-name]](https://git.vdm.dev). JCB Super Powers are managed using a combination of layers, events, tasks, methods, switches, and algorithms, which work together to provide powerful customization and extensibility options. More details on JCB Super Powers can be found in the [Super Powers Documentation](https://git.vdm.dev/joomla/super-powers/wiki). + +In summary, JCB Super Powers offer a flexible and efficient way to manage and share functionalities between JCB instances. By utilizing a sophisticated system of layers, events, tasks, methods, switches, and algorithms, developers can seamlessly integrate JCB core powers and their custom powers. For more information on how to work with JCB Super Powers, refer to the [Super Powers User Guide](https://git.vdm.dev/joomla/super-powers/wiki). + +### What can I find here? +This repository contains an index (see below) of all the approved powers within the JCB GUI. During the compilation of a component, these powers are automatically added to the repository, ensuring a well-organized and accessible collection of functionalities. + +# Index of powers + +- **Namespace**: [VDM\Psr\Cache](#vdm-psr-cache) + + - **interface CacheItemInterface** | [Details](src/171fcb39-ae27-4c2b-b091-2f70b824288b) | [Code](src/171fcb39-ae27-4c2b-b091-2f70b824288b/code.php) | [Settings](src/171fcb39-ae27-4c2b-b091-2f70b824288b/settings.json) | [171fcb39-ae27-4c2b-b091-2f70b824288b](src/171fcb39-ae27-4c2b-b091-2f70b824288b) + +# Class Diagrams + +## VDM Psr Cache +> namespace VDM\Psr\Cache +```uml +@startuml + +namespace VDM\Psr\Cache #DarkCyan { + + + interface CacheItemInterface #Lavender { + + getKey() : string + + get() : mixed + + isHit() : bool + + set() : static + + expiresAt() : static + + expiresAfter() : static + } +} + + +@enduml +``` + + +--- +``` + ██╗ ██████╗ ██████╗ ███╗ ███╗██╗ █████╗ + ██║██╔═══██╗██╔═══██╗████╗ ████║██║ ██╔══██╗ + ██║██║ ██║██║ ██║██╔████╔██║██║ ███████║ +██ ██║██║ ██║██║ ██║██║╚██╔╝██║██║ ██╔══██║ +╚█████╔╝╚██████╔╝╚██████╔╝██║ ╚═╝ ██║███████╗██║ ██║ + ╚════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ + ██████╗ ██████╗ ███╗ ███╗██████╗ ██████╗ ███╗ ██╗███████╗███╗ ██╗████████╗ +██╔════╝██╔═══██╗████╗ ████║██╔══██╗██╔═══██╗████╗ ██║██╔════╝████╗ ██║╚══██╔══╝ +██║ ██║ ██║██╔████╔██║██████╔╝██║ ██║██╔██╗ ██║█████╗ ██╔██╗ ██║ ██║ +██║ ██║ ██║██║╚██╔╝██║██╔═══╝ ██║ ██║██║╚██╗██║██╔══╝ ██║╚██╗██║ ██║ +╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ╚██████╔╝██║ ╚████║███████╗██║ ╚████║ ██║ + ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝╚═╝ ╚═══╝ ╚═╝ +██████╗ ██╗ ██╗██╗██╗ ██████╗ ███████╗██████╗ +██╔══██╗██║ ██║██║██║ ██╔══██╗██╔════╝██╔══██╗ +██████╔╝██║ ██║██║██║ ██║ ██║█████╗ ██████╔╝ +██╔══██╗██║ ██║██║██║ ██║ ██║██╔══╝ ██╔══██╗ +██████╔╝╚██████╔╝██║███████╗██████╔╝███████╗██║ ██║ +╚═════╝ ╚═════╝ ╚═╝╚══════╝╚═════╝ ╚══════╝╚═╝ ╚═╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/171fcb39-ae27-4c2b-b091-2f70b824288b/README.md b/src/171fcb39-ae27-4c2b-b091-2f70b824288b/README.md new file mode 100644 index 0000000..f3ef7da --- /dev/null +++ b/src/171fcb39-ae27-4c2b-b091-2f70b824288b/README.md @@ -0,0 +1,98 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# interface CacheItemInterface (Details) +> namespace: **VDM\Psr\Cache** +```uml +@startuml +interface CacheItemInterface #Lavender { + + getKey() : string + + get() : mixed + + isHit() : bool + + set(mixed $value) : static + + expiresAt(?\DateTimeInterface $expiration) : static + + expiresAfter(int|\DateInterval|null $time) : static +} + +note right of CacheItemInterface::getKey + Returns the key for the current cache item. +The key is loaded by the Implementing Library, but should be available to +the higher level callers when needed. +The key string for this cache item. + + return: string +end note + +note right of CacheItemInterface::get + Retrieves the value of the item from the cache associated with this object's key. +The value returned must be identical to the value originally stored by set(). +If isHit() returns false, this method MUST return null. Note that null +is a legitimate cached value, so the isHit() method SHOULD be used to +differentiate between "null value was found" and "no value was found." +The value corresponding to this cache item's key, or null if not found. + + return: mixed +end note + +note right of CacheItemInterface::isHit + Confirms if the cache item lookup resulted in a cache hit. +Note: This method MUST NOT have a race condition between calling isHit() +and calling get(). +True if the request resulted in a cache hit. False otherwise. + + return: bool +end note + +note right of CacheItemInterface::set + Sets the value represented by this cache item. +The $value argument may be any item that can be serialized by PHP, +although the method of serialization is left up to the Implementing +Library. +The serializable value to be stored. +The invoked object. + + return: static +end note + +note right of CacheItemInterface::expiresAt + Sets the expiration time for this cache item. +The point in time after which the item MUST be considered expired. +If null is passed explicitly, a default value MAY be used. If none is set, +the value should be stored permanently or for as long as the +implementation allows. +The called object. + + return: static +end note + +note right of CacheItemInterface::expiresAfter + Sets the expiration time for this cache item. +The period of time from the present after which the item MUST be considered +expired. An integer parameter is understood to be the time in seconds until +expiration. If null is passed explicitly, a default value MAY be used. +If none is set, the value should be stored permanently or for as long as the +implementation allows. +The called object. + + return: static +end note + +@enduml +``` + +--- +``` + ██╗ ██████╗██████╗ + ██║██╔════╝██╔══██╗ + ██║██║ ██████╔╝ +██ ██║██║ ██╔══██╗ +╚█████╔╝╚██████╗██████╔╝ + ╚════╝ ╚═════╝╚═════╝ +``` +> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder) + diff --git a/src/171fcb39-ae27-4c2b-b091-2f70b824288b/code.php b/src/171fcb39-ae27-4c2b-b091-2f70b824288b/code.php new file mode 100644 index 0000000..458e1db --- /dev/null +++ b/src/171fcb39-ae27-4c2b-b091-2f70b824288b/code.php @@ -0,0 +1,114 @@ + + * @git Caching Interface + * @license MIT + */ +namespace VDM\Psr\Cache; + + +/** + * CacheItemInterface defines an interface for interacting with objects inside a cache. + * + * Each Item object MUST be associated with a specific key, which can be set + * according to the implementing system and is typically passed by the + * Cache\CacheItemPoolInterface object. + * + * The Cache\CacheItemInterface object encapsulates the storage and retrieval of + * cache items. Each Cache\CacheItemInterface is generated by a + * Cache\CacheItemPoolInterface object, which is responsible for any required + * setup as well as associating the object with a unique Key. + * Cache\CacheItemInterface objects MUST be able to store and retrieve any type + * of PHP value defined in the Data section of the specification. + * + * Calling Libraries MUST NOT instantiate Item objects themselves. They may only + * be requested from a Pool object via the getItem() method. Calling Libraries + * SHOULD NOT assume that an Item created by one Implementing Library is + * compatible with a Pool from another Implementing Library. + */ +interface CacheItemInterface +{ + /** + * Returns the key for the current cache item. + * + * The key is loaded by the Implementing Library, but should be available to + * the higher level callers when needed. + * + * @return string + * The key string for this cache item. + */ + public function getKey(): string; + + /** + * Retrieves the value of the item from the cache associated with this object's key. + * + * The value returned must be identical to the value originally stored by set(). + * + * If isHit() returns false, this method MUST return null. Note that null + * is a legitimate cached value, so the isHit() method SHOULD be used to + * differentiate between "null value was found" and "no value was found." + * + * @return mixed + * The value corresponding to this cache item's key, or null if not found. + */ + public function get(): mixed; + + /** + * Confirms if the cache item lookup resulted in a cache hit. + * + * Note: This method MUST NOT have a race condition between calling isHit() + * and calling get(). + * + * @return bool + * True if the request resulted in a cache hit. False otherwise. + */ + public function isHit(): bool; + + /** + * Sets the value represented by this cache item. + * + * The $value argument may be any item that can be serialized by PHP, + * although the method of serialization is left up to the Implementing + * Library. + * + * @param mixed $value + * The serializable value to be stored. + * + * @return static + * The invoked object. + */ + public function set(mixed $value): static; + + /** + * Sets the expiration time for this cache item. + * + * @param ?\DateTimeInterface $expiration + * The point in time after which the item MUST be considered expired. + * If null is passed explicitly, a default value MAY be used. If none is set, + * the value should be stored permanently or for as long as the + * implementation allows. + * + * @return static + * The called object. + */ + public function expiresAt(?\DateTimeInterface $expiration): static; + + /** + * Sets the expiration time for this cache item. + * + * @param int|\DateInterval|null $time + * The period of time from the present after which the item MUST be considered + * expired. An integer parameter is understood to be the time in seconds until + * expiration. If null is passed explicitly, a default value MAY be used. + * If none is set, the value should be stored permanently or for as long as the + * implementation allows. + * + * @return static + * The called object. + */ + public function expiresAfter(int|\DateInterval|null $time): static; +} + diff --git a/src/171fcb39-ae27-4c2b-b091-2f70b824288b/code.power b/src/171fcb39-ae27-4c2b-b091-2f70b824288b/code.power new file mode 100644 index 0000000..f3097c9 --- /dev/null +++ b/src/171fcb39-ae27-4c2b-b091-2f70b824288b/code.power @@ -0,0 +1,79 @@ + /** + * Returns the key for the current cache item. + * + * The key is loaded by the Implementing Library, but should be available to + * the higher level callers when needed. + * + * @return string + * The key string for this cache item. + */ + public function getKey(): string; + + /** + * Retrieves the value of the item from the cache associated with this object's key. + * + * The value returned must be identical to the value originally stored by set(). + * + * If isHit() returns false, this method MUST return null. Note that null + * is a legitimate cached value, so the isHit() method SHOULD be used to + * differentiate between "null value was found" and "no value was found." + * + * @return mixed + * The value corresponding to this cache item's key, or null if not found. + */ + public function get(): mixed; + + /** + * Confirms if the cache item lookup resulted in a cache hit. + * + * Note: This method MUST NOT have a race condition between calling isHit() + * and calling get(). + * + * @return bool + * True if the request resulted in a cache hit. False otherwise. + */ + public function isHit(): bool; + + /** + * Sets the value represented by this cache item. + * + * The $value argument may be any item that can be serialized by PHP, + * although the method of serialization is left up to the Implementing + * Library. + * + * @param mixed $value + * The serializable value to be stored. + * + * @return static + * The invoked object. + */ + public function set(mixed $value): static; + + /** + * Sets the expiration time for this cache item. + * + * @param ?\DateTimeInterface $expiration + * The point in time after which the item MUST be considered expired. + * If null is passed explicitly, a default value MAY be used. If none is set, + * the value should be stored permanently or for as long as the + * implementation allows. + * + * @return static + * The called object. + */ + public function expiresAt(?\DateTimeInterface $expiration): static; + + /** + * Sets the expiration time for this cache item. + * + * @param int|\DateInterval|null $time + * The period of time from the present after which the item MUST be considered + * expired. An integer parameter is understood to be the time in seconds until + * expiration. If null is passed explicitly, a default value MAY be used. + * If none is set, the value should be stored permanently or for as long as the + * implementation allows. + * + * @return static + * The called object. + */ + public function expiresAfter(int|\DateInterval|null $time): static; \ No newline at end of file diff --git a/src/171fcb39-ae27-4c2b-b091-2f70b824288b/settings.json b/src/171fcb39-ae27-4c2b-b091-2f70b824288b/settings.json new file mode 100644 index 0000000..8b54ea2 --- /dev/null +++ b/src/171fcb39-ae27-4c2b-b091-2f70b824288b/settings.json @@ -0,0 +1,18 @@ +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "0", + "guid": "171fcb39-ae27-4c2b-b091-2f70b824288b", + "implements": null, + "load_selection": null, + "name": "CacheItemInterface", + "power_version": "3.0.0", + "system_name": "Psr.Cache.CacheItemInterface", + "type": "interface", + "use_selection": null, + "namespace": "VDM\\Psr\\Cache.CacheItemInterface", + "description": "\/**\r\n * CacheItemInterface defines an interface for interacting with objects inside a cache.\r\n *\r\n * Each Item object MUST be associated with a specific key, which can be set\r\n * according to the implementing system and is typically passed by the\r\n * Cache\\CacheItemPoolInterface object.\r\n *\r\n * The Cache\\CacheItemInterface object encapsulates the storage and retrieval of\r\n * cache items. Each Cache\\CacheItemInterface is generated by a\r\n * Cache\\CacheItemPoolInterface object, which is responsible for any required\r\n * setup as well as associating the object with a unique Key.\r\n * Cache\\CacheItemInterface objects MUST be able to store and retrieve any type\r\n * of PHP value defined in the Data section of the specification.\r\n *\r\n * Calling Libraries MUST NOT instantiate Item objects themselves. They may only\r\n * be requested from a Pool object via the getItem() method. Calling Libraries\r\n * SHOULD NOT assume that an Item created by one Implementing Library is\r\n * compatible with a Pool from another Implementing Library.\r\n *\/", + "licensing_template": "\/**\r\n * @package Common interface for caching libraries\r\n *\r\n * @created Feb 9, 2021\r\n * @author PHP-FIG \r\n * @git Caching Interface \r\n * @license MIT\r\n *\/", + "head": "", + "composer": "" +} \ No newline at end of file diff --git a/super-powers.json b/super-powers.json new file mode 100644 index 0000000..fa771cc --- /dev/null +++ b/super-powers.json @@ -0,0 +1,12 @@ +{ + "171fcb39-ae27-4c2b-b091-2f70b824288b": { + "name": "CacheItemInterface", + "type": "interface", + "namespace": "VDM\\Psr\\Cache", + "code": "src\/171fcb39-ae27-4c2b-b091-2f70b824288b\/code.php", + "power": "src\/171fcb39-ae27-4c2b-b091-2f70b824288b\/code.power", + "settings": "src\/171fcb39-ae27-4c2b-b091-2f70b824288b\/settings.json", + "path": "src\/171fcb39-ae27-4c2b-b091-2f70b824288b", + "guid": "171fcb39-ae27-4c2b-b091-2f70b824288b" + } +} \ No newline at end of file