Habari\FormControl::wrap_by PHP Method

wrap_by() public method

Process a thing either using an sprintf-style string, or a closure
public wrap_by ( Callable | string $wrapper, mixed $thing ) : string
$wrapper Callable | string An sprintf-style wrapper or a function that accepts the same arguments as the call to this
$thing mixed One or more things to use as parameters to the sprintf/closure
return string The resultant string produced by applying the closure or sprintf template
    public function wrap_by($wrapper, $thing)
    {
        $args = func_get_args();
        if (is_callable($wrapper)) {
            array_shift($args);
            return call_user_func_array($wrapper, $args);
        } else {
            return call_user_func_array('sprintf', $args);
        }
    }