/**
  * Creates a new instance using an array of parameters.
  *
  * @param array $args Array of constructor parameters
  * @return object
  * @throws \TokenReflection\Exception\RuntimeException If the required class does not exist.
  */
 public function newInstanceArgs(array $args = array())
 {
     if (!class_exists($this->name, true)) {
         throw new Exception\RuntimeException('Could not create an instance of class; class does not exist.', Exception\RuntimeException::DOES_NOT_EXIST, $this);
     }
     $reflection = new InternalReflectionClass($this->name);
     return $reflection->newInstanceArgs($args);
 }
 /**
  * @param TokenReflection\ReflectionClass|TokenReflection\Invalid\ReflectionClass $ref
  */
 private function loadParentClassesAndInterfacesFromClassReflection($ref)
 {
     foreach (array_merge($ref->getParentClasses(), $ref->getInterfaces()) as $parentName => $parentReflection) {
         /** @var TokenReflection\ReflectionClass $parentReflection */
         if ($parentReflection->isInternal()) {
             if (!isset($this->allClasses[self::INTERNAL_CLASSES][$parentName])) {
                 $this->allClasses[self::INTERNAL_CLASSES][$parentName] = $parentReflection;
             }
         } elseif (!$parentReflection->isTokenized()) {
             if (!isset($this->allClasses[self::NONEXISTENT_CLASSES][$parentName])) {
                 $this->allClasses[self::NONEXISTENT_CLASSES][$parentName] = $parentReflection;
             }
         }
     }
 }