@param string $class
@param string $name

@return \Claroline\CoreBundle\Entity\Resource\AbstractResource

@throws WrongClassException
543179
public function createResource($class, $name)
    {
        $entity = new $class();

        if ($entity instanceof AbstractResource) {
            $entity->setName($name);

            return $entity;
        }

        throw new WrongClassException(
            "{$class} doesn't extend Claroline\\CoreBundle\\Entity\\Resource\\AbstractResource."
        );
    }
1039995
public function api(string $name): API\AbstractAPI
    {
        $name = ucfirst($name);
        $class = "ArkEcosystem\\Client\\API\\{$name}";

        if (! class_exists($class)) {
            throw new RuntimeException("Class [$class] does not exist.");
        }

        return new $class($this);
    }
352378
protected function instantiateClass($class)
    {
        try {
            $instance = app($class);

        } catch (BindingResolutionException $e) {

            throw new InvalidArgumentException(
                "Failed to instantiate Module or ModuleGenerator instance for '{$class}'",
                $e->getCode(),
                $e
            );

        } catch (ReflectionException $e) {

            throw new InvalidArgumentException(
                "Failed to instantiate Module or ModuleGenerator instance for '{$class}'",
                $e->getCode(),
                $e
            );
        }

        if (    ! ($instance instanceof ModuleInterface)
            &&  ! ($instance instanceof ModuleGeneratorInterface)
        ) {
            throw new InvalidArgumentException(
                "Expected ModuleInterface or ModuleGeneratorInterface, got '{$class}'"
            );
        }

        return $instance;
    }
442929
protected function buildClass($name)
    {
        $className = $this->formatClassName($name);

        if (!class_exists($className)) {
            throw new RuntimeException('Enum '.$className.' is not exists');
        }

        $enum = new $className();
        if (!$enum instanceof Enumable) {
            throw new RuntimeException('Enum '.$className.' is not instance of '.Enumable::class);
        }

        return $enum;
    }
1161502
protected function loadProcessor($class, $name)
    {
        if (!class_exists($class) && !function_exists($class)) {
            try {
                $this->getCore()->getLoader()->loadPlugin($name);
            }
            catch (Exception $e) {
                throw new Exception('Processor ' . $name . ' could not be found in your plugin directories, please ensure it is in a file named ' . $name . '.php in the plugin directory');
            }
        }

        if (class_exists($class)) {
            return array(new $class($this), 'process');
        }

        if (function_exists($class)) {
            return $class;
        }

        throw new Exception('Wrong processor name, when using autoload the processor must be in one of your plugin dir as "name.php" containg a class or function named "Dwoo_Processor_name"');
    }
1178206
public function getPropertyValue($class, $name)
    {
        $property = $this->findProperty($class, $name);
        $property->setAccessible(true);

        return $property->getValue(is_object($class) ? $class : null);
    }
1259708
public function addController(string $name, $class = null, $option = null)
    {
        return $this->controller($name, $class, $option);
    }
54463
protected function resolveClass($class, $path, $namespace)
    {
        $file = realpath(rtrim($path, '/') . '/' . $class . '.php');
        if (! file_exists($file)) {
            return $this->exception($class . ' class is not found. Please, check file.');
        }

        require_once($file);
        $class = $namespace . str_replace('/', '\\', $class);

        return new $class();
    }
461862
public static function createEmbedOne(string $name, string $class): DenormalizationFieldMappingBuilderInterface
    {
        $self = new self($name);
        $self->fieldDenormalizer = new EmbedOneFieldDenormalizer($class, new PropertyAccessor($name));

        return $self;
    }
852718
public function add($name, $class)
    {
        $ref = new ReflectionClass($class);
        if ($ref->isSubclassOf('Phalcon\Config') === false) {
            throw new NotFoundTrueParentClassException(
                $class . ' is\'t subclass of Phalcon/Config'
            );
        }
        $this->adapters[$name] = $class;
    }
1180499
public function whenCreating($class)
    {
        if (!isset($this->args[$class])) {
            $this->args[$class] = new ClassMeta($class, $this);
        }

        return $this->args[$class];
    }
55787
protected function createActor($class, $name)
    {
        $actor = Pool::getInstance()->get($class);
        $actor->initialization($name);
        $this->addChild($actor);
        return $actor;
    }
1055027
private function getClassFor($name)
    {
        $test = strtolower($name);
        foreach ($this->types as $class => $matchers) {
            foreach ($matchers as $matcher) {
                if ($test === $matcher) {
                    return $class;
                }
            }
        }
        return $this->genericType;
    }
796523
public function required($name, $class = null)
    {
        if (! isset($this->$name)) {
            throw new InvalidModuleException('Undefined module: ' . $name . ', required by ' . Utilities::getCaller());
        }
        if (isset($class) and !Utilities::isSubclassOf($this->$name, $class)) {
            throw new InvalidModuleException(
                'The module "' . $name . '" of type ' . get_class($this->$name)
                . ' was expected by ' . Utilities::getCaller()
                . ' to be of type ' . $class
            );
        }
    }
491974
public static function createEmbedMany(string $name, string $class): DenormalizationFieldMappingBuilderInterface
    {
        $self = new self($name);
        $self->fieldDenormalizer = new EmbedManyFieldDenormalizer($class, new PropertyAccessor($name));

        return $self;
    }
1098101
public function setResourceClass($name)
    {
        $this->_resourceClass = App::className($name, 'Model/Resource');

        if (!$this->_resourceClass) {
            throw new MissingResourceClassException([$name]);
        }

        return $this;
    }
21263
public function loadClass( $class ) {

		if ( ! isset( $this->class_map[ $class ] ) )
			return FALSE;

		return $this->loader->loadFile( $this->class_map[ $class ] );
	}