Create a library instance based on given library name.

@param string $library Name of the library. Supported libraries are gd, imagick and gmagick.

@return \Imagine\Gd\Imagine|\Imagine\Gmagick\Imagine|\Imagine\Imagick\Imagine
@throws ImagineException
515196
private function getLibraryInstance($library)
    {
        switch ($library) {
            case 'gd':
                return new \Imagine\Gd\Imagine();
                break;

            case 'imagick':
                return new \Imagine\Imagick\Imagine();
                break;

            case 'gmagick':
                return new \Imagine\Gmagick\Imagine();
                break;

            default:
                throw new ImagineException('Unsupported image library "' . $library . '". Cannot create Imagine instance.'
                );
                break;
        }
    }
728275
public function create($data)
    {
        $functionDescriptor = new FunctionDescriptor();

        $this->mapReflectorPropertiesOntoDescriptor($data, $functionDescriptor);
        $this->assembleDocBlock($data->getDocBlock(), $functionDescriptor);
        $this->addArgumentsToFunctionDescriptor($data->getArguments(), $functionDescriptor);

        return $functionDescriptor;
    }
147728
public function load($library)
    {
        if ($this->_compatibleMode
            && array_key_exists($library, $this->_compatible)
        ) {
            $library = $this->_compatible[$library];
        }
        $library = "\\ArUtil\\I18N\\$library";
        $this->myFile  = $library;
        $this->myClass = $library;
        $class         = $library;

//        if (!$this->_useAutoload) {
//            include_once self::getClassFile($this->myFile);
//        }

        if (!isset($this->myObject)) {
            $this->myObject = new $class();
        }
        
        $this->{$library} = &$this->myObject;
    }
123676
function addLib($name) {
        if (isset($this->_libs[$name])) return;
        if (isset(self::$libs[$name])) {
            $this->_libs[$name] = true;
            $this->addFromArray(self::$libs[$name]);
        }
    }
1087838
public function create($data)
    {
        $constantDescriptor = new ConstantDescriptor();
        $constantDescriptor->setName($data->getShortName());
        $constantDescriptor->setValue($data->getValue());
        // Reflection library formulates namespace as global but this is not wanted for phpDocumentor itself
        $constantDescriptor->setNamespace(
            '\\' . (strtolower($data->getNamespace()) == 'global' ? '' :$data->getNamespace())
        );
        $constantDescriptor->setFullyQualifiedStructuralElementName(
            (trim($constantDescriptor->getNamespace(), '\\') ? $constantDescriptor->getNamespace() : '')
            . '\\' . $data->getShortName()
        );

        $this->assembleDocBlock($data->getDocBlock(), $constantDescriptor);

        $constantDescriptor->setLine($data->getLinenumber());

        return $constantDescriptor;
    }
622853
public function getLibrary($sName)
    {
        try
        {
            $library = $this->di[$sName];
        }
        catch(\Exception $e)
        {
            $library = null;
        }
        return $library;
    }
830152
public static function get(string $type): ImagineInterface
    {
        switch ($type) {
            case self::GD:
                return new GdImagine();
            case self::IMAGICK:
                return new ImagickImagine();
            case self::GMAGICK:
                return new GmagickImagine();
            default:
                throw new InvalidConfigException(sprintf('Image driver %s not found.', $type));
        }
    }
249179
private function _getImagine(OutputInterface $output)
    {
        // Use Imagick extension by default
        if (extension_loaded('imagick') && class_exists("Imagick"))
        {
            $output->writeln('Imagick library is used!');
            return new \Imagine\Imagick\Imagine();
        }
        // fall back to GD
        if (extension_loaded('gd') && function_exists('gd_info'))
        {
            $output->writeln('GD library is used!');
            return new \Imagine\Gd\Imagine();
        }
        // Quit if can not find both extensions
        $output->writeln("<error>The `imagick` or `gd` extension must be loaded to generate image</error>");
        exit(1);
    }
564244
public static function create( $name = null, $driver = 'file' ) 
	{
		if ( is_null( $name ) ) 
		{
			return new static( null, $driver );
		}
		
		if ( !isset( static::$instances[$name] ) ) 
		{
			static::$instances[$name] = new static( $name, $driver );
		}
		
		return static::$instances[$name];
	}
1021228
public static function create($name)
    {
        $serializerClass = 'Dmishh\\SettingsBundle\\Serializer\\' . Container::camelize($name) . 'Serializer';

        if (class_exists($serializerClass)) {
            return new $serializerClass();
        } else {
            $serializerClass = $name;

            if (class_exists($serializerClass)) {
                $serializer = new $serializerClass();
                if ($serializer instanceof SerializerInterface) {
                    return $serializer;
                }
            }
        }

        throw new UnknownSerializerException($serializerClass);
    }
826315
private function createImagineInstance()
    {
        $extension = mb_strtolower(\Craft::$app->getConfig()->getGeneral()->imageDriver);
        
        try {
            if ($extension === 'gd') {
                return new \Imagine\Gd\Imagine();
            }

            if ($extension === 'imagick') {
                return new \Imagine\Imagick\Imagine();
            }
        } catch (RuntimeException $e) {
            // just ignore for now
        }

        return null;
    }
609602
protected static function initializeLibraryPaths($libraryPaths = null)
    {
        static::$libraryPaths = Cache::get('scripting.library_paths', []);
        static::$libraries = Cache::get('scripting.libraries', []);

        //  Add ones from constructor
        $libraryPaths = (is_array($libraryPaths) ? $libraryPaths : []);

        //  Application storage script path
        $libraryPaths[] = storage_path('scripting');

        //  Merge in config libraries...
        $configPaths = \Config::get('df.scripting.paths', []);
        $configPaths = (is_array($configPaths) ? $configPaths : []);
        $libraryPaths = array_merge($libraryPaths, $configPaths);

        //  Add them to collection if valid
        if (is_array($libraryPaths)) {
            foreach ($libraryPaths as $path) {
                if (!in_array($path, static::$libraryPaths)) {
                    if (!empty($path) || is_dir($path) || is_readable($path)) {
                        static::$libraryPaths[] = $path;
                    } else {
                        \Log::debug("Invalid scripting library path given $path.");
                    }
                }
            }
        }

        \Cache::add('scripting.library_paths', static::$libraryPaths, static::DEFAULT_CACHE_TTL);

        if (empty(static::$libraryPaths)) {
            \Log::debug('No scripting library paths found.');
        }
    }
1263679
def get_library_instance(self, library_path, library_name):
        """"""
        if self.is_library_in_libraries(library_path, library_name):
            from rafcon.core.states.library_state import LibraryState
            return LibraryState(library_path, library_name, "0.1")
        else:
            logger.warning("Library manager will not create a library instance which is not in the mounted libraries.")
83130
protected function createImagineInstance()
    {
        $driver = ConfigQuery::read("imagine_graphic_driver", "gd");

        switch ($driver) {
            case 'imagick':
                $image = new ImagickImagine();
                break;

            case 'gmagick':
                $image = new GmagickImagine();
                break;

            case 'gd':
            default:
                $image = new Imagine();
        }

        return $image;
    }
801028
function Library (libfile, funcs, lib) {
  debug('creating Library object for', libfile);

  if (libfile && libfile.indexOf(EXT) === -1) {
    debug('appending library extension to library name', EXT);
    libfile += EXT;
  }

  if (!lib) {
    lib = {};
  }
  const dl = new DynamicLibrary(libfile || null, RTLD_NOW);

  Object.keys(funcs || {}).forEach(function (func) {
    debug('defining function', func);

    const fptr = dl.get(func);
    const info = funcs[func];

    if (fptr.isNull()) {
      throw new Error('Library: "' + libfile
        + '" returned NULL function pointer for "' + func + '"');
    }

    const resultType = info[0];
    const paramTypes = info[1];
    const fopts = info[2];
    const abi = fopts && fopts.abi;
    const async = fopts && fopts.async;
    const varargs = fopts && fopts.varargs;

    if (varargs) {
      lib[func] = VariadicForeignFunction(fptr, resultType, paramTypes, abi);
    } else {
      const ff = ForeignFunction(fptr, resultType, paramTypes, abi);
      lib[func] = async ? ff.async : ff;
    }
  });

  return lib;
}
631072
def get_library(self, library):
        
        if library in self._library_cache:
            return self._library_cache[library]

        try:
            error = None
            lib = ArcticLibraryBinding(self, library)
            lib_type = lib.get_library_type()
        except (OperationFailure, AutoReconnect) as e:
            error = e

        if error:
            raise LibraryNotFoundException("Library %s was not correctly initialized in %s.\nReason: %r)" %
                                           (library, self, error))
        elif not lib_type:
            raise LibraryNotFoundException("Library %s was not correctly initialized in %s." %
                                           (library, self))
        elif lib_type not in LIBRARY_TYPES:
            raise LibraryNotFoundException("Couldn't load LibraryType '%s' for '%s' (has the class been registered?)" %
                                           (lib_type, library))
        instance = LIBRARY_TYPES[lib_type](lib)
        self._library_cache[library] = instance
        # The library official name may be different from 'library': e.g. 'library' vs 'user.library'
        self._library_cache[lib.get_name()] = instance
        return self._library_cache[library]
1163931
public function getUploadUrl(LibraryType $library, bool $newFile = true)
    {
        $url = $this->client->getConfig('base_uri')
            . '/repos/'
            . $library->id
            . '/' . ($newFile ? 'upload' : 'update') . '-link/';

        $response = $this->client->request('GET', $url);
        $uploadLink = (string)$response->getBody();

        return preg_replace("/\"/", '', $uploadLink);
    }