original_string: public static function getInstance($class)
      {
          $reflection = new ReflectionClass($class);
          $constructor = $reflection->getConstructor();
  
          if (empty($constructor)) {
              return new $class;
          }
  
          $parameters = $constructor->getParameters();
  
          if (empty($parameters)) {
              return new $class;
          }
  
          $dependencies = array();
          foreach ($parameters as $parameter) {
              $parameter_class = $parameter->getClass();
              $dependencies[] = static::get($parameter_class->getName());
          }
  
          return $reflection->newInstanceArgs($dependencies);
      }
code: public static function getInstance($class)
      {
          $reflection = new ReflectionClass($class);
          $constructor = $reflection->getConstructor();
  
          if (empty($constructor)) {
              return new $class;
          }
  
          $parameters = $constructor->getParameters();
  
          if (empty($parameters)) {
              return new $class;
          }
  
          $dependencies = array();
          foreach ($parameters as $parameter) {
              $parameter_class = $parameter->getClass();
              $dependencies[] = static::get($parameter_class->getName());
          }
  
          return $reflection->newInstanceArgs($dependencies);
      }
code_tokens: public static function getInstance ( $ class ) { $ reflection = new ReflectionClass ( $ class ) ; $ constructor = $ reflection -> getConstructor ( ) ; if ( empty ( $ constructor ) ) { return new $ class ; } $ parameters = $ constructor -> getParameters ( ) ; if ( empty ( $ parameters ) ) { return new $ class ; } $ dependencies = array ( ) ; foreach ( $ parameters as $ parameter ) { $ parameter_class = $ parameter -> getClass ( ) ; $ dependencies [ ] = static :: get ( $ parameter_class -> getName ( ) ) ; } return $ reflection -> newInstanceArgs ( $ dependencies ) ; }
docstring: Returns an instance using a class name
  @param string $class
  @return object
docstring_tokens: Returns an instance using a class name