Example #1
0
 /**
  * @param array  $data
  * @param object $object
  */
 public static function apply(array $data, $object)
 {
     $that = new self();
     if (!is_object($object)) {
         throw new InvalidArgumentException('The second parameter must be an object.');
     }
     $data = $that->formalize($data);
     $reflObject = new \ReflectionObject($object);
     $reflMethods = $reflObject->getMethods(\ReflectionMethod::IS_PUBLIC);
     foreach ($reflMethods as $method) {
         $that->callMethod($object, $method, $data);
     }
     return $object;
 }