Skip to content

Commit 05a23cc

Browse files
committed
fix: change data_get to Arr::get
1 parent 4b0fa86 commit 05a23cc

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

src/Entity.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Countable;
1313
use Illuminate\Contracts\Support\Arrayable;
1414
use Illuminate\Contracts\Support\Jsonable;
15+
use Illuminate\Support\Arr;
1516
use Illuminate\Support\Collection;
1617
use Illuminate\Support\Str;
1718
use InvalidArgumentException;
@@ -356,7 +357,7 @@ public function __debugInfo(): array
356357
*/
357358
public function meta(string $key = null, mixed $default = null): mixed
358359
{
359-
return null !== $key ? data_get($this->meta, $key, $default) : $this->meta;
360+
return null !== $key ? Arr::get($this->meta, $key, $default) : $this->meta;
360361
}
361362

362363
/**
@@ -369,7 +370,7 @@ public function meta(string $key = null, mixed $default = null): mixed
369370
*/
370371
public function origin(string $key = null, mixed $default = null): mixed
371372
{
372-
return null !== $key ? data_get($this->originAttributes, $key, $default) : $this->originAttributes;
373+
return null !== $key ? Arr::get($this->originAttributes, $key, $default) : $this->originAttributes;
373374
}
374375

375376
/**
@@ -453,7 +454,7 @@ public function only(array $keys): static
453454

454455
foreach ($keys as $key) {
455456
if ($this->offsetExists($key)) {
456-
data_set($array, $key, $this->offsetGet($key));
457+
Arr::set($array, $key, $this->offsetGet($key));
457458
}
458459
}
459460

@@ -491,7 +492,7 @@ public function toJson($options = 0): string
491492
*/
492493
public function offsetGet(mixed $offset): mixed
493494
{
494-
return data_get($this->attributes, $offset);
495+
return Arr::get($this->attributes, $offset);
495496
}
496497

497498
/**
@@ -517,15 +518,15 @@ public function offsetExists(mixed $offset): bool
517518
*/
518519
public function offsetSet(mixed $offset, mixed $value): void
519520
{
520-
data_set($this->attributes, $offset, $value);
521+
Arr::set($this->attributes, $offset, $value);
521522
}
522523

523524
/**
524525
* {@inheritDoc}
525526
*/
526527
public function offsetUnset(mixed $offset): void
527528
{
528-
data_forget($this->attributes, $offset);
529+
Arr::forget($this->attributes, $offset);
529530
}
530531

531532
/**

src/Response.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Carbon\Carbon;
99
use DateTimeInterface;
1010
use Illuminate\Http\Client\Response as HttpResponse;
11+
use Illuminate\Support\Arr;
1112
use LogicException;
1213
use Psr\Http\Message\MessageInterface;
1314
use Serializable;
@@ -112,7 +113,7 @@ public function meta(string $key = null, mixed $default = null): mixed
112113
{
113114
$meta = $this->offsetGet('meta') ?? [];
114115

115-
return null !== $key ? data_get($meta, $key, $default) : $meta;
116+
return null !== $key ? Arr::get($meta, $key, $default) : $meta;
116117
}
117118

118119
/**
@@ -124,7 +125,7 @@ public function data(string $key = null, mixed $default = null): mixed
124125
{
125126
$data = $this->offsetGet('data') ?? [];
126127

127-
return null !== $key ? data_get($data, $key, $default) : $data;
128+
return null !== $key ? Arr::get($data, $key, $default) : $data;
128129
}
129130

130131
/**

0 commit comments

Comments
 (0)