protected static function getFileTypeByExtension(string $extension): int
    {
        switch ($extension) {
            case 'png':
            case 'jpg':
                return FileInterface::TYPE_STATIC_IMAGE;

            case 'gif':
                return FileInterface::TYPE_ANIMATED_IMAGE;

            case 'webm':
            case 'mp4':
            case 'zip':
                return FileInterface::TYPE_VIDEO;

            default:
                throw new InvalidArgumentException(sprintf(
                    'Unknown file type: %s',
                    $extension
                ));
        }
    }
protected static function getFileTypeByExtension(string $extension): int
    {
        switch ($extension) {
            case 'png':
            case 'jpg':
                return FileInterface::TYPE_STATIC_IMAGE;

            case 'gif':
                return FileInterface::TYPE_ANIMATED_IMAGE;

            case 'webm':
            case 'mp4':
            case 'zip':
                return FileInterface::TYPE_VIDEO;

            default:
                throw new InvalidArgumentException(sprintf(
                    'Unknown file type: %s',
                    $extension
                ));
        }
    }
protected static function getFileTypeByExtension ( string $ extension ) : int { switch ( $ extension ) { case 'png' : case 'jpg' : return FileInterface :: TYPE_STATIC_IMAGE ; case 'gif' : return FileInterface :: TYPE_ANIMATED_IMAGE ; case 'webm' : case 'mp4' : case 'zip' : return FileInterface :: TYPE_VIDEO ; default : throw new InvalidArgumentException ( sprintf ( 'Unknown file type: %s' , $ extension ) ) ; } }
Returns file type constant value by file extension.

@param string $extension

@return int
Returns file type constant value by file extension .