32 lines
707 B
Plaintext
32 lines
707 B
Plaintext
/**
|
|
* Convert an array of values to a string (or return string)
|
|
*
|
|
* @param string $path Registry path (e.g. joomla.content.showauthor)
|
|
* @param string $seperator Return string separator
|
|
*
|
|
* @return string
|
|
* @since 3.2.0
|
|
*/
|
|
public function toString(string $path, string $separator = ''): string
|
|
{
|
|
// Return default value if path is empty
|
|
if (empty($path))
|
|
{
|
|
return '';
|
|
}
|
|
|
|
// get the value
|
|
if (($node = $this->get($path)) !== null)
|
|
{
|
|
if (is_array($node) && $node !== [])
|
|
{
|
|
return implode($separator, $node);
|
|
}
|
|
elseif (is_string($node) && strlen((string) $node) > 0)
|
|
{
|
|
return $node;
|
|
}
|
|
}
|
|
|
|
return '';
|
|
} |