Neos\Media\Domain\Strategy\ConfigurationAssetModelMappingStrategy::map PHP Method

map() public method

Map the given resource to a media model class.
public map ( PersistentResource $resource, array $additionalProperties = [] ) : string
$resource Neos\Flow\ResourceManagement\PersistentResource
$additionalProperties array Optional properties that can be taken into account for deciding the model class. what you get here can depend on the caller, so you should always fallback to something based on the resource.
return string
    public function map(PersistentResource $resource, array $additionalProperties = array())
    {
        $mediaType = MediaTypes::getMediaTypeFromFilename($resource->getFilename());
        foreach ($this->settings['patterns'] as $pattern => $mappingInformation) {
            if (preg_match($pattern, $mediaType)) {
                return $mappingInformation['className'];
            }
        }
        return $this->settings['default'];
    }
ConfigurationAssetModelMappingStrategy