diff --git a/src/Modules/Cli/Tasks/BuildTask.php b/src/Modules/Cli/Tasks/BuildTask.php deleted file mode 100644 index ce1a95fc..00000000 --- a/src/Modules/Cli/Tasks/BuildTask.php +++ /dev/null @@ -1,28 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ - -namespace Zemit\Modules\Cli\Tasks; - -use Zemit\Modules\Cli\Task; - -class BuildTask extends Task -{ - public string $cliDoc = << [ ...] - -Options: - task: build - action: main - - -DOC; -} diff --git a/src/Modules/Cli/Tasks/CacheTask.php b/src/Modules/Cli/Tasks/CacheTask.php index 390adc82..f94bbda1 100644 --- a/src/Modules/Cli/Tasks/CacheTask.php +++ b/src/Modules/Cli/Tasks/CacheTask.php @@ -11,18 +11,63 @@ namespace Zemit\Modules\Cli\Tasks; +use Phalcon\Cache\Exception\InvalidArgumentException; use Zemit\Modules\Cli\Task; class CacheTask extends Task { public string $cliDoc = << [ ...] - -Options: - task: cache - action: clear - + zemit cli cache clear + zemit cli cache has + zemit cli cache delete + zemit cli cache delete-multiple [...] DOC; + + /** + * Clears all items from the cache. + * + * @return bool True if all items were successfully cleared, false otherwise. + */ + public function clearAction(): bool + { + return $this->cache->clear(); + } + + /** + * Checks if the given action key exists in the cache. + * + * @param string $key The key identifying the action in the cache. + * @return bool Returns true if the action key exists in the cache, false otherwise. + * @throws InvalidArgumentException + */ + public function hasAction(string $key): bool + { + return $this->cache->has($key); + } + + /** + * Deletes an item from the cache. + * + * @param string $key The key of the item to be deleted. + * @return bool True if the item was successfully deleted, false otherwise. + * @throws InvalidArgumentException + */ + public function deleteAction(string $key): bool + { + return $this->cache->delete($key); + } + + /** + * Deletes multiple cache entries specified by the given keys. + * + * @param mixed ...$keys A variable number of keys representing the cache entries to be deleted. + * + * @return bool Returns true if all cache entries were successfully deleted, false otherwise. + */ + public function deleteMultipleAction(string ...$keys): bool + { + return $this->cache->deleteMultiple($keys); + } } diff --git a/src/Modules/Cli/Tasks/HelpTask.php b/src/Modules/Cli/Tasks/HelpTask.php index c8af9998..9a13590e 100644 --- a/src/Modules/Cli/Tasks/HelpTask.php +++ b/src/Modules/Cli/Tasks/HelpTask.php @@ -11,23 +11,30 @@ namespace Zemit\Modules\Cli\Tasks; -use Phalcon\Exception; +use Phalcon\Dispatcher\Exception; use Zemit\Modules\Cli\Task; class HelpTask extends Task { public string $cliDoc = << [] [ ...] - -Options: - task: build,cron,cache - + zemit cli help cache + zemit cli help cron + zemit cli help database + zemit cli help data-life-cycle + zemit cli help scaffold + zemit cli help test + zemit cli help user DOC; /** - * @throws Exception + * Build Action + * + * This method executes the build action by forwarding the request to the build task's help action. + * + * @return void + * @throws Exception if there is an error during the forwarding process */ public function buildAction(): void { @@ -35,7 +42,12 @@ public function buildAction(): void } /** - * @throws Exception + * Cron Action + * + * This method executes the cron action by forwarding the request to the cron task's help action. + * + * @return void + * @throws Exception if there is an error during the forwarding process */ public function cronAction(): void { @@ -43,7 +55,12 @@ public function cronAction(): void } /** - * @throws Exception + * Cache Action + * + * This method executes the cache action by forwarding the request to the cache task's help action. + * + * @return void + * @throws Exception if there is an error during the forwarding process */ public function cacheAction(): void {