@@ 75-79 (lines=5) @@ | ||
72 | { |
|
73 | // prepare expiration |
|
74 | if (!empty($ttl)) { |
|
75 | if ($ttl instanceof \DateInterval) { |
|
76 | $ttl = $ttl->s; |
|
77 | } elseif (!is_int($ttl)) { |
|
78 | throw new InvalidArgumentException('Invalid TTL specified'); |
|
79 | } |
|
80 | ||
81 | $expirationTimestamp = time() + $ttl; |
|
82 | } |
|
@@ 178-182 (lines=5) @@ | ||
175 | ||
176 | // prepare expiration |
|
177 | if (!empty($ttl)) { |
|
178 | if ($ttl instanceof \DateInterval) { |
|
179 | $ttl = $ttl->s; |
|
180 | } elseif (!is_int($ttl)) { |
|
181 | throw new InvalidArgumentException('Invalid TTL specified'); |
|
182 | } |
|
183 | ||
184 | $expirationTimestamp = time() + $ttl; |
|
185 | $document[self::FIELD_NAME_EXPIRED] = new \MongoDate((int) $expirationTimestamp); |