27 lines
611 B
Plaintext
27 lines
611 B
Plaintext
/**
|
|
* Get a registry path if the return value is a string
|
|
*
|
|
* @param string $path Registry path (e.g. joomla.content.showauthor)
|
|
* @param string|null $default A default value
|
|
*
|
|
* @return string|null
|
|
* @since 3.2.0
|
|
*/
|
|
public function getString(string $path, ?string $default = null): ?string
|
|
{
|
|
// Return default value if path is empty
|
|
if (empty($path))
|
|
{
|
|
return $default;
|
|
}
|
|
|
|
// get the value
|
|
if (($node = $this->get($path)) !== null
|
|
&& is_string($node)
|
|
&& strlen((string) $node) > 0)
|
|
{
|
|
return $node;
|
|
}
|
|
|
|
return $default;
|
|
} |