From 7c8e2aa216bda36f5e3b9690444ba53e3558d782 Mon Sep 17 00:00:00 2001 From: antoninmasek Date: Mon, 26 Jun 2023 14:36:26 +0000 Subject: [PATCH] Fix styling --- src/Hydrator.php | 4 ++-- src/Support/Arr.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Hydrator.php b/src/Hydrator.php index c69d916..3004054 100755 --- a/src/Hydrator.php +++ b/src/Hydrator.php @@ -21,7 +21,7 @@ public static function hydrate(string $className, array $data = null): ?object return null; } - $data = Arr::mapKeys($data, function($key) { + $data = Arr::mapKeys($data, function ($key) { return Str::removeSpaces($key); }); @@ -29,7 +29,7 @@ public static function hydrate(string $className, array $data = null): ?object $publicProperties = $reflectionClass->getProperties(\ReflectionProperty::IS_PUBLIC); foreach ($publicProperties as $property) { - $value = array_key_exists($property->getName(),$data) + $value = array_key_exists($property->getName(), $data) ? $data[$property->getName()] : null; diff --git a/src/Support/Arr.php b/src/Support/Arr.php index aeba914..108b69b 100644 --- a/src/Support/Arr.php +++ b/src/Support/Arr.php @@ -36,7 +36,7 @@ public static function isList(array $array): bool */ public static function mapKeys(array $array, Closure $callback): array { - $newKeys = array_map( + $newKeys = array_map( $callback, array_keys($array), $array,