Code Duplication    Length = 8-8 lines in 2 locations

src/Formatter.php 1 location

@@ 78-85 (lines=8) @@
75
     * @param   mixed               $value
76
     * @return  mixed
77
     */
78
    public function getAttributeDbValue(AttributeMetadata $attrMeta, $value)
79
    {
80
        // Handle data type conversion, if needed.
81
        if ('date' === $attrMeta->dataType && $value instanceof \DateTime) {
82
            return new \MongoDate($value->getTimestamp(), $value->format('u'));
83
        }
84
        return $value;
85
    }
86
87
    /**
88
     * Prepares and formats a has-one relationship model for proper insertion into the database.

src/Persister.php 1 location

@@ 171-178 (lines=8) @@
168
     * @param   mixed               $value
169
     * @return  mixed
170
     */
171
    protected function prepareAttribute(AttributeMetadata $attrMeta, $value)
172
    {
173
        // Handle data type conversion, if needed.
174
        if ('date' === $attrMeta->dataType && $value instanceof \DateTime) {
175
            return new \MongoDate($value->getTimestamp(), $value->format('u'));
176
        }
177
        return $value;
178
    }
179
180
    /**
181
     * Prepares and formats a has-one relationship model for proper insertion into the database.