Neos\Flow\Property\TypeConverter\StringConverter::convertFrom PHP Метод

convertFrom() публичный Метод

Actually convert from $source to $targetType, taking into account the fully built $convertedChildProperties and $configuration.
public convertFrom ( mixed $source, string $targetType, array $convertedChildProperties = [], Neos\Flow\Property\PropertyMappingConfigurationInterface $configuration = null ) : string
$source mixed
$targetType string
$convertedChildProperties array
$configuration Neos\Flow\Property\PropertyMappingConfigurationInterface
Результат string
    public function convertFrom($source, $targetType, array $convertedChildProperties = [], PropertyMappingConfigurationInterface $configuration = null)
    {
        if ($source instanceof \DateTimeInterface) {
            $dateFormat = $this->getDateFormat($configuration);
            return $source->format($dateFormat);
        }
        if (is_array($source)) {
            switch ($this->getArrayFormat($configuration)) {
                case self::ARRAY_FORMAT_CSV:
                    return implode($this->getCsvDelimiter($configuration), $source);
                case self::ARRAY_FORMAT_JSON:
                    return json_encode($source);
                default:
                    throw new InvalidPropertyMappingConfigurationException(sprintf('Invalid array export format "%s" given', $this->getArrayFormat($configuration)), 1404317220);
            }
        }
        return (string) $source;
    }