Returns a reference to a JCategories object

@param   string  $extension  Name of the categories extension
@param   array   $options    An array of options

@return  JCategories         JCategories object

@since   11.1
172941
public static function getInstance($extension, $options = array())
	{
		$hash = md5($extension . serialize($options));

		if (isset(self::$instances[$hash]))
		{
			return self::$instances[$hash];
		}

		$parts = explode('.', $extension);
		$component = 'com_' . strtolower($parts[0]);
		$section = count($parts) > 1 ? $parts[1] : '';
		$classname = ucfirst(substr($component, 4)) . ucfirst($section) . 'Categories';

		if (!class_exists($classname))
		{
			$path = JPATH_SITE . '/components/' . $component . '/helpers/category.php';

			if (is_file($path))
			{
				include_once $path;
			}
			else
			{
				return false;
			}
		}

		self::$instances[$hash] = new $classname($options);

		return self::$instances[$hash];
	}
1078620
public function getContents(array $options=array()){
		$options['quality']=isset($options['quality'])?$options['quality']:80;
		ob_start();
		@imagejpeg($this->resource,null,$options['quality']);
		return ob_get_clean();
	}
361161
public static function checkExtList(array $extensions = [])
    {
        $allTotal = [];

        foreach ($extensions as $extension) {
            if (!\extension_loaded($extension)) {
                $allTotal['no'][] = $extension;
            } else {
                $allTotal['yes'][] = $extension;
            }
        }

        return $allTotal;
    }
704915
public function findAllClasses($extension)
    {
        $classes = array();
        foreach ($this->dirs as $prefix => $dir) {
            $nsPrefix = $prefix !== '' ? $prefix.'\\' : '';

            $collection = $this->repository->find($dir.'/**/*.'.$extension);
            if ($collection->isEmpty()) {
                continue;
            }

            /** @var FileResource $resource */
            foreach ($collection as $resource) {
                $classes[] = $nsPrefix.str_replace('.', '\\', pathinfo($resource->getName(), PATHINFO_FILENAME));
            }
        }

        return $classes;
    }
1202800
public function possibleAggregateTypesForExtension($extension)
    {
        $types = [];
        foreach ($this->config['aggregate_types'] as $type => $attributes) {
            if (in_array($extension, $attributes['extensions'])) {
                $types[] = $type;
            }
        }

        return $types;
    }
874205
public function publish($extension, $options = null, $before = [])
    {
        $files = $this->files($extension, $options, $before);
        return $this->publishAndPropagate($files, null, $before);
    }
57086
protected function retrievePaginatedListing(array $options)
    {
        $resultPaginator = $this->s3Client->getPaginator('ListObjects', $options);
        $listing = [];

        foreach ($resultPaginator as $result) {
            $listing = array_merge($listing, $result->get('Contents') ?: [], $result->get('CommonPrefixes') ?: []);
        }

        return $listing;
    }
1200689
public function findFileList(string $extension) : array
    {
        if (!$this->isDir() || !$this->exists()) {
            return [];
        }

        $result = [];
        foreach ($this->scanDir() as $file) {
            if ($file->isDir()) {
                $result = array_merge($result, $file->findFileList($extension));
                continue;
            }
            if ($file->hasExtension($extension)) {
                $result[] = $file;
            }
        }
        return $result;
    }
1209235
public function withExtensions(Extensions $extensions): self
    {
        $obj = clone $this;
        $obj->_extensions = $extensions;
        return $obj;
    }
562703
public function loadExtension(Extension $extension, array $options = [], $safe = false)
    {
        $this->fire('f.extension.load', $extension, $options, $safe);

        return $this;
    }
335002
public function getCollectionInfo(array $options = [])
    {
        $includeSystemCollections = false;
        // The includeSystemCollections option is no longer supported in the command
        if (isset($options['includeSystemCollections'])) {
            $includeSystemCollections = $options['includeSystemCollections'];
            unset($options['includeSystemCollections']);
        }

        try {
            $collections = $this->db->listCollections($options);
        } catch (\MongoDB\Driver\Exception\Exception $e) {
            throw ExceptionConverter::toLegacy($e);
        }

        $getCollectionInfo = function (CollectionInfo $collectionInfo) {
            // @todo do away with __debugInfo once https://jira.mongodb.org/browse/PHPLIB-226 is fixed
            $info = $collectionInfo->__debugInfo();

            return array_filter(
                [
                    'name' => $collectionInfo->getName(),
                    'type' => isset($info['type']) ? $info['type'] : null,
                    'options' => $collectionInfo->getOptions(),
                    'info' => isset($info['info']) ? (array) $info['info'] : null,
                    'idIndex' => isset($info['idIndex']) ? (array) $info['idIndex'] : null,
                ],
                function ($item) {
                    return $item !== null;
                }
            );
        };

        $eligibleCollections = array_filter(
            iterator_to_array($collections),
            $this->getSystemCollectionFilterClosure($includeSystemCollections)
        );

        return array_map($getCollectionInfo, $eligibleCollections);
    }
416624
public function getCategoryOptions($category_model, array $options)
    {
        $options += array(
            'status' => 1,
            'parent_id' => 0,
            'hierarchy' => true
        );

        $categories = $category_model->getTree($options);

        if (empty($categories)) {
            return array();
        }

        $list = array();
        foreach ($categories as $category) {

            $title = $category['title'];

            if (!empty($options['hierarchy'])) {
                $title = str_repeat('— ', $category['depth']) . $title;
            }

            $list[$category['category_id']] = $title;
        }

        return $list;
    }
1136181
public function toMimeType($extension)
    {
        $extension = strtolower($extension);

        if (array_key_exists($extension, $this->dict)) {
            return $this->dict[$extension];
        }
    }
1021137
public function getName(array $options = array())
    {
        $result = "";
        foreach ($this->getUnitedTypes() as $type)
        {
            if ($result !== "")
                $result .= "|";
            $result .= $type->getName();
        }
        return $result;
    }
611404
public static function addSubmenu($extension)
	{
		// Avoid nonsense situation.
		if ($extension == 'com_categories')
		{
			return;
		}

		$parts = explode('.', $extension);
		$component = $parts[0];

		if (count($parts) > 1)
		{
			$section = $parts[1];
		}

		// Try to find the component helper.
		$eName = str_replace('com_', '', $component);
		$file = JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component . '/helpers/' . $eName . '.php');

		if (file_exists($file))
		{
			require_once $file;

			$prefix = ucfirst(str_replace('com_', '', $component));
			$cName = $prefix . 'Helper';

			if (class_exists($cName))
			{
				if (is_callable(array($cName, 'addSubmenu')))
				{
					$lang = JFactory::getLanguage();

					// Loading language file from the administrator/language directory then
					// loading language file from the administrator/components/*extension*/language directory
					$lang->load($component, JPATH_BASE, null, false, true)
					|| $lang->load($component, JPath::clean(JPATH_ADMINISTRATOR . '/components/' . $component), null, false, true);

					call_user_func(array($cName, 'addSubmenu'), 'categories' . (isset($section) ? '.' . $section : ''));
				}
			}
		}
	}
565554
protected function optionsToRaw(array $options)
    {
        $collections = [];

        foreach ($options as $lang => $labels) {
            $finalWithTranslations = [];
            foreach ($labels as $label) {
                if ($label->isPlain) {
                    $collections[$label->value] = $label->text;
                } else {
                    $collections[$label->lang][$label->value] = $label->text;
                }
            }
        }

        $finals = [];

        foreach ($collections as $value => $collection) {
            $finals[$value] = is_array($collection) ? (object) $collection : $collection;
        }

        return (object) $finals;
    }
528053
public function to($format, array $options = []) {
		$this->offsetGet(null);
		return parent::to($format, $options);
	}