Code Duplication    Length = 7-7 lines in 3 locations

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

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

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

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