Automattic\WooCommerce\Vendor\Sabberworm\CSS

OutputFormatter::safelypublicWC 1.0

Runs the given code, either swallowing or passing exceptions, depending on the bIgnoreExceptions setting.

Method of the class: OutputFormatter{}

No Hooks.

Returns

String|null.

Usage

$OutputFormatter = new OutputFormatter();
$OutputFormatter->safely( $cCode );
$cCode(string) (required)
the name of the function to call.

OutputFormatter::safely() code WC 10.8.1

public function safely($cCode)
{
    if ($this->oFormat->get('IgnoreExceptions')) {
        // If output exceptions are ignored, run the code with exception guards
        try {
            return $cCode();
        } catch (OutputException $e) {
            return null;
        } // Do nothing
    } else {
        // Run the code as-is
        return $cCode();
    }
}