# ultimate-store-kit/3.1.0/base/support/helpers.php

Ultimate Store Kit, version 3.1.0. 32 lines.

- Page: https://pluginprobe.com/plugins/ultimate-store-kit/3.1.0/code/base/support/helpers.php
- Raw: https://pluginprobe.com/plugins/ultimate-store-kit/3.1.0/raw/base/support/helpers.php
- Modified: 2026-08-17T09:34:16+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ultimate-store-kit/3.1.0/code/base/support/helpers.php#L10-L20`.

```php
<?php

if (! defined('ABSPATH')) {
	exit; // Exit if accessed directly
}

// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals -- usk_ / BDTUSK_ / ultimate-store-kit- are this plugin's established public prefixes. Ultimate Store Kit Pro calls into these names, as does third-party integration code, so renaming them is a breaking change. Plugin Check only recognises prefixes derived verbatim from the slug and so reports them as unprefixed.

use UltimateStoreKit\Base\Support\Optional;

if (! function_exists('usk_optional')) {
    /**
     * Provide access to optional objects.
     *
     * Named usk_optional() rather than optional(): the unprefixed name is the
     * Laravel helper, which any plugin bundling illuminate/support also declares.
     * Behind a function_exists() guard the first declaration wins, so an
     * unprefixed version would silently hand this plugin a foreign Optional class.
     *
     * @param  mixed  $value
     * @param  callable|null  $callback
     * @return mixed
     */
    function usk_optional($value = null, ?callable $callback = null) {
        if (is_null($callback)) {
            return new Optional($value);
        } elseif (! is_null($value)) {
            return $callback($value);
        }
    }
}

```
