Contao Utils Bundle

ClassUtil
in package

Table of Contents

Properties

$arrayUtil  : ArrayUtil
$stringUtil  : StringUtil

Methods

__construct()  : mixed
ClassUtil constructor.
callInaccessibleMethod()  : mixed|null
Calls an object's method which is inaccessible.
getChildClasses()  : array<string|int, mixed>
Returns all children of a given class.
getClassesInNamespace()  : array<string|int, mixed>
Returns all classes in the given namespace.
getConstantsByPrefixes()  : array<string|int, mixed>
Filter class constants by given prefixes and return the extracted constants.
getParentClasses()  : array<string|int, mixed>
jsonSerialize()  : array<string|int, mixed>
Serialize a class object to JSON by iterating over all public getters (get(), is(), ...).
getMethodNameStartIndex()  : int|null

Properties

Methods

callInaccessibleMethod()

Calls an object's method which is inaccessible.

public callInaccessibleMethod(mixed $entity, string $method) : mixed|null
Parameters
$entity : mixed
$method : string
Tags
throws
ReflectionException
Return values
mixed|null

getChildClasses()

Returns all children of a given class.

public getChildClasses(string $qualifiedClassName) : array<string|int, mixed>
Parameters
$qualifiedClassName : string
Return values
array<string|int, mixed>

getClassesInNamespace()

Returns all classes in the given namespace.

public getClassesInNamespace(string $namespace) : array<string|int, mixed>
Parameters
$namespace : string
Return values
array<string|int, mixed>

getConstantsByPrefixes()

Filter class constants by given prefixes and return the extracted constants.

public getConstantsByPrefixes(string $class[, array<string|int, mixed> $prefixes = [] ][, bool $returnValueAsKey = true ]) : array<string|int, mixed>
Parameters
$class : string

the class that should be searched for constants in

$prefixes : array<string|int, mixed> = []

an array of prefixes that should be used to filter the class constants

$returnValueAsKey : bool = true

boolean Return the extracted array keys from its value, if true

Tags
throws
ReflectionException
Return values
array<string|int, mixed>

the extracted constants as array

getParentClasses()

public getParentClasses(string $class[, array<string|int, mixed> $parents = [] ]) : array<string|int, mixed>
Parameters
$class : string
$parents : array<string|int, mixed> = []
Return values
array<string|int, mixed>

jsonSerialize()

Serialize a class object to JSON by iterating over all public getters (get(), is(), ...).

public jsonSerialize(mixed $object[, array<string|int, mixed> $data = [] ][, array<string|int, mixed> $options = [] ]) : array<string|int, mixed>
Parameters
$object : mixed
$data : array<string|int, mixed> = []
$options : array<string|int, mixed> = []
Tags
throws
ReflectionException

if the class or method does not exist

Return values
array<string|int, mixed>

getMethodNameStartIndex()

private static getMethodNameStartIndex(mixed $method, ReflectionClass $rc) : int|null
Parameters
$method : mixed
$rc : ReflectionClass
Return values
int|null

        
On this page

Search results