You are here

public static function EasyRdf_Utils::parseMimeType in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/easyrdf/easyrdf/lib/EasyRdf/Utils.php \EasyRdf_Utils::parseMimeType()

Clean up and split a mime-type up into its parts

Parameters

string $mimeType A MIME Type, optionally with parameters:

Return value

array $type, $parameters

2 calls to EasyRdf_Utils::parseMimeType()
EasyRdf_Graph::load in vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Load RDF data into the graph from a URI.
EasyRdf_Sparql_Client::request in vendor/easyrdf/easyrdf/lib/EasyRdf/Sparql/Client.php

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Utils.php, line 207

Class

EasyRdf_Utils
Class containing static utility functions

Code

public static function parseMimeType($mimeType) {
  $parts = explode(';', strtolower($mimeType));
  $type = trim(array_shift($parts));
  $params = array();
  foreach ($parts as $part) {
    if (preg_match('/^\\s*(\\w+)\\s*=\\s*(.+?)\\s*$/', $part, $matches)) {
      $params[$matches[1]] = $matches[2];
    }
  }
  return array(
    $type,
    $params,
  );
}