To::_()

Creates a virtual method.

Table of Contents
  1. Description
  2. Example

Description

To::_(...$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 `To::RGB()` available for use
To::_('RGB', static function (string $rgb): array {
    [$r, $g, $b] = str_split(substr($rgb, 1), 2);
    return [hexdec($r), hexdec($g), hexdec($b)];
});

To::URL()

Converts private file path to public URL, or decodes URL special characters.

To::_()

Creates a virtual method.

To::entity()

Converts characters to their corresponding HTML entities.

To::file()

Converts current value to a safe file name.

To::path()

Converts public URL to private file path.