class Code
Code helper
As for all helpers, all methods are statics.
For convenience, the best practice is to use:
use Library\Helper\Code as CodeHelper;
Constants
NAMESPACE_SEPARATOR |
|
COMPOSER_AUTOLOADER_CLASSNAME |
|
COMPOSER_COMMON_NAMESPACES_AUTOLOADER |
|
Methods
static string |
getPropertyName(string $name)
Transforms a property name from CamelCase to underscored |
|
static string |
getPropertyMethodName(string $name)
Transform a property name from underscored to CamelCase used in magic method names |
|
static bool |
impelementsInterface(string|object $class_name, string $interface_name)
Check if a class implements a certain interface |
|
static bool |
implementsInterface(string|object $class_name, string $interface_name)
Check if a class implements a certain interface |
|
static bool |
extendsClass(string|object $class_name, string $mother_name)
Check if a class extends a certain class |
|
static bool |
isClassInstance(object $object, string $class_name)
Check if a an object is an instance of a class |
|
static bool |
namespaceExists(string $namespace)
Test if a namespace can be found in declared classes or via Composer autoloader if so This method will search concerned namespace in PHP declared classes namespaces and, if found, in a Composer namespaces mapping usually stored in |
|
static mixed |
fetchArguments(string $method_name = null, mixed $arguments = null, string $class_name = null, array $logs = array())
Launch a function or class's method fetching it arguments according to its declaration |
|
static mixed |
organizeArguments(string $method_name = null, mixed $arguments = null, string $class_name = null, array $logs = array())
Organize an array of arguments to pass to a function or class's method according to its declaration |
|
static string |
dumpClosure(Closure $c)
|
Details
at line 50
static public string
getPropertyName(string $name)
Transforms a property name from CamelCase to underscored
at line 62
static public string
getPropertyMethodName(string $name)
Transform a property name from underscored to CamelCase used in magic method names
at line 74
static public bool
impelementsInterface(string|object $class_name, string $interface_name)
Check if a class implements a certain interface
at line 87
static public bool
implementsInterface(string|object $class_name, string $interface_name)
Check if a class implements a certain interface
at line 107
static public bool
extendsClass(string|object $class_name, string $mother_name)
Check if a class extends a certain class
at line 126
static public bool
isClassInstance(object $object, string $class_name)
Check if a an object is an instance of a class
at line 161
static public bool
namespaceExists(string $namespace)
Test if a namespace can be found in declared classes or via Composer autoloader if so This method will search concerned namespace in PHP declared classes namespaces and, if found, in a Composer namespaces mapping usually stored in vendor/composer/autoload_namespaces.php
, searching for a directory that should contains the nameapace following the FIG standards.
at line 226
static public mixed
fetchArguments(string $method_name = null, mixed $arguments = null, string $class_name = null, array $logs = array())
Launch a function or class's method fetching it arguments according to its declaration
at line 258
static public mixed
organizeArguments(string $method_name = null, mixed $arguments = null, string $class_name = null, array $logs = array())
Organize an array of arguments to pass to a function or class's method according to its declaration
Undefined arguments will be fetched with their default value if available or null
otherwise.
If $arguments
is not an array, the method will search for the first argument with
no default value and define it on the $arguments
value.
at line 336
static public string
dumpClosure(Closure $c)