@param object|string $class

@return object
@throws TransformerException
549543
public function getObjectInstance($class)
  {
    // Eventbasierte Objekt-Erzeugung
    $event = new ClassBuilderEvent($class);

    // $class enthält bereits ein Objekt
    if ($event->isObject() === true)
    {
      // Vor der Rückgabe an die EventListener/EventSubscriber geben...
      $this->dispatcher->dispatch(TransformerEvents::OBJECT_RETURN_INSTANCE, $event);

      return $event->getObject();
    }

    // $class enthält noch kein Objekt
    if (class_exists($event->getObject()))
    {
      $this->dispatcher->dispatch(TransformerEvents::OBJECT_CREATE_INSTANCE, $event);

      // Wenn in keinem EventListener/EventSubscriber die Instanz erzeugt wurde...
      if ($event->isObject() === false)
      {
        $reflection = new \ReflectionClass($class);

        return $reflection->newInstanceWithoutConstructor();
      }

      // Wenn in einem EventListener/EventSubscriber die Instanz erzeugt wurde...
      return $event->getObject();
    }
    throw new TransformerException(sprintf('Class %s does not exist.', $class));
  }
854601
public function transform($object)
    {
        if (is_object($object) && $object instanceof RestfulModel) {
            $transformed = $this->transformRestfulModel($object);
        } elseif (is_object($object) && $object instanceof \stdClass) {
            $transformed = $this->transformStdClass($object);
        } else {
            throw new \Exception('Unexpected object type encountered in transformer');
        }

        return $transformed;
    }
481550
public function fetchAllObj(string $class = null): array
    {
        if (!$this->wasExecuted()) {
            $this->exec();
        }

        if ($class === null) {
            return $this->getAdapter()->getStatement()->fetchAll(\PDO::FETCH_OBJ);
        } else {
            $objectInstances = [];

            foreach ($this->fetchAll() as $r) {
                $objectInstances[] = new $class($r);
            }

            return $objectInstances;
        }
    }
421449
private static function transformArray(array $json, $class, $callback)
    {
        return array_map(function ($json) use ($class, $callback) {
            return static::transformObject($json, $class, $callback);
        }, $json);
    }
282574
public static function create($class)
    {
        try {
            $reflection = new \ReflectionClass($class);
        } catch (\ReflectionException $e) {
            return false;
        }

        $constructor = $reflection->getConstructor();

        // If there are no parameters, just return a new object.
        if (null === $constructor) {
            return new $class;
        }

        $newInstanceArgs = self::getMethodArgs($constructor);

        // Create a callable for the dataStorage
        return $reflection->newInstanceArgs($newInstanceArgs);
    }
497103
private function getModel($class)
    {
        $reflectionClass = new \ReflectionClass($class);
        $instance = $reflectionClass->newInstance();
        if (!($instance instanceof ModelInterface)) {
            throw new \Exception('This class is not supported');
        }

        return $instance;
    }
1177561
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);
    }
93476
public static function get(string $type): Transform
    {
        $namespace = '\\ModelHistory\\Model\\Transform\\';
        $transformClass = $namespace . Inflector::camelize($type) . 'Transform';
        if (class_exists($transformClass)) {
            return new $transformClass();
        }
        throw new InvalidArgumentException('Transform ' . $transformClass . ' not found!');
    }
898902
public function getRoot(string $class)
    {
        if (!is_a($class, Hierarchy::class, true))
            throw new TypeError("Not a subclass of Hierarchy: $class");

        $root = $class::getRootName();
        return $this->getInstance($class, $root);
    }
860407
protected function getBinding($class)
    {
        if ($this->isCollection($class) && ! $class->isEmpty()) {
            return $this->getBindingFromCollection($class);
        }

        $class = is_object($class) ? get_class($class) : $class;

        if (! $this->hasBinding($class)) {
            throw new RuntimeException('Unable to find bound transformer for "'.$class.'" class.');
        }

        return $this->bindings[$class];
    }
147167
public function get($class) {
		if (isset($this->aliases[$class])) {
			$class = $this->aliases[$class];
		}

		if (isset($this->resolvingClasses[$class])) {
			throw new CyclicDependencyException("Cyclic dependency detected when resolving $class");
		}

		$this->resolvingClasses[$class] = true;

		if (array_key_exists($class, $this->factories)) {
			$instance = $this->getFactory($class);
		} else {
			$instance = $this->getSingleton($class);
		}

		unset($this->resolvingClasses[$class]);

		return $instance;
	}
113412
public function createInstance(string $class)
    {
        $reflection = new \ReflectionClass($class);

        // If the constructor has no parameters, there is no need to resolve them
        $constructor = $reflection->getConstructor();
        if (is_null($constructor)) {
            $this->instances[$class] = new $class;

            return new $class;
        }

        // Resolve the dependencies recursively
        $dependencies = $constructor->getParameters();
        $instances = $this->resolveDependencies($dependencies);

        $o = $reflection->newInstanceArgs($instances);
        $this->instances[$class] = $o;

        return $o;
    }
317887
function bindTo($class)
    {
        if (!is_object($class))
            throw new \Exception(sprintf(
                'Given class must be an object (%s) given.'
                , \Poirot\Std\flatten($class)
            ));

        $this->_t__bindTo = $class;

        return $this;
    }
147595
protected function instance($class)
    {
        $reflection = new \ReflectionClass($class);

        $arguments = array();

        $constructor = $reflection->getConstructor();

        if ($this->container->has($class))
        {
            return $this->container->get($class);
        }

        if ($constructor !== null)
        {
            $arguments = $this->arguments($constructor);
        }

        return $reflection->newInstanceArgs($arguments);
    }
436425
public function inherits($class)
    {
        $delegate = $this->getDelegate();

        if ($delegate instanceof ObjectMixable) {
            $result = $delegate->inherits($class);
        } else {
            $result = $delegate instanceof $class;
        }

        return $result;
    }
955548
protected static function getReflection($class)
    {
        if (!isset(self::$reflections[$class])) {
            self::$reflections[$class] = new ReflectionClass($class);
        }
        $result = self::$reflections[$class];

        return $result;
    }
231414
public static function transform($object, $request)
	{
		$transformer = static::getTransformer($object);
		if (!$transformer) {
			return $object;
		}
		
		return $transformer->transform($object, $request);
	}