code: public function instantiate($className, array $data = [])
      {
          $refl = new \ReflectionClass($className);
  
          $instanceArgs = [];
  
          if ($data) {
              $instanceArgs = $this->extractArguments($refl->getConstructor()->getParameters(), $data);
          }
  
          return $refl->newInstanceArgs($instanceArgs);
      }
docs: Instantiates the given class with the given data.
  
  @param string $className
  @param array $data
  @return object