@param \Netgen\Bundle\MetadataBundle\Core\FieldType\Metadata\Value $value

@return array
166608
public function transform($value)
    {
        if (!$value instanceof Value) {
            return null;
        }

        return array(
            'title' => $value->title,
            'description' => $value->description,
            'keywords' => implode(',', $value->keywords),
            'priority' => $value->priority,
            'change' => $value->change,
            'sitemap_use' => !empty($value->sitemap_use),
        );
    }
775561
private function getValues($value)
    {
        if (is_array($value)) {
            $newValue = array();

            foreach ($value as $itemValue) {
                $newValue = array_merge($newValue, $this->getValues($itemValue));
            }

            return array($newValue);
        }

        if (is_object($value) && $this->em->getMetadataFactory()->hasMetadataFor(ClassUtils::getClass($value))) {
            $class = $this->em->getClassMetadata(get_class($value));
            if ($class->isIdentifierComposite) {
                $newValue = array();

                foreach ($class->getIdentifierValues($value) as $innerValue) {
                    $newValue = array_merge($newValue, $this->getValues($innerValue));
                }

                return $newValue;
            }
        }

        return array($this->getIndividualValue($value));
    }
1065290
public function transform($value)
    {
        if (null === $value) {
            return array();
        }
        if($this->identifier){
            return $this->identifier->getValue($value);
        }

        return $value->getId();
    }
112744
public function convertFromValue(Value $value)
    {
        $hash = array();

        foreach ($value->page->getState() as $propName => $propValue) {
            switch ($propName) {
                case 'layout':
                    if ($propValue !== null) {
                        $hash['layout'] = $propValue;
                    }
                    break;
                case 'attributes':
                    if ($propValue !== null && $propValue !== array()) {
                        $hash['attributes'] = $propValue;
                    }
                    break;
                case 'zones':
                    foreach ($propValue as $zone) {
                        $hash['zones'][] = $this->convertZoneToHash($zone);
                    }
                    break;
            }
        }

        return $hash;
    }
659972
private function prepareValues($value): array
    {
        if (!self::hasMultipleValues($this->name)) {
            $values = is_array($value) ? $value : [trim($value)];
        } elseif (!is_array($value)) {
            $values = explode(',', (string) $value);
        } else {
            $values = $value;
        }

        foreach (array_keys($values) as $key) {
            $values[$key] = trim($values[$key]);

            if ($values[$key] == '') {
                unset($values[$key]);
            }
        }

        return array_values(array_unique($values));
    }
729081
private function formatValueForApi($value)
    {
        $type = gettype($value);

        switch ($type) {
            case 'string':
                return ['string_value' => $value];
            case 'double':
            case 'integer':
                return ['number_value' => $value];
            case 'boolean':
                return ['bool_value' => $value];
            case 'NULL':
                return ['null_value' => NullValue::NULL_VALUE];
            case 'array':
                if (!empty($value) && $this->isAssoc($value)) {
                    return ['struct_value' => $this->formatStructForApi($value)];
                }

                return ['list_value' => $this->formatListForApi($value)];
        }
    }
46112
protected function getTags($value)
    {
        $tags = [];
        switch ($value) {
            case $value instanceof VersionList && !empty($value->versions):
                $tags[] = 'content-' . $value->versions[0]->contentInfo->id;
                $tags[] = 'content-versions-' . $value->versions[0]->contentInfo->id;

                break;

            case $value instanceof Section:
                $tags[] = 'section-' . $value->id;
                break;

            case $value instanceof ContentTypeGroupRefList:
                if ($value->contentType->status !== ContentType::STATUS_DEFINED) {
                    return [];
                }
                $tags[] = 'type-' . $value->contentType->id;
            case $value instanceof ContentTypeGroupList:
                foreach ($value->contentTypeGroups as $contentTypeGroup) {
                    $tags[] = 'type-group-' . $contentTypeGroup->id;
                }
                break;

            case $value instanceof RestContentType:
                $value = $value->contentType;
            case $value instanceof ContentType:
                if ($value->status !== ContentType::STATUS_DEFINED) {
                    return [];
                }
                $tags[] = 'type-' . $value->id;
                break;

            case $value instanceof Root:
                $tags[] = 'ez-all';
                break;

                // @deprecated The following logic is 1.x specific, and should be removed before a 1.0 version
            case $value instanceof PermissionReport:
                // We requrie v0.1.5 with added location property to be able to add tags
                if (!isset($value->parentLocation)) {
                    return [];
                }

                // In case of for instance location swap where content type might change affecting allowed content types
                $tags[] = 'content-' . $value->parentLocation->contentId;
                $tags[] = 'content-type-' . $value->parentLocation->contentInfo->contentTypeId;
                $tags[] = 'location-' . $value->parentLocation->id;

                // In case of permissions assigned by subtree, so if path changes affecting this (move subtree operation)
                foreach ($value->parentLocation->path as $pathItem) {
                    $tags[] = 'path-' . $pathItem;
                }
                break;
        }

        return $tags;
    }
959708
protected function extractArray($value)
    {
        if (empty($value)) {
            return [];
        }

        if ($value instanceof \Traversable) {
            $array = [];
            foreach ($value as $key => $value) {
                $array[$key] = $value;
            }
            return $array;
        }

        return (Array) $value;
    }
576898
private function convertArrayToEntityValue(array $value)
    {
        $excludes = $this->pluck(Entity::EXCLUDE_FROM_INDEXES, $value, false) ?: [];

        $properties = [];
        foreach ($value as $key => $val) {
            $properties[$key] = $this->valueObject(
                $val,
                in_array($key, $excludes)
            );
        }

        if (!$properties) {
            $properties = (object) $properties;
        }

        return [
            'entityValue' => [
                'properties' => $properties
            ]
        ];
    }
521595
protected function serializedArray(array $value)
    {
        unset($value[Serializer::MAP_TYPE]);

        $dataValues = [];
        $includedValues = [];

        foreach ($value[Serializer::SCALAR_VALUE] as $v) {
            $v = $this->serializeObject($v);
            $dataValues[] = $v[self::DATA_KEY];
            if (!empty($v[self::INCLUDED_KEY])) {
                $includedValues = \array_merge($includedValues, $v[self::INCLUDED_KEY]);
            }
        }
        $includedValues = \array_unique($includedValues, SORT_REGULAR);

        $data[self::DATA_KEY] = $dataValues;
        $data[self::INCLUDED_KEY] = \array_values($includedValues);
        $data = array_filter($data);

        $this->setResponseLinks($value, $data);
        $this->setResponseMeta($data);
        $this->setResponseVersion($data);
        $this->setResponseMeta($data);

        return (empty($data['data'])) ? array_merge(['data' => []], $data) : $data;
    }
741731
private function getImagesInFieldValue($value)
  {
    $aImages = explode(',', $value);
    $arrImages = [];
    foreach ($aImages as $aImage)
    {
      $oImage = File::where('path',$aImage)->first();
      if (!$oImage) continue;
      $fileName = "$oImage->name.$oImage->ext";
      $arrImages[] = [
        'filename' => $fileName,
        'virtuaPath' => $oImage->path,
        'path' => $oImage->image ? $this->contentRepository->getImageUrl($oImage->path,[
          'w' => 120,
          'h' => 120,
          'fit' => 'crop',
        ]) : $this->contentRepository->getFileUrl($oImage->path),
        'pathDownload' => ($oImage->image ? $this->contentRepository->getImageUrl($oImage->path) : $this->contentRepository->getFileUrl($oImage->path))."?f=".$fileName,
        'icon' => !$oImage->image ? $this->props->genericIconPath : ''
      ];
    }
    return $arrImages;
  }
168080
public function transform($value)
    {
        $result = array();
        $configuration = $this->generatePerimeterManager->generatePerimeters($value->getOwner()->getSite()->getSiteId());
        $value = $value->toArray();

        foreach ($configuration as $type => &$paths) {
            $items = array_key_exists($type, $value) ? $value[$type]->getItems() : array();
            array_walk($paths, function($path) use (&$result, $items, $type) {
                $key = GeneratePerimeterManager::changePathToName($path);
                $result[$type][$key] = in_array($path, $items);
                $result[$type][$key] = false;
                foreach($items as $item) {
                    $result[$type][$key] = $result[$type][$key] || preg_match('/^' . preg_quote($item, '/') . '.*$/', $path);
                }
            });
        }

        return $result;
    }
1131969
public function apply(Value $value): array
    {
        if ($value->isEmpty()) {
            return $this->null();
        }

        try {
            return $this->filtered(new Day($value->value()));
        } catch (\InvalidArgumentException $iae) {
            return $this->error('DATE_INVALID');
        }
    }
461005
public function apply(Value $value): array
    {
        if ($value->isEmpty()) {
            return $this->null();
        }

        list($proposedPassword, $errors) = $this->parse($value->value());
        if (count($errors) > 0) {
            return $this->errors($errors);
        }

        if (null === $proposedPassword) {
            return $this->null();
        }

        $errors = $this->checker->check($proposedPassword);
        if (count($errors) > 0) {
            return $this->errors($errors);
        }

        return $this->filtered($proposedPassword);
    }
92347
public function getAttributesFromString($value)
    {
        if (empty($value) === true) {
            return [];
        }

        $repository = $this->config->load($value, $this->type);

        return $repository->getArray();
    }
560335
public function getMetaAttribute($value)
    {
        $meta = [];

        if (! is_null($value)) {
            $meta = json_decode($value, true);
        }

        return new Meta($meta);
    }
767069
public function serialize($value)
    {
        if ($value instanceof AnDomainAttributeInterface) {
            $value = $value->serialize();
        }

        return array((string) $this->_column => $value);
    }