super-powers/src/af0eedbe-603b-4671-8e5a-281.../code.php

101 lines
3.2 KiB
PHP
Raw Normal View History

2023-10-04 18:23:30 +00:00
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Interfaces;
/**
2023-10-10 09:39:09 +00:00
* The Active Registry Interface
2023-10-04 18:23:30 +00:00
*
* @since 3.2.0
*/
2023-10-10 09:39:09 +00:00
interface Activeregistryinterface
2023-10-04 18:23:30 +00:00
{
/**
2023-10-10 09:39:09 +00:00
* Check if the registry has any content.
2023-10-04 18:23:30 +00:00
*
* @return bool Returns true if the active array is not empty, false otherwise.
* @since 3.2.0
*/
public function isActive(): bool;
/**
2023-10-10 09:39:09 +00:00
* Retrieves all value from the registry.
2023-10-04 18:23:30 +00:00
*
* @return array The values.
* @since 3.2.0
*/
public function allActive(): array;
/**
2023-10-10 09:39:09 +00:00
* Sets a value into the registry using multiple keys.
2023-10-04 18:23:30 +00:00
*
* @param mixed $value The value to set.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function setActive($value, string ...$keys): void;
/**
2023-10-10 09:39:09 +00:00
* Adds content into the registry. If a key exists,
2023-10-04 18:23:30 +00:00
* it either appends or concatenates based on the value's type.
*
2024-01-27 07:08:12 +00:00
* @param mixed $value The value to set.
* @param bool|null $asArray Determines if the new value should be treated as an array.
* Default is $addAsArray = false (if null) in base class.
* Override in child class allowed set class property $addAsArray = true.
* @param string ...$keys The keys to determine the location.
2023-10-04 18:23:30 +00:00
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
2024-01-27 07:08:12 +00:00
public function addActive($value, ?bool $asArray, string ...$keys): void;
2023-10-04 18:23:30 +00:00
/**
2023-10-10 09:39:09 +00:00
* Retrieves a value (or sub-array) from the registry using multiple keys.
2023-10-04 18:23:30 +00:00
*
* @param mixed $default The default value if not set.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
* @since 3.2.0
*/
public function getActive($default, string ...$keys);
/**
2023-10-10 09:39:09 +00:00
* Removes a value (or sub-array) from the registry using multiple keys.
2023-10-04 18:23:30 +00:00
*
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function removeActive(string ...$keys): void;
/**
2023-10-10 09:39:09 +00:00
* Checks the existence of a particular location in the registry using multiple keys.
2023-10-04 18:23:30 +00:00
*
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return bool True if the location exists, false otherwise.
* @since 3.2.0
*/
public function existsActive(string ...$keys): bool;
}