Get extension - returns string containing a extension associated with $type
Example:
$ext = $mime->get_extension('application/postscript');
if ($ext) echo $ext;
@param string $type
@return string false if $type not found
516058
function get_extension($type)
    {
        $type = strtolower($type);
        foreach ($this->mime_types as $ext => $m_type) {
            if ($m_type == $type) return $ext;
        }
        return false;
    }
309877
function getExtensionPath($type, $name) {
    // Check whether the extension exists, as D8 will throw an error when
    // calling drupal_get_path() for a non-existent extension.
    switch ($type) {
      case 'module':
        if (!\Drupal::moduleHandler()->moduleExists($name)) {
          return;
        }
        break;
      case 'theme':
        if (!\Drupal::service('theme_handler')->themeExists($name)) {
          return;
        }
        break;
      case 'profile':
        // TODO.
        break;
    }

    return drupal_get_path($type, $name);
  }
236271
public function extension(String $type = 'jpeg', Bool $dot = true) : String
    {
        return image_type_to_extension(Helper::toConstant($type, 'IMAGETYPE_'), $dot);
    }
573500
public static function getTypeFromExt($ext) {
        if (isset(self::$_types[$ext])) {
            $mime = self::$_types[$ext];

            if (is_array($mime)) {
                $mime = $mime[0];
            }

            return $mime;
        }

        throw new InvalidArgumentException(sprintf('Invalid extension %s', $ext));
    }
1148264
public static function getCodeByType($type)
    {
        if (isset(self::$typeList[$type])) {
            return self::$typeList[$type];
        } else {
            return false;
        }
    }
1219397
protected function getMimeByExtension($extension)
    {
        if (!isset($this->mimetypes[ $extension ])) {
            $this->addReturn('file_mimes', 'error_mimes', [ ':ext' => $extension ]);

            return false;
        }

        return $this->mimetypes[ $extension ];
    }
487250
public function mimeFromExtension($ext)
    {
        $ext = strtolower($ext);
        if (array_key_exists($ext, self::$mime_types_and_extensions)) {
            return self::$mime_types_and_extensions[$ext];
        }

        return false;
    }
767435
public static function getGenericTypeText($type)
    {
        switch ($type) {
            case static::T_IMAGE:
                return t('Image');
                break;
            case static::T_VIDEO:
                return t('Video');
                break;
            case static::T_TEXT:
                return t('Text');
                break;
            case static::T_AUDIO:
                return t('Audio');
                break;
            case static::T_DOCUMENT:
                return t('Document');
                break;
            case static::T_APPLICATION:
                return t('Application');
                break;
            case static::T_UNKNOWN:
                return t('File');
                break;

        }
    }
242312
public static function getType($type)
    {
        $type = strtolower($type);

        if (!isset(static::$typeMapping[$type])) {
            return $type;
        }

        return static::$typeMapping[$type];
    }
206615
public static function get($path)
    {
        $ext = strtolower(pathinfo($path, PATHINFO_EXTENSION));
        if (!isset(self::$fileTypes[$ext])) {
            return false;
        }
        return self::$fileTypes[$ext];
    }
1004720
public static function getArrayType(string $type): ?string
    {
        if (substr($type, -2) !== '[]' || strlen($type) === 2) {
            return null;
        }

        return substr($type, 0, -2);
    }
1343628
function extension (type) {
  if (!type || typeof type !== 'string') {
    return false
  }

  // TODO: use media-typer
  var match = EXTRACT_TYPE_REGEXP.exec(type)

  // get extensions
  var exts = match && exports.extensions[match[1].toLowerCase()]

  if (!exts || !exts.length) {
    return false
  }

  return exts[0]
}
550828
public function get($type = FALSE)
  {
    $result = $this->peek($type);
	
    $this->clear($type);
	
    return $result;
  }
742309
public static function GetByExtension( string $extension ) : string
   {

      $normalizedExtension = \strtolower( \ltrim( $extension, '.' ) );

      if ( isset( static::$mimeTypes[ $normalizedExtension ] ) )
      {
         return static::$mimeTypes[ $normalizedExtension ];
      }

      return 'application/octet-stream';

   }
277602
def extension_by_source(source, mime_type):
    ""

    # TODO: should get this information from the plugin
    extension = source.plugin_name
    if extension:
        return extension

    if mime_type:
        return mime_type.split("/")[-1]
664522
public function getType(string $type): Type
    {
        if (isset($this->types[$type])) {
            return $this->types[$type];
        }

        $instance = $this->createType($type);
        $this->addType($instance);
        $this->types[$type] = $instance;

        return $instance;
    }
129641
public static function getExtByMimeType(string $type): string
    {
        $value = array_search(strtolower($type), self::getMimeTypes(), true);

        return $value ?: '';
    }