protected function getInstanceForClass($class, $args = array()) { if (empty($args)) { return new $class(); } $cls = new ReflectionClass($class); return $cls->newInstanceArgs($args); }