code/string/escaper/escaper.php
public static function escape($string, $context = 'html')
    {
        $method = 'escape'.ucfirst($context);

        if(!method_exists(__CLASS__, $method)) {
            throw new \InvalidArgumentException(sprintf('Cannot escape to: %s. Unknow context.', $context));
        }

        return static::$method($string);
    }
public static function escape($string, $context = 'html')
    {
        $method = 'escape'.ucfirst($context);

        if(!method_exists(__CLASS__, $method)) {
            throw new \InvalidArgumentException(sprintf('Cannot escape to: %s. Unknow context.', $context));
        }

        return static::$method($string);
    }
public static function escape ( $ string , $ context = 'html' ) { $ method = 'escape' . ucfirst ( $ context ) ; if ( ! method_exists ( __CLASS__ , $ method ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Cannot escape to: %s. Unknow context.' , $ context ) ) ; } return static :: $ method ( $ string ) ; }
Escapde a string for a specific context

@param string $string    The string to escape
@param string $context   The context. Default HTML
@throws \InvalidArgumentException If the context is not recognised
@return string
Escapde a string for a specific context