super-powers/src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/code.power

25 lines
504 B
Plaintext
Raw Normal View History

2023-10-04 18:23:30 +00:00
/**
* Check if a registry path exists and is a string
*
* @param string $path Registry path (e.g. joomla.content.showauthor)
*
* @return boolean
* @since 3.2.0
*/
public function isString(string $path): bool
{
// Return default value if path is empty
if (empty($path)) {
return false;
}
// get the value
if (($node = $this->get($path)) !== null
&& is_string($node)
&& strlen((string) $node) > 0)
{
return true;
}
return false;
}