__(string $singular, mixed ...$args): string
Returns a translated string if one is found; Otherwise, the submitted message.
string
$singular
Text to translate.
mixed
...$args
Array with arguments or multiple arguments in function.
string
__d(string $domain, string $msg, mixed ...$args): string
Allows you to override the current domain for a single message lookup.
string
$domain
Domain.
string
$msg
String to translate.
mixed
...$args
Array with arguments or multiple arguments in function.
string
__dn(string $domain, string $singular, string $plural, int $count, mixed ...$args): string
Allows you to override the current domain for a single plural message lookup. Returns correct plural form of message identified by $singular and $plural for count $count from domain $domain.
string
$domain
Domain.
string
$singular
Singular string to translate.
string
$plural
Plural.
int
$count
Count.
mixed
...$args
Array with arguments or multiple arguments in function.
string
__dx(string $domain, string $context, string $msg, mixed ...$args): string
Allows you to override the current domain for a single message lookup. The context is a unique identifier for the translations string that makes it unique within the same domain.
string
$domain
Domain.
string
$context
Context of the text.
string
$msg
String to translate.
mixed
...$args
Array with arguments or multiple arguments in function.
string
__dxn(string $domain, string $context, string $singular, string $plural, int $count, mixed ...$args): string
Returns correct plural form of message identified by $singular and $plural for count $count. Allows you to override the current domain for a single message lookup. The context is a unique identifier for the translations string that makes it unique within the same domain.
string
$domain
Domain.
string
$context
Context of the text.
string
$singular
Singular text to translate.
string
$plural
Plural text.
int
$count
Count.
mixed
...$args
Array with arguments or multiple arguments in function.
string
__n(string $singular, string $plural, int $count, mixed ...$args): string
Returns correct plural form of message identified by $singular and $plural for count $count. Some languages have more than one form for plural messages dependent on the count.
string
$singular
Singular text to translate.
string
$plural
Plural text.
int
$count
Count.
mixed
...$args
Array with arguments or multiple arguments in function.
string
__x(string $context, string $singular, mixed ...$args): string
Returns a translated string if one is found; Otherwise, the submitted message. The context is a unique identifier for the translations string that makes it unique within the same domain.
string
$context
Context of the text.
string
$singular
Text to translate.
mixed
...$args
Array with arguments or multiple arguments in function.
string
__xn(string $context, string $singular, string $plural, int $count, mixed ...$args): string
Returns correct plural form of message identified by $singular and $plural for count $count. Some languages have more than one form for plural messages dependent on the count. The context is a unique identifier for the translations string that makes it unique within the same domain.
string
$context
Context of the text.
string
$singular
Singular text to translate.
string
$plural
Plural text.
int
$count
Count.
mixed
...$args
Array with arguments or multiple arguments in function.
string
breakpoint(): string|null
Command to return the eval-able code to startup PsySH in interactive debugger Works the same way as eval(\Psy\sh()); psy/psysh must be loaded in your project
eval(breakpoint());
string|null
collection(iterable $items): Cake\Collection\Collection
Returns a new {@link \Cake\Collection\Collection} object wrapping the passed argument.
iterable
$items
The items from which the collection will be built.
Cake\Collection\Collection
dd(mixed $var, bool|null $showHtml = null): void
Prints out debug information about given variable and dies.
Only runs if debug mode is enabled. It will otherwise just continue code execution and ignore this function.
mixed
$var
Variable to show debug information for.
bool|null
$showHtml
optional
If set to true, the method prints the debug data in a browser-friendly way.
void
debug(mixed $var, bool|null $showHtml = null, bool $showFrom = true): mixed
Prints out debug information about given variable and returns the variable that was passed.
Only runs if debug mode is enabled.
mixed
$var
Variable to show debug information for.
bool|null
$showHtml
optional
If set to true, the method prints the debug data in a browser-friendly way.
bool
$showFrom
optional
If set to true, the method prints from where the function was called.
mixed
deprecationWarning(string $version, string $message, int $stackFrame = 1): void
Helper method for outputting deprecation warnings
string
$version
The version that added this deprecation warning.
string
$message
The message to output as a deprecation warning.
int
$stackFrame
optional
The stack frame to include in the error. Defaults to 1 as that should point to application/plugin code.
void
env(string $key, string|bool|null $default = null): string|float|int|bool|null
Gets an environment variable from available sources, and provides emulation for unsupported or inconsistent environment variables (i.e. DOCUMENT_ROOT on IIS, or SCRIPT_NAME in CGI mode). Also exposes some additional custom environment information.
string
$key
Environment variable name.
string|bool|null
$default
optional
Specify a default value in case the environment variable is not defined.
string|float|int|bool|null
h(mixed $text, bool $double = true, string|null $charset = null): mixed
Convenience method for htmlspecialchars.
mixed
$text
Text to wrap through htmlspecialchars. Also works with arrays, and objects.
Arrays will be mapped and have all their elements escaped. Objects will be string cast if they
implement a __toString
method. Otherwise, the class name will be used.
Other scalar types will be returned unchanged.
bool
$double
optional
Encode existing html entities.
string|null
$charset
optional
Character set to use when escaping.
Defaults to config value in mb_internal_encoding()
or 'UTF-8'.
mixed
namespaceSplit(string $class): array{0: string, 1: string}
Split the namespace from the classname.
Commonly used like list($namespace, $className) = namespaceSplit($class);
.
string
$class
The full class name, ie Cake\Core\App
.
array{0: string, 1: string}
pathCombine(list<string> $parts, bool|null $trailing = null): string
Combines parts with a forward-slash /
.
Skips adding a forward-slash if either /
or \
already exists.
list<string>
$parts
bool|null
$trailing
optional
Determines how trailing slashes are handled
string
pj(mixed $var): mixed
JSON pretty print convenience function.
In terminals this will act similar to using json_encode() with JSON_PRETTY_PRINT directly, when not run on CLI
will also wrap <pre>
tags around the output of given variable. Similar to pr().
This function returns the same variable that was passed.
mixed
$var
Variable to print out.
mixed
pluginSplit(string $name, bool $dotAppend = false, string|null $plugin = null): array
Splits a dot syntax plugin name into its plugin and class name. If $name does not have a dot, then index 0 will be null.
Commonly used like
list($plugin, $name) = pluginSplit($name);
string
$name
The name you want to plugin split.
bool
$dotAppend
optional
Set to true if you want the plugin to have a '.' appended to it.
string|null
$plugin
optional
Optional default plugin to use if no plugin is found. Defaults to null.
array
pr(mixed $var): mixed
print_r() convenience function.
In terminals this will act similar to using print_r() directly, when not run on CLI
print_r() will also wrap <pre>
tags around the output of given variable. Similar to debug().
This function returns the same variable that was passed.
mixed
$var
Variable to print out.
mixed
stackTrace(array<string, mixed> $options = []): void
Outputs a stack trace based on the supplied options.
depth
- The number of stack frames to return. Defaults to 999args
- Should arguments for functions be shown? If true, the arguments for each method call
will be displayed.start
- The stack frame to start generating a trace from. Defaults to 1array<string, mixed>
$options
optional
Format for outputting stack trace
void
triggerWarning(string $message): void
Triggers an E_USER_WARNING.
string
$message
The warning message.
void
url(Psr\Http\Message\UriInterface|array|string|null $url = null, bool $full = false): string
Convenience wrapper for Router::url().
Psr\Http\Message\UriInterface|array|string|null
$url
optional
An array specifying any of the following: 'controller', 'action', 'plugin' additionally, you can provide routed elements or query string parameters. If string it can be name any valid url string or it can be an UriInterface instance.
bool
$full
optional
If true, the full base URL will be prepended to the result. Default is false.
string
Cake\Core\Exception\CakeException
urlArray(string $path, array $params = []): array
Returns an array URL from a route path string.
string
$path
Route path.
array
$params
optional
An array specifying any additional parameters.
Can be also any special parameters supported by Router::url()
.
array