Returns boolean if ffmpeg is able to decode to this format
@param  string $format ffmpeg format name
@return boolean
192326
public static function canDecode($format)
    {
        // Get an array with all supported encoding formats
        $formats = array_merge(self::getSupportedAudioDecoders(), self::getSupportedVideoDecoders());

        // Return boolean if they can be encoded or not
        if(!in_array($format, $formats)) 
        {
            return false;
        } else  {
            return true;
        }
    }
1221809
protected function escapeUnapplicableFormatChars(string $format) : string
    {
        $validChars      = $this->getValidDateFormatChars();
        $validCharLookup = array_fill_keys($validChars, true);

        $escapedFormat = '';
        $isEscaped     = false;

        foreach (str_split($format) as $char) {
            if ($isEscaped) {
                $escapedFormat .= '\\' . $char;
                $isEscaped = false;
            } elseif ($char === '\\') {
                $isEscaped = true;
            } elseif (isset($validCharLookup[$char])) {
                $escapedFormat .= $char;
            } else {
                $escapedFormat .= '\\' . $char;
            }
        }

        return $escapedFormat;
    }
100170
protected function determineFormat ()
	{
		if ($this->isDataStream === true)
		{
			$this->format = 'STRING';
			return;
		}
		
		$formatInfo = getimagesize($this->fileName);
		
		// non-image files will return false
		if ($formatInfo === false)
		{
			if ($this->remoteImage)
			{
				$this->triggerError('Could not determine format of remote image: ' . $this->fileName);
			}
			else
			{
				$this->triggerError('File is not a valid image: ' . $this->fileName);
			}
			
			// make sure we really stop execution
			return;
		}
		
		$mimeType = isset($formatInfo['mime']) ? $formatInfo['mime'] : null;
		
		switch ($mimeType)
		{
			case 'image/gif':
				$this->format = 'GIF';
				break;
			case 'image/jpeg':
				$this->format = 'JPG';
				break;
			case 'image/png':
				$this->format = 'PNG';
				break;
			default:
				$this->triggerError('Image format not supported: ' . $mimeType);
		}
	}
620180
public function read(string $format = null) : string
    {
        $input = array_shift($this->stack);
        if (isset($format, $input)) {
            $input = sprintf($format, $input);
        }
        return $input ?? '';
    }
1200676
function isMedia($data) {
		// Check for a JPG header.
		if ($data[0] == chr(0xFF) && $data[1] == chr(0xD8)) {
			return TRUE;
		}

		// Check for a MP4 header.
		if ($data[0] == chr(0x00) && $data[1] == chr(0x00)) {
			return TRUE;
		}

		return FALSE;
	}
1081150
public static function valid(string $date, string $format): bool {
        return date($format, strtotime($date)) === $date;

    }
871100
public static function encode( $data, $format )
    {
        if(!in_array($format, self::$supported)) return null;
        $formatter = self::$formatMap[$format];
        return forward_static_call(array($formatter, 'encode'), $data);
    }
905167
public function getDateTimeFormat(string $format='Y-m-d H:i:s')
    {
        $this->setDateTimeZone()->setDateTime();

        return $this->dateTime->format($format);
    }
692973
protected function couldBeSupported(Format\FormatInterface $format)
    {
        return $format instanceof Format\Simple\Arj ||
            $format instanceof Format\Simple\Bz2    ||
            $format instanceof Format\Simple\Cab    ||
            $format instanceof Format\Simple\Chm    ||
            $format instanceof Format\Simple\Cpio   ||
            $format instanceof Format\Simple\Deb    ||
            $format instanceof Format\Simple\Dmg    ||
            $format instanceof Format\Simple\Gz     ||
            $format instanceof Format\Simple\Iso    ||
            $format instanceof Format\Simple\Lzh    ||
            $format instanceof Format\Simple\Lzma   ||
            $format instanceof Format\Simple\Msi    ||
            $format instanceof Format\Simple\Rar    ||
            $format instanceof Format\Simple\Rpm    ||
            $format instanceof Format\Simple\Tar    ||
            $format instanceof Format\Simple\Wim    ||
            $format instanceof Format\Simple\Xz     ||
            $format instanceof Format\Simple\Zip;
    }
1285566
public function formatLocalized($format)
    {
        // Check for Windows to find and replace the %e
        // modifier correctly
        if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
            $format = preg_replace('#(?<!%)((?:%%)*)%e#', '\1%#d', $format);
        }

        return strftime($format, strtotime((string) $this));
    }
430347
public function getCode($format)
    {
        foreach ($this->codes as $code) {
            if ($code->getFormat() == $format) {
                return $code;
            }
        }
    }
721492
public static function registerFormat( $format )
    {
        $object = new $format();
        if(!($object instanceof FormatInterface)) {
            return false;
        }

        foreach ( forward_static_call(array($format, 'getFormats')) as $type ) {
            array_push(self::$supported, $type);
            self::$formatMap[$type] = $format;
        }

        return true;
    }
299595
public function setFormat($format) {
        if ($format === null) {
            $format = [];
        } else if ( ! is_array($format)) {
            $format = [$format];
        }

        $this->format = $format;

        return $this;
    }
314914
protected function checkFormatSupport(Format\FormatInterface $format)
    {
        $samples = $format->getSamples();

        if (false === array_key_exists(Format\FormatInterface::SAMPLE_REGULAR, $samples)) {
            return false;
        }

        if (false === file_exists($samples[Format\FormatInterface::SAMPLE_REGULAR])) {
            return false;
        }

        $exitCode = $this->executeCommand('7z t '.$samples[Format\FormatInterface::SAMPLE_REGULAR]);

        return 0 === $exitCode;
    }
755936
public function getMimeType($format)
    {
        if (null === static::$formats) {
            static::initializeFormats();
        }

        return isset(static::$formats[$format]) ? static::$formats[$format][0] : null;
    }
948290
public static boolean isSupportedFormat(String format) {
	for (int i=0;i<MSExcelWriter.VALID_FORMAT.length;i++) {
		if (VALID_FORMAT[i].equals(format)) {
			return true;
		}
	}
return false;
}
1201178
public function getFormatImagineSaveOptions($format)
    {
        $format = $this->normalizeFormat($format);
        $result = [
            'format' => $format,
        ];
        switch ($format) {
            case static::FORMAT_PNG:
                $result['png_compression_level'] = $this->getDefaultPngCompressionLevel();
                break;
            case static::FORMAT_JPEG:
                $result['jpeg_quality'] = $this->getDefaultJpegQuality();
                break;
        }

        return $result;
    }