$node) ) { $currentValue = $currentValue->$node; } else { $pathExists = false; break; } } if ( $pathExists ) { return $currentValue; } return $default; } /** * Get the first array element that is not empty. * * @param array $values * @param mixed|null $default Returns this value if there are no non-empty elements. * @return mixed|null */ public static function findNotEmpty($values, $default = null) { if ( empty($values) ) { return $default; } foreach ($values as $value) { if ( !empty($value) ) { return $value; } } return $default; } /** * Check if the input string starts with the specified prefix. * * @param string $input * @param string $prefix * @return bool */ public static function startsWith($input, $prefix) { $length = strlen($prefix); return (substr($input, 0, $length) === $prefix); } } endif;