Code Duplication    Length = 7-7 lines in 3 locations

eZ/Publish/Core/Persistence/Legacy/Content/FieldValue/Converter/DateAndTimeConverter.php 1 location

@@ 45-51 (lines=7) @@
42
     * @param \eZ\Publish\SPI\Persistence\Content\FieldValue $value
43
     * @param \eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue
44
     */
45
    public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue)
46
    {
47
        // @todo: One should additionally store the timezone here. This could
48
        // be done in a backwards compatible way, I think…
49
        $storageFieldValue->dataInt = ($value->data !== null ? $value->data['timestamp'] : null);
50
        $storageFieldValue->sortKeyInt = (int)$value->sortKey;
51
    }
52
53
    /**
54
     * Converts data from $value to $fieldValue.

eZ/Publish/Core/Persistence/Legacy/Content/FieldValue/Converter/RelationConverter.php 2 locations

@@ 40-46 (lines=7) @@
37
     * @param \eZ\Publish\SPI\Persistence\Content\FieldValue $value
38
     * @param \eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldValue $storageFieldValue
39
     */
40
    public function toStorageValue(FieldValue $value, StorageFieldValue $storageFieldValue)
41
    {
42
        $storageFieldValue->dataInt = !empty($value->data['destinationContentId'])
43
            ? $value->data['destinationContentId']
44
            : null;
45
        $storageFieldValue->sortKeyInt = (int)$value->sortKey;
46
    }
47
48
    /**
49
     * Converts data from $value to $fieldValue.
@@ 54-60 (lines=7) @@
51
     * @param \eZ\Publish\Core\Persistence\Legacy\Content\StorageFieldValue $value
52
     * @param \eZ\Publish\SPI\Persistence\Content\FieldValue $fieldValue
53
     */
54
    public function toFieldValue(StorageFieldValue $value, FieldValue $fieldValue)
55
    {
56
        $fieldValue->data = [
57
            'destinationContentId' => $value->dataInt ?: null,
58
        ];
59
        $fieldValue->sortKey = (int)$value->sortKeyInt;
60
    }
61
62
    /**
63
     * Converts field definition data in $fieldDef into $storageFieldDef.