@param ContentTypeInterface $contentType
@param array                $parameters

@return boolean
554159
public function canReadList(ContentTypeInterface $contentType, array $parameters)
    {
        $siteId = $this->contextManager->getSiteId();
        $site = $this->siteRepository->findOneBySiteId($siteId);

        return in_array($contentType->getContentTypeId(), $site->getContentTypes());
    }
1355941
public function withContentType($contentType)
    {
        $contentType = $this->normalizeContentType($contentType);

        $contentType = explode(';', $contentType, 2);

        $this->type = $contentType[0];

        $contentType[0] .= ';' . (isset($contentType[1]) ? $contentType[1] : ' charset=utf-8');

        return $this->withHeader('Content-Type', $contentType[0]);
    }
1069235
protected function addContentTypeToHeader($headers, $contentType)
    {
        $keys = array_change_key_case(array_keys($headers), CASE_LOWER);

        if (!isset($keys['content-type'])) {
            $headers['content-type'] = [$contentType];
        }

        return $headers;
    }
878217
public function setContentType($contentType = null)
    {
        if ($contentType === null) {
            $contentType = isset($_SERVER['CONTENT_TYPE']) ? $_SERVER['CONTENT_TYPE'] : null;
        }

        $this->contentType = $contentType;
    }
914338
public static function setContentType($contentType, $encoding = null) {
		$value = $contentType;
		if (isset ( $encoding ))
			$value .= ' ;charset=' . $encoding;
		self::header ( 'Content-Type', $value );
	}
20030
private function checkRoleContentTypePermission($roleName, $permissionName, $contenttype)
    {
        // Actions on non-existing contenttypes are not allowed.
        if (!$this->app['storage.metadata']->createContentType($contenttype)) {
            return false;
        }

        $roles = $this->getRolesByContentTypePermission($permissionName, $contenttype);

        return in_array($roleName, $roles);
    }
93704
public static function notAcceptable(string $contentType, string $protocol = Protocol::HTTP): self
    {
        return new static(sprintf('Content type `%s` not acceptable', $contentType), $protocol, 406);
    }
828024
private function attachContentTypeGroupsByIdentifiers(ContentType $contentType, array $contentTypeGroupsIdentifiers)
    {
        $contentTypeGroups = $this->loadContentTypeGroupsByIdentifiers($contentTypeGroupsIdentifiers);
        foreach ($contentTypeGroups as $contentTypeGroup) {
            $this->contentTypeService->assignContentTypeGroup($contentType, $contentTypeGroup);
        }
    }
979900
public function getFieldById(ContentTypeInterface $contentType, $fieldId)
    {
        $field = $this->om->getRepository($this->configurationManager->getEntityClass('field'))->find($fieldId);


        if (!$field instanceof FieldInterface) {
            return null;
        }
        if ($field->getContentType() && $field->getContentType()->getId() == $contentType->getId()) {
            return $field;
        }

        $parent = $field;
        while ($parent && $parentLayout = $parent->getLayout()) {
            if ($parent = $parentLayout->getParent()) {
                if ($parent->getContentType() !== null && $parent->getContentType()->getId() == $contentType->getId()) {
                    return $field;
                }
            }
        }

        return null;
    }
72709
public function get(ContentType $contentType, array $templateFields)
    {
        $select = new ArrayObject();

        $this->build($select, $contentType->getFields());
        $this->build($select, $templateFields, 'templatefields');

        return iterator_to_array($select) ?: null;
    }
271659
public function evaluate(array $parameters): bool
    {
        if (false === $this->permissionResolver->canUser('role', 'read', $parameters['content'])) {
            return false;
        }

        /** @var \eZ\Publish\API\Repository\Values\ContentType\ContentType $contentType */
        $contentType = $parameters['contentType'];

        $isUser = new ContentTypeIsUser($this->userContentTypeIdentifier);
        $isUserGroup = new ContentTypeIsUserGroup($this->userGroupContentTypeIdentifier);
        $isUserOrUserGroup = (new OrSpecification($isUser, $isUserGroup))->isSatisfiedBy($contentType);

        return $isUserOrUserGroup;
    }
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);
    }
1269002
private function isAcceptableContentType(ServerRequestInterface $request, string $contentType): bool
    {
        $acceptHeader = $request->getHeaderLine('Accept');

        if (strpos($acceptHeader, $contentType) !== false) {
            return true;
        }
        // special case for 'xxx+json' and 'xxx+xml' example : 'application/xhtml+xml'
        if (preg_match('/\+(json|xml)/', $acceptHeader, $matches)) {
            $mediaType = 'application/' . $matches[1];
            if ($mediaType === $contentType) {
                return true;
            }
        }
        // special case when accepting all subtypes of the mime 'mime/*'
        if (strpos($acceptHeader, strtok($contentType, '/') . '/*') !== false) {
            return true;
        }
        // special case when accepting all mimes '*/*'
        if (strpos($acceptHeader, '*/*') !== false) {
            return true;
        }

        return false;
    }
498553
public function setContentType($contentType = '')
    {
        $this->contentType = $contentType;
        $this->debug->debug(__FUNCTION__, 'setContentType: ', $this->contentType);
    }
1208526
public function getPart(string $contentType)
    {
        if (! isset($this->parts[$contentType])) {
            return null;
        }

        return $this->parts[$contentType];
    }
134911
public function setContentType(string $contentType, string $charset = null)
    {
        $this->setHeader('Content-Type', $contentType . ($charset ? "; charset=$charset" : ''));

        return $this;
    }
505422
public function save(ContentType $contentType)
    {
        $this->em->persist($contentType);
        $this->em->flush();

        return $contentType;
    }