Back to MailHelper class

Method checkContent

private static void
checkContent
(mixed $content)
Check the content after regular expression function call.
Parameters
  • string $content Content to be checked.
Returns
  • void
Since
  • 4.1.0
-
  • \RuntimeException If there is an error in previous regular expression function call.
Class: MailHelper
Project: Joomla

Method checkContent - Source code

/**
 * Check the content after regular expression function call.
 *
 * @param   string  $content  Content to be checked.
 *
 * @return  void
 *
 * @throws  \RuntimeException  If there is an error in previous regular expression function call.
 * @since  4.1.0
 */
private static function checkContent($content)
{
    if ($content !== null) {
        return;
    }
    switch (preg_last_error()) {
        case PREG_BACKTRACK_LIMIT_ERROR:
            $message = 'PHP regular expression limit reached (pcre.backtrack_limit)';
            break;
        case PREG_RECURSION_LIMIT_ERROR:
            $message = 'PHP regular expression limit reached (pcre.recursion_limit)';
            break;
        case PREG_BAD_UTF8_ERROR:
            $message = 'Bad UTF8 passed to PCRE function';
            break;
        default:
            $message = 'Unknown PCRE error calling PCRE function';
    }
    throw new \RuntimeException($message);
}