Dynamically load and create a [Gems|Project]_Agenda_ class

@param string $className
@param mixed $param1
@param mixed $param2
@return object
549741
public function createAgendaClass($className, $param1 = null, $param2 = null)
    {
        $params = func_get_args();
        array_shift($params);

        return $this->_loadClass($className, true, $params);
    }
651629
public function newInstance($className)
    {

        // lock the method
        \Mutex::lock($this->mutex);

        // we're not dispatched
        $this->dispatched = false;

        // initialize the data
        $this->className = $className;

        // notify the thread
        $this->notify();

        // wait till we've dispatched the request
        while ($this->dispatched === false) {
            usleep(100);
        }

        // try to load the last created instance
        if (isset($this->instances[$last = sizeof($this->instances) - 1])) {
            $instance = $this->instances[$last];
        } else {
            throw new \Exception('Requested instance can\'t be created');
        }

        // unlock the method
        \Mutex::unlock($this->mutex);

        // return the created instance
        return $instance;
    }
46791
public static URITemplate createTemplate(Path path, List<Parameter> params, String classNameandPath) {

        return createTemplate(path == null ? null : path.value(), params, classNameandPath);
    }
939552
private function createControllerFromClassName($className)
    {
        // If we can, use the container to build the Controller so that Constructor params can
        // be injected where possible
        if ($this->invoker) {
            return $this->invoker->getContainer()->get($className);
        }

        return new $className;
    }
276019
public function initiateObject($className, $additionalParameters = array(), $shared = false)
    {
        return $this->dependencyInjectionManager->initiateObject($className, $additionalParameters, $shared);
    }
1230228
public function getOrCreate($className, $params = array())
    {
        $key = $className . join('-', $params);

        if (isset($this->mapping[$key])) {
            return $this->mapping[$key];
        }

        if (method_exists($this, $this->getMethodName($className))) {
            $callback = array($this, $this->getMethodName($className));
            $instance =  call_user_func_array($callback, $params);
        } else {
            $instance = new $className;
        }

        return $this->mapping[$key] = $instance;
    }
521221
private function getPropertyInfo(string $propertyName, string $className): stdClass
    {
        foreach ($this->getProperties($className) as $property) {
            if ($property->{'hydra:title'} === $propertyName) {
                return $property;
            }
        }

        throw new \InvalidArgumentException(sprintf('Property "%s" of class "%s" does\'nt exist', $propertyName, $className));
    }
122496
public function create(string $projectKey, string $name, array $params = [])
    {
        $params['name'] = $name;

        $response = $this->httpPost(sprintf('/api/v2/projects/%s/keys', $projectKey), $params);

        if (!$this->hydrator) {
            return $response;
        }

        if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 201) {
            $this->handleErrors($response);
        }

        return $this->hydrator->hydrate($response, KeyCreated::class);
    }
981333
protected function getInstance($classname, $params)
    {
        $components = UIComponentsRegistry::get('ui-components');
        if (is_null($components)) {
            return false;
        }
        $object = $components->first(function ($value, $key) use($classname) {
            return $value instanceof $classname;
        });
        if (!$object) {
            return false;
        }

        $attributes       = array_only(array_get($params, 'data'), ['x', 'y', 'width', 'height', 'disabled', 'id']);
        $attributes['id'] = isset($params['id']) ? $params['id'] : null;

        $object->setAttributes($attributes);
        return $object;
    }
167948
private static function createObject($className, array $args = null)
    {
        try {
            if (!$args) {
                return new $className;
            } else {
                $c = new \ReflectionClass($className);
                return $c->newInstanceArgs($args);
            }
        } catch (\Exception $e) {
            throw new RuntimeException($e->getMessage(), $e->getCode(), $e);
        }
    }
1031704
protected function loadMetadata($className)
    {
        $resource = new ResourceMetadata($className);

        $this->driver->loadMetadataForClass($className, $resource);

        $this->loadedMetadata[$className] = $resource;
        $this->resourceClassMap[$resource->getName()] = $className;
    }
246958
public function create($className)
    {
        $builder = new Builder($className, $this);
        $this->getGuesser()->fill($builder);
        return $builder;
    }
300027
public function seed($className, $params)
    {
        $blueprint = new Blueprint();
        $consequence = $params;
        $class = $className;

        if (is_array($params))
        {
            if (empty($params['do']))
            {
                throw new \InvalidArgumentException('Fixture template not supplied.');
            }

            if ( ! empty($params['class']))
            {
                $class = $params['class'];
            }

            $consequence = $params['do'];
        }

        // Work that blueprint!
        $consequence($blueprint);

        $factory = new Factory($class, $blueprint);
        $this->repository->add($className, $factory);
    }
604630
public function addClass( $className, $parameters = array() )
	{
		$object	= Alg_Object_Factory::createObject( $className, $parameters );
		$this->addObject( $object );
	}
848011
public function loadMetadataForClass($className, ClassMetadata $metadata)
    {
        if (!\in_array(DatabaseEntityInterface::class, \class_implements($className))) {
            $repositoryName = $this->entityRepositoryMapping->getRepositoryByEntity($className);
            $instantiator = new Instantiator();

            /** @var RepositoryInterface $repository */
            $repository = $instantiator->instantiate($repositoryName);
            $classMetaDataBuilder = new ClassMetadataBuilder($metadata);
            $repository->loadMetadata($classMetaDataBuilder);

            return;
        }

        $classMetaDataBuilder = new ClassMetadataBuilder($metadata);
        $className::loadMetadata($classMetaDataBuilder);
    }
487240
public function hasSharedInstanceWithParameters($classOrAlias, array $params, $returnFastHashLookupKey = false)
        {
            ksort($params);
            $hashKey = $this->createHashForKeys($classOrAlias, array_keys($params));
            if (isset($this->sharedInstancesWithParams['hashShort'][$hashKey])) {
                $hashValue = $this->createHashForValues($classOrAlias, $params);
                if (isset($this->sharedInstancesWithParams['hashLong'][$hashKey . '/' . $hashValue])) {
                    return ($returnFastHashLookupKey) ? $hashKey . '/' . $hashValue : true;
                }
            }

            return false;
        }
548155
public function queueFilterSubtables($className, $parameters = array())
    {
        foreach ($this->getDataTables() as $table) {
            $table->queueFilterSubtables($className, $parameters);
        }
    }