You should either return `$text` or define `$text` below the condition