MixedType
class MixedType (View source)
Methods
Converts a value to an array containing this value unless it is an array.
Executes a value depending on what type it is and returns the result Callable: call; return result Instance: call method; return result Class: instantiate; call method; return result Other: return value without taking any action
Check if a value is a valid class name
Create a new instance of the given class.
Normalize a path's slashes according to the current OS.
Ensure path has a trailing slash.
Ensure path does not have a trailing slash.
Details
at line 20
static array
toArray(mixed $argument)
Converts a value to an array containing this value unless it is an array.
This will not convert objects like (array) casting does.
at line 42
static mixed
value(mixed $entity, array $arguments = [], string $method = '__invoke', callable $instantiator = 'static::instantiate')
Executes a value depending on what type it is and returns the result Callable: call; return result Instance: call method; return result Class: instantiate; call method; return result Other: return value without taking any action
at line 69
static boolean
isClass(mixed $class_name)
Check if a value is a valid class name
at line 79
static object
instantiate(string $class_name)
Create a new instance of the given class.
at line 91
static string
normalizePath(string $path, string $slash = DIRECTORY_SEPARATOR)
Normalize a path's slashes according to the current OS.
Solves mixed slashes that are sometimes returned by WordPress core functions.
at line 102
static string
addTrailingSlash(string $path, string $slash = DIRECTORY_SEPARATOR)
Ensure path has a trailing slash.
at line 115
static string
removeTrailingSlash(string $path, string $slash = DIRECTORY_SEPARATOR)
Ensure path does not have a trailing slash.