Populates the $mimeTypes property.
182601
private function populateMimeTypes(): void
    {
        if (null !== $this->mimeTypes) {
            return;
        }

        $this->mimeTypes = [];
        foreach ($this->formats as $format => $mimeTypes) {
            foreach ($mimeTypes as $mimeType) {
                $this->mimeTypes[$mimeType] = $format;
            }
        }
    }
92271
public function setMimeType($mime_type)
    {
        $allowedValues = $this->getMimeTypeAllowableValues();
        if (!is_null($mime_type) && !in_array($mime_type, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'mime_type', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['mime_type'] = $mime_type;

        return $this;
    }
647701
public function setFormat($format, $mimeTypes)
    {
        if (null === static::$formats) {
            static::initializeFormats();
        }

        static::$formats[$format] = \is_array($mimeTypes) ? $mimeTypes : [$mimeTypes];
    }
1206592
def mimetype(self):
        """"""
        ct = self.headers.get("content-type")
        if ct:
            return ct.split(";")[0].strip()
590630
def populate_entity_type(apps, schema_editor):
    """"""
    Entity = apps.get_model('flow', 'Entity')

    for entity in Entity.objects.all():
        if entity.descriptor_schema is not None:
            entity.type = entity.descriptor_schema.slug
            entity.save()
349251
def determine_file_type(self, z):
        """"""

        mimetype = z.read('mimetype').decode('utf-8').strip()
        self.type = MIMEMAP[mimetype]
1283911
private void populateModel()
   {
      if (m_count != 0)
      {
         m_count = 0;
         Arrays.fill(m_flags, false);
      }

      for (Resource resource : m_parentFile.getResources())
      {
         for (int loop = 0; loop < MPXResourceField.MAX_FIELDS; loop++)
         {
            if (resource.getCachedValue(MPXResourceField.getMpxjField(loop)) != null)
            {
               if (m_flags[loop] == false)
               {
                  m_flags[loop] = true;
                  m_fields[m_count] = loop;
                  ++m_count;
               }
            }
         }
      }

      //
      // Ensure the the model fields always appear in the same order
      //
      Arrays.sort(m_fields);
      System.arraycopy(m_fields, m_fields.length - m_count, m_fields, 0, m_count);
   }
985554
private function _load_mime_types()
    {

        // if file with mime types was not already loaded
        if (!isset($this->form_properties['mimes'])) {

            // read file into an array
            $rows = file($this->form_properties['assets_server_path'] . 'mimes.json');

            // convert JSON to array
            // i'm aware that in PHP 5.2+ there is json_decode, but i want this library to be
            // as backward compatible as possible so, since the values in mimes.json has a
            // specific structure, i wrote my own decoder
            $this->form_properties['mimes'] = array();

            // iterate through all the rows
            foreach ($rows as $row) {

                // if valid row found
                if (strpos($row, ':') !== false) {

                    // explode the string by :
                    $items = explode(':', $row);

                    // the file type (extension)
                    $index = trim(str_replace('"', '', $items[0]));

                    // if there are more mime types attached
                    if (strpos($items[1], '[') !== false)

                        // convert to array
                        $value = array_diff(array_map('trim', explode(',', str_replace(array('[', ']', '"', '\/'), array('', '', '', '/'), $items[1]))), array(''));

                    // if a single mime type is attached
                    else

                        // convert to string
                        $value = trim(str_replace(array('"', ',', '\/'), array('', '', '/'), $items[1]));

                    // save entry
                    $this->form_properties['mimes'][$index] = $value;

                }

            }

        }

    }
360719
protected function _getCommonJsData($mimeType)
    {
        $commonJsData = parent::_getCommonJsData($mimeType);
        if ($commonJsData) {
            $deps = array_merge(
                $this->_loadedPackage->_getFilteredUniqueDependencies('text/javascript'),
                $this->_loadedPackage->_getFilteredUniqueDependencies('text/javascript; defer')
            );
            foreach ($deps as $i) {
                $data = array();
                $commonJsDeps = $this->_getCommonJsDeps($i, $data);
                foreach (array_keys($data) as $key) {
                    if (isset($commonJsData[$key])) {
                        unset($commonJsData[$key]);
                    }
                }
            }
        }
        return $commonJsData;
    }
837503
public function setMimeType(string $mime_type)
    {
        if (!preg_match('/^[\w_-]+\/[\w_-]+$/', $mime_type))
            throw new \InvalidArgumentException("Not a valid mime type: $mime_type");
        $this->mime_type = $mime_type;
        return $this;
    }
841695
def _generate_base_mimetypes(self):
        
        for t in self.type_instances:
            if t.custom_mime:
                continue

            yield t.mime, (t, None, None)
1222391
public void setMimeType(com.google.api.ads.admanager.axis.v201805.MimeType mimeType) {
        this.mimeType = mimeType;
    }
535036
def sanitize_mimetype(mimetype, filename=None):
    """"""
    # Allow some few mime type like plain text, images and audio.
    if mimetype in MIMETYPE_WHITELIST:
        return mimetype
    # Rewrite HTML, JavaScript, CSS etc to text/plain.
    if mimetype in MIMETYPE_PLAINTEXT or \
            (filename and filename.lower() in MIMETYPE_TEXTFILES):
        return 'text/plain'
    # Default
    return 'application/octet-stream'
20373
def mimetype(self):
        
        if ';' in self.headers.get('Content-Type', ''):
            return self.headers['Content-Type'].split(';')[0]
        return self.headers.get('Content-Type', self.static_format)
718812
function appendMIMETypeSetting( $settings )
    {
        $this->MIMETypeSettings[] = $settings;
        if ( !isset( $this->MIMETypeSettingsMap[$settings['mime_type']] ) )
            $this->MIMETypeSettingsMap[$settings['mime_type']] = array();
        $this->MIMETypeSettingsMap[$settings['mime_type']][] = $settings;
    }
613116
public function mimetype()
    {
        if (!$this->mimetype) {
            $val = $this->val();

            if (!$val) {
                return '';
            }

            $this->setMimetype($this->mimetypeFor(strval($val)));
        }

        return $this->mimetype;
    }
318117
public function type($mimeTypes) {
        $types = array();

        foreach ((array) $mimeTypes as $mimeType) {
            switch ($mimeType) {
                case 'application': $types += MimeType::getApplicationList(); break;
                case 'audio':       $types += MimeType::getAudioList(); break;
                case 'image':       $types += MimeType::getImageList(); break;
                case 'text':        $types += MimeType::getTextList(); break;
                case 'video':       $types += MimeType::getVideoList(); break;
                default:            $types += MimeType::getSubTypeList($mimeType); break;
            }
        }

        return in_array($this->getFile()->type(), $types);
    }