@param $contentTypeName

@return string
977215
public function getCMDLForContentType($contentTypeName)
    {
        if ($this->hasContentType($contentTypeName))
        {
            $url = 'content/' . $contentTypeName . '/cmdl';

            $response = $this->getClient()->get($url);
            $json     = $response->json();

            return $json['cmdl'];
        }

        throw new AnyContentClientException ('Unknown content type ' . $contentTypeName);

    }
801869
public static function getContentType() {
    if(null === self::$contentType) {
      self::$contentType = @trim($_SERVER['HTTP_CONTENT_TYPE']);
      if(!self::$contentType) {
        self::$contentType = @trim($_SERVER['CONTENT_TYPE']);
        if(!self::$contentType) {
          self::$contentType = false;
        }
      }
    }
    return self::$contentType;
  }
430995
private function getNewContentTypeDraft(ContentType $contentType)
    {
        try {
            $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentType->id);
        } catch (NotFoundException $e) {
            $contentTypeDraft = $this->contentTypeService->createContentTypeDraft($contentType);
        }

        return $contentTypeDraft;
    }
1325133
public function uploadString($name, $content, $contentType = 'text/plain')
    {
        $fileName = $this->path . '/' . $this->getFilePathAndUniquePrefix() . $name;

        if ($contentType === 'application/json') {
            $content = Json::prettyPrint($content);
        }

        (new Filesystem)->dumpFile($fileName, $content);

        return $fileName;
    }
1339846
public function resolveContentId($contentTypeId, $contentId)
    {
        // content type ?
        if (!$contentType = $this->contentTypeLoader->retrieve($contentTypeId)) {
            throw new InvalidContentException(sprintf(
                'No content type registered under "%s" id, check you configuration.',
                $contentTypeId
            ));
        }

        // content object
        if (!$content = $contentType->retrieveContent($contentId)) {
            throw new InvalidContentException(sprintf(
                'Unable to get a "%s" content under "%s" id.',
                $contentType->getName(),
                $contentId
            ));
        }

        return $this->wrap($contentType, $content);
    }
94086
private static function getParametersFromContentType(string $contentType): array
    {
        $parameters = array_merge(
            self::getParametersFromGlobal($_GET),
            self::getParametersFromGlobal($_POST),
            self::getParametersFromGlobal($_FILES));
        $paramsSource = [];
        $rawInput = file_get_contents('php://input');
        switch ($contentType) {
            case ContentType::JSON:
                $paramsSource = (array) json_decode($rawInput);
                break;
            case ContentType::XML:
            case ContentType::XML_APP:
                $xml = new \SimpleXMLElement($rawInput);
                $paramsSource = (array) $xml;
                break;
            default:
                parse_str($rawInput, $paramsSource);
        }
        return array_merge($parameters, self::getParametersFromGlobal($paramsSource));
    }
730671
public function getContentTypeFieldType($contenttypeslug, $fieldname)
    {
        $contenttype = $this->getContentType($contenttypeslug);

        if (in_array($fieldname, ['datecreated', 'datechanged', 'datepublish', 'datedepublish'])) {
            return "datetime";
        } elseif (isset($contenttype['fields'][$fieldname]['type'])) {
            return $contenttype['fields'][$fieldname]['type'];
        } else {
            return false;
        }
    }
134006
public function getContentType()
    {
        $contentType = null;
        $_contentType = $this->getHeader('Content-Type');
        if (!empty($_contentType)) {
            $_contentType = explode(';', $_contentType[0]);
            $contentType = $_contentType[0];
        }

        return $contentType;
    }
294684
protected function getUrlTypeSuffix($contentTypeStatus)
    {
        switch ($contentTypeStatus) {
            case Values\ContentType\ContentType::STATUS_DEFINED:
                return '';

            case Values\ContentType\ContentType::STATUS_DRAFT:
                return 'Draft';

            case Values\ContentType\ContentType::STATUS_MODIFIED:
                return 'Modified';
        }

        return '';
    }
1208526
public function getPart(string $contentType)
    {
        if (! isset($this->parts[$contentType])) {
            return null;
        }

        return $this->parts[$contentType];
    }
246618
public function getContentIdsByContentTypeId($contentTypeId)
    {
        $query = $this->dbHandler->createSelectQuery();
        $query
            ->select($this->dbHandler->quoteColumn('id'))
            ->from($this->dbHandler->quoteTable('ezcontentobject'))
            ->where(
                $query->expr->eq(
                    $this->dbHandler->quoteColumn('contentclass_id'),
                    $query->bindValue($contentTypeId, null, PDO::PARAM_INT)
                )
            );

        $statement = $query->prepare();
        $statement->execute();

        return $statement->fetchAll(PDO::FETCH_COLUMN);
    }
1234871
public function withContentType($contentType, $charset = null)
    {
        if (is_null($charset)) {
            return $this->withHeader('Content-Type', $contentType);
        }

        return $this->withHeader('Content-Type', $contentType . '; charset=' . $charset);
    }
653602
public function setContentType(ContentType $contentType)
    {
        $this->contentTypeName = $contentType->getName();
        $this->contentTypeId = null;

        return parent::setContentType($contentType);
    }
934310
public function getContentType() {
        $contentType = $this->getHeaderValue('Content-Type');

        if ($contentType) {
            $headers     = explode(',', $contentType, 2);
            $contentType = \array_shift($headers);

            $values      = explode(';', $contentType, 2);
            $contentType = trim(\array_shift($values));
        }
        return $contentType;
    }
1316415
public function getRolesByContentTypePermission($permissionName, $contenttype)
    {
        // Here's how it works:
        // - if a permission is granted through 'contenttype-all', it is effectively granted
        // - if a permission is granted through 'contenttypes/$contenttype', it is effectively granted
        // - if 'contenttypes/$contenttype/$permissionName' is not set, *and* the permission is granted through 'contenttype-default', it is effectively granted
        // - otherwise, the permission is denied
        $overrideRoles = $this->app['config']->get("permissions/contenttype-all/$permissionName");
        if (!is_array($overrideRoles)) {
            $overrideRoles = [];
        }
        $contenttypeRoles = $this->app['config']->get("permissions/contenttypes/$contenttype/$permissionName");
        if (!is_array($contenttypeRoles)) {
            $contenttypeRoles = $this->app['config']->get("permissions/contenttype-default/$permissionName");
        }
        if (!is_array($contenttypeRoles)) {
            $contenttypeRoles = [];
        }
        $effectiveRoles = array_unique(array_merge($overrideRoles, $contenttypeRoles));

        return $effectiveRoles;
    }
1137998
public function getCMDLForContentType($contentTypeName)
    {
        if ($this->hasContentType($contentTypeName)) {
            if ($this->getConfiguration()->hasCMDLFolder()) {
                $path = $this->getConfiguration()
                             ->getPathCMDLFolderForContentTypes() . '/' . $contentTypeName . '.cmdl';
                if (file_exists($path)) {
                    return file_get_contents($path);
                }

                throw new AnyContentClientException ('Could not fetch cmdl for content type ' . $contentTypeName . ' from ' . $path);
            }
            else {
                $sql = 'SELECT cmdl FROM _cmdl_ WHERE repository = ? AND name = ? AND data_type="content"';

                $row = $this->getDatabase()->fetchOneSQL($sql, [$this->getRepository()->getName(), $contentTypeName]);

                return $row['cmdl'];
            }
        }

        throw new AnyContentClientException ('Unknown content type ' . $contentTypeName);
    }
863816
private static function extractCharset(array $contentTypeParts)
    {
        foreach ($contentTypeParts as $part) {
            $elements = explode('=', $part);
            $key = trim(array_shift($elements));
            if (strtolower($key) === 'charset') {
                $value = trim(reset($elements));
                return $value ?: null;
            }
        }
        return null;
    }