Neos\Media\Domain\Strategy\ConfigurationAssetModelMappingStrategy::map PHP 메소드

map() 공개 메소드

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.
리턴 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