Skip to content

Commit c3373f1

Browse files
committed
refactor: modify method name of ParseArray trait
1 parent fada55f commit c3373f1

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/Concerns/ParseArray.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ trait ParseArray
1717
* @param mixed $default
1818
* @return mixed
1919
*/
20-
public static function get($array, $key, $default = null)
20+
private static function parseArray($array, $key, $default = null)
2121
{
22-
if (! static::accessible($array)) {
22+
if (! static::isValueAccessible($array)) {
2323
return value($default);
2424
}
2525

2626
if (is_null($key)) {
2727
return $array;
2828
}
2929

30-
if (static::exists($array, $key)) {
30+
if (static::isKeyExists($array, $key)) {
3131
return $array[$key];
3232
}
3333

@@ -36,7 +36,7 @@ public static function get($array, $key, $default = null)
3636
}
3737

3838
foreach (explode('.', $key) as $segment) {
39-
if (static::accessible($array) && static::exists($array, $segment)) {
39+
if (static::isValueAccessible($array) && static::isKeyExists($array, $segment)) {
4040
$array = $array[$segment];
4141
} else {
4242
return value($default);
@@ -52,7 +52,7 @@ public static function get($array, $key, $default = null)
5252
* @param mixed $value
5353
* @return bool
5454
*/
55-
public static function accessible($value)
55+
private static function isValueAccessible($value)
5656
{
5757
return is_array($value) || $value instanceof ArrayAccess;
5858
}
@@ -64,7 +64,7 @@ public static function accessible($value)
6464
* @param string|int $key
6565
* @return bool
6666
*/
67-
public static function exists($array, $key)
67+
private static function isKeyExists($array, $key)
6868
{
6969
if ($array instanceof ArrayAccess) {
7070
return $array->offsetExists($key);

src/Concerns/ParseInstalledPackages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function setInstalledJsonPath(?string $installedJsonPath)
1818

1919
protected function parsePackageComposer(string $packageName, string $key, $default = null)
2020
{
21-
return self::get($this->packageComposer($packageName), $key, $default);
21+
return self::parseArray($this->packageComposer($packageName), $key, $default);
2222
}
2323

2424
protected function packageComposer(string $templatePackageName): array

0 commit comments

Comments
 (0)