Skip to content

Commit 103b71e

Browse files
lucasmichottaylorotwell
authored andcommitted
[5.5] Use InteractsWithTime (#20206)
* Use InteractsWithTime * Fix StyleCI
1 parent 5e168ef commit 103b71e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Illuminate/Cache/Repository.php

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Closure;
66
use ArrayAccess;
7-
use DateInterval;
87
use DateTimeInterface;
98
use BadMethodCallException;
109
use Illuminate\Support\Carbon;
@@ -14,11 +13,13 @@
1413
use Illuminate\Cache\Events\CacheMissed;
1514
use Illuminate\Support\Traits\Macroable;
1615
use Illuminate\Cache\Events\KeyForgotten;
16+
use Illuminate\Support\InteractsWithTime;
1717
use Illuminate\Contracts\Events\Dispatcher;
1818
use Illuminate\Contracts\Cache\Repository as CacheContract;
1919

2020
class Repository implements CacheContract, ArrayAccess
2121
{
22+
use InteractsWithTime;
2223
use Macroable {
2324
__call as macroCall;
2425
}
@@ -483,9 +484,7 @@ public function offsetUnset($key)
483484
*/
484485
protected function getMinutes($duration)
485486
{
486-
if ($duration instanceof DateInterval) {
487-
$duration = Carbon::now()->add($duration);
488-
}
487+
$duration = $this->parseDateInterval($duration);
489488

490489
if ($duration instanceof DateTimeInterface) {
491490
$duration = Carbon::now()->diffInSeconds(Carbon::createFromTimestamp($duration->getTimestamp()), false) / 60;

0 commit comments

Comments
 (0)