| Conditions | 5 |
| Paths | 6 |
| Total Lines | 18 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | public static function jsonObject($classname){ |
||
| 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(); |
||
| 17 | if(JString::startswith($name, "set")){ |
||
| 18 | $property=\strtolower(JString::replaceAtFirst($name, "set", "")); |
||
| 19 | $value="__".$property."__"; |
||
| 20 | try{ |
||
| 21 | if($class->getProperty($property)!==null){ |
||
| 22 | \call_user_func_array([$object,$name],[$value]); |
||
| 23 | } |
||
| 24 | }catch(\Exception $e){} |
||
|
|
|||
| 25 | } |
||
| 26 | } |
||
| 27 | return $object; |
||
| 28 | } |
||
| 29 | |||
| 33 | } |