7 $classNameWithNamespace = get_class($object);
8 return substr($classNameWithNamespace, strrpos($classNameWithNamespace,
'\\')+1);
12 $object=
new $classname();
13 $class = new \ReflectionClass($classname);
14 $methods=$class->getMethods(\ReflectionMethod::IS_PUBLIC);
15 foreach ($methods as $method){
16 $name=$method->getName();
19 $value=
"__".$property.
"__";
21 if($class->getProperty($property)!==
null){
22 \call_user_func_array([$object,$name],[$value]);
24 }
catch(\Exception $e){
32 public static function callMethod($object,$callback,array $values){
33 return \call_user_func_array([$object,$callback],$values);
36 public static function getterName($propertyName,$prefix=
"get"){
37 return $prefix.\ucfirst($propertyName);
41 foreach ($array as $key=>$value){
42 if(\method_exists($object, $methodPrefix.\ucfirst($key))){
43 \call_user_func([$object,$methodPrefix.\ucfirst($key)],$value);
static jsonObject($classname)
static callMethod($object, $callback, array $values)
static shortClassName($object)
static getterName($propertyName, $prefix="get")
static callMethodFromAssociativeArray($object, $array, $methodPrefix="add")
static startswith($hay, $needle)
static replaceAtFirst($subject, $from, $to)