code: public function createInstance($class, $args = [])
      {
          if (\in_array('getInstance', get_class_methods($class), true)) {
              return \call_user_func_array([$class, 'getInstance'], $args);
          }
  
          $reflection = new \ReflectionClass($class);
  
          return $reflection->newInstanceArgs($args);
      }
docs: {@inheritdoc}