Is::_()

Creates a virtual method.

Table of Contents
  1. Description
  2. Example

Description

Is::_(...$lot): mixed;

This method adds a new static method dynamically so that it can be used later as if it were a native method.

Example

// This register will make method `Is::RGB()` available for use
Is::_('RGB', static function (mixed $value): bool {
    if (!is_string($value)) {
        return false;
    }
    if (0 !== strpos($value, 'rgb(')) {
        return false;
    }
    return preg_match('/^rgb\(\s*([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\s*,\s*([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\s*,\s*([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\s*\)$/', $value);
});

Is::_()

Creates a virtual method.

Is::file()

Checks if current input is a valid file path.

Is::path()

Checks if current input is a valid path.

Is::void()

Checks for empty string, array and object.