diff --git a/lib/Helpers/Array_Helper.php b/lib/Helpers/Array_Helper.php index 711c7b1..01f8da0 100644 --- a/lib/Helpers/Array_Helper.php +++ b/lib/Helpers/Array_Helper.php @@ -88,7 +88,7 @@ public static function after( array $subject, int $position ): array { * @return array */ public static function before( array $subject, int $position ): array { - return Array_Helper::diff( Array_Helper::after( $subject, $position ) ); + return Array_Helper::diff( Array_Helper::after( $subject, $position ), $subject ); } /** @@ -438,7 +438,7 @@ public static function flip( $array ): array { * @return array The normalized array * @throws \ReflectionException */ - public static function normalize( array $array, $convert_colsures = true, $recursive = true ): array { + public static function normalize(array $array, $convert_closures = true, $recursive = true ): array { foreach ( $array as $key => $value ) { // Normalize recursively. @@ -449,7 +449,7 @@ public static function normalize( array $array, $convert_colsures = true, $recur } // If closures need converted, and this is a closure, transform this into an identifiable string. - if ( true === $convert_colsures && $value instanceof Closure ) { + if (true === $convert_closures && $value instanceof Closure ) { $array[ $key ] = self::convert_closure( $value ); } } diff --git a/lib/Helpers/Processors/Array_Processor.php b/lib/Helpers/Processors/Array_Processor.php index 9c6db5d..488883e 100644 --- a/lib/Helpers/Processors/Array_Processor.php +++ b/lib/Helpers/Processors/Array_Processor.php @@ -152,7 +152,7 @@ public function merge( array ...$defaults ): static { * @return $this */ public function replace_recursive( array ...$items ): static { - $this->subject = Array_Helper::merge( $this->subject, ...$items ); + $this->subject = Array_Helper::replace_recursive( $this->subject, ...$items ); return $this; } @@ -165,7 +165,7 @@ public function replace_recursive( array ...$items ): static { * @return $this */ public function replace( array ...$items ): static { - $this->subject = Array_Helper::merge( $this->subject, ...$items ); + $this->subject = Array_Helper::replace( $this->subject, ...$items ); return $this; } @@ -205,8 +205,8 @@ public function append( ...$items ): static { * * @throws ReflectionException */ - public function normalize( $convert_colsures = true, $recursive = true ): static { - $this->subject = Array_Helper::normalize( $this->subject, $convert_colsures, $recursive ); + public function normalize($convert_closures = true, $recursive = true ): static { + $this->subject = Array_Helper::normalize( $this->subject, $convert_closures, $recursive ); return $this; }