super-powers/src/64e291c2-11f1-423d-a44d-837cc12cc017/code.power

71 lines
2.6 KiB
Plaintext
Raw Normal View History

2023-10-04 18:23:30 +00:00
/**
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
*
2023-10-10 09:39:09 +00:00
* @param string $path Registry path (e.g. vdm.content.builder)
2023-10-04 18:23:30 +00:00
* @param mixed $value Value of entry
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
2024-06-25 12:09:34 +00:00
* @return self
2023-10-04 18:23:30 +00:00
* @since 3.2.0
*/
2024-06-25 12:09:34 +00:00
public function set(string $path, $value): self;
2023-10-04 18:23:30 +00:00
/**
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 $asArray switch.
*
2024-01-27 07:08:12 +00:00
* @param string $path Registry path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
* @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.
2023-10-04 18:23:30 +00:00
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
2024-06-25 12:09:34 +00:00
* @return self
2023-10-04 18:23:30 +00:00
* @since 3.2.0
*/
2024-06-25 12:09:34 +00:00
public function add(string $path, $value, ?bool $asArray = null): self;
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
*
2023-10-10 09:39:09 +00:00
* @param string $path Registry path (e.g. vdm.content.builder)
2023-10-04 18:23:30 +00:00
* @param mixed $default Optional default value, returned if the internal doesn't exist.
*
* @throws \InvalidArgumentException If any of the path values 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 get(string $path, $default = null);
/**
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
*
2023-10-10 09:39:09 +00:00
* @param string $path Registry path (e.g. vdm.content.builder)
2023-10-04 18:23:30 +00:00
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
2024-06-25 12:09:34 +00:00
* @return self
2023-10-04 18:23:30 +00:00
* @since 3.2.0
*/
2024-06-25 12:09:34 +00:00
public function remove(string $path): self;
2023-10-04 18:23:30 +00:00
/**
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
*
2023-10-10 09:39:09 +00:00
* @param string $path Registry path (e.g. vdm.content.builder)
2023-10-04 18:23:30 +00:00
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return bool True if the location exists, false otherwise.
* @since 3.2.0
*/
public function exists(string $path): bool;
/**
* Sets a separator value
*
* @param string|null $value The value to set.
*
2024-06-25 12:09:34 +00:00
* @return self
2023-10-04 18:23:30 +00:00
* @since 3.2.0
*/
2024-06-25 12:09:34 +00:00
public function setSeparator(?string $value): self;