Transforms string (from database) -> File

@param mixed $value
@return array|mixed|null
11088
public function transform($value)
    {
        if (is_array($value)) {
            $value = $value[FileType::UPLOAD_FIELDNAME];
        }

        try {
            return array(
                FileType::UPLOAD_FIELDNAME => new File(call_user_func($this->callback, $value, $this->property))
            );
        } catch (FileNotFoundException $e) {
            return null;
        }
    }
98607
public function transform(string $value): string {
        
        if (strpos($value, 'hdl.handle.net') !== false) {
            $value = str_replace("http://", "", $value);
        }else if(strpos($value, 'https') !== false) {
            $value = str_replace("https://", "", $value);
        }else {
            $value = str_replace("http://", "", $value);
        }
        return $value;
        
    }
347486
public function filter($value)
    {
        if ($this->encodingFormat !== null) {
            return mb_strtolower($value, $this->encodingFormat);
        }

        return mb_strtolower($value);
    }
434036
public function reverseTransform($value)
    {
        if (!$value) {
            return null;
        }

        if (!is_string($value)) {
            throw new TransformationFailedException('Expected a string.');
        }

        if (!$value || !$this->parseUrl($value)) {
            throw new TransformationFailedException('Empty or invalid string.');
        }

        $video = $this->videoManager->findByVideoId($this->videoId);

        if (!$video) {
            $video = $this->videoManager->createVideo();

            $video->setVideoId($this->videoId);
            $video->setType($this->videoType);
            $video->setUrl($value);
        }

        return $video;
    }
1004528
public function transform($value)
    {
        try {
            return array(
                'id' => (null !== $value ? $value->getId() : null),
                'value' => (null !== $value ? $value->__toString() : null)
            );
        } catch (EntityNotFoundException $e) {
            return ['id' => null, 'value' => '-- ENTITY NOT FOUND --'];
        }
    }
1046176
public function filter($value)
    {
        if (!is_scalar($value) && !is_array($value)) {
            return $value;
        }

        // a unicode safe way of converting characters to \x00\x00 notation
        $pregQuotedSeparator = preg_quote($this->separator, '#');

        if (StringUtils::hasPcreUnicodeSupport()) {
            $patterns = [
                '#(' . $pregQuotedSeparator.')(\P{Z}{1})#u',
                '#(^\P{Z}{1})#u',
            ];
            if (!extension_loaded('mbstring')) {
                $replacements = [
                    function ($matches) {
                        return strtoupper($matches[2]);
                    },
                    function ($matches) {
                        return strtoupper($matches[1]);
                    },
                ];
            } else {
                $replacements = [
                    function ($matches) {
                        return mb_strtoupper($matches[2], 'UTF-8');
                    },
                    function ($matches) {
                        return mb_strtoupper($matches[1], 'UTF-8');
                    },
                ];
            }
        } else {
            $patterns = [
                '#(' . $pregQuotedSeparator.')([\S]{1})#',
                '#(^[\S]{1})#',
            ];
            $replacements = [
                function ($matches) {
                    return strtoupper($matches[2]);
                },
                function ($matches) {
                    return strtoupper($matches[1]);
                },
            ];
        }

        $filtered = $value;
        foreach ($patterns as $index => $pattern) {
            $filtered = preg_replace_callback($pattern, $replacements[$index], $filtered);
        }
        return $filtered;
    }
946400
protected function parseDate($value)
    {
        // Skip empty values
        if (empty($value) && !is_numeric($value)) {
            return null;
        }

        // Determine value to parse
        if (is_array($value)) {
            $source = $value; // parse array
        } elseif (is_numeric($value)) {
            $source = $value; // parse timestamp
        } else {
            // Convert US date -> iso, fix y2k, etc
            $value = $this->fixInputDate($value);
            if (is_null($value)) {
                return null;
            }
            $source = strtotime($value); // convert string to timestamp
        }
        if ($value === false) {
            return false;
        }

        // Format as iso8601
        $formatter = $this->getInternalFormatter();
        return $formatter->format($source);
    }
1372316
protected static function convertString($value)
    {
        if (strpos($value, '\\') === false) {
            return $value;
        }

        return preg_replace_callback(
            '/\\\(n|r|t|v|e|f|"|\\\)/',
            function ($match) {
                switch ($match[1][0]) {
                    case 'n':
                        return "\n";
                    case 'r':
                        return "\r";
                    case 't':
                        return "\t";
                    case 'v':
                        return "\v";
                    case 'e':
                        return "\e";
                    case 'f':
                        return "\f";
                    case '"':
                        return '"';
                    case '\\':
                        return '\\';
                }
            },
            $value
        );
    }
338068
public function transform($value)
    {
        if (!$value instanceof Value) {
            return null;
        }

        $ids = [];
        $parentIds = [];
        $keywords = [];
        $locales = [];

        foreach ($value->tags as $tag) {
            $tagKeyword = $tag->getKeyword($this->field->languageCode);
            $mainKeyword = $tag->getKeyword();

            $ids[] = $tag->id;
            $parentIds[] = $tag->parentTagId;
            $keywords[] = $tagKeyword !== null ? $tagKeyword : $mainKeyword;
            $locales[] = $tagKeyword !== null ? $this->field->languageCode : $tag->mainLanguageCode;
        }

        return [
            'ids' => implode('|#', $ids),
            'parent_ids' => implode('|#', $parentIds),
            'keywords' => implode('|#', $keywords),
            'locales' => implode('|#', $locales),
        ];
    }
195788
public function reverseTransform($value)
    {
        return null !== $value && !empty($value)
            ? $this->contentTypeService->loadContentTypeByIdentifier($value)
            : null;
    }
1175183
public function transform($value)
    {
        if (!$value instanceof Value) {
            return '';
        }

        return $this->docbookToXhtml5EditConverter->convert($value->xml)->saveXML();
    }
6711
public static function createFromString($value)
    {
        $coord = explode(',', $value);
        if (count($coord) == 2) {
            $lat = floatval(trim($coord[0]));
            $lng = floatval(trim($coord[1]));
            return new self([
                'lat' => $lat,
                'lng' => $lng
            ]);
        }
        return null;
    }
1209546
public static function getStringForTable($value)
    {
        if (true === is_string($value)) {
            return wordwrap($value, self::MAX_STRING_LENGTH, PHP_EOL);
        }

        if (true === is_bool($value)) {
            if (true === $value) {
                return 'TRUE';
            }

            return 'FALSE';
        }

        if ($value instanceof \DateTime) {
            return $value->format('Y-m-d H:i:s');
        }

        if (null === $value) {
            return 'NULL';
        }

        if (true === is_array($value)) {
            $result = [];
            foreach ($value as $arrayIndex => $arrayValue) {
                if (true === is_numeric($arrayIndex)) {
                    $result[] = self::getStringForTable($arrayValue);

                    continue;
                }

                $result[] = sprintf('%s : %s', $arrayIndex, self::getStringForTable($arrayValue));
            }

            return implode(PHP_EOL, $result);
        }

        return json_encode($value);
    }
1090192
public function reverseTransform($value)
    {
        return is_array($value) && array_key_exists($this->name, $value) ? $value[$this->name] : array();
    }
30698
public function reverseTransform($value)
    {
        if ($value === null || empty($value)) {
            return $this->fieldType->getEmptyValue();
        }

        return $this->fieldType->fromHash(['xml' => $value]);
    }
304280
public function transform($value): ?string
    {
        if (null === $value) {
            return null;
        }

        if (!is_array($value) || array_diff(['id', 'module', 'function'], array_keys($value))) {
            throw new TransformationFailedException('Expected a valid array of data.');
        }

        return implode(':', [$value['id'], $value['module'], $value['function']]);
    }
1139999
public function getTransformedValue($value)
    {
        if(is_scalar($value) || (is_object($value) && method_exists($value, '__toString'))) {
            foreach($this->regex as $regex => $replace) {

                if(preg_match($regex, (string)$value))
                    return preg_replace($regex, $replace, $value);
            }
        }

       return $value;
    }