diff --git a/src/Concealer.php b/src/Concealer.php index e0385dc..d795053 100644 --- a/src/Concealer.php +++ b/src/Concealer.php @@ -48,7 +48,7 @@ public function conceal($input, array $keys = []) private function handleCollection($input) { $output = $input->map(function ($item, $key) { - if (in_array($key, $this->keys) === true) { + if (in_array($key, $this->keys, true) === true) { return $input[$key] = '********'; } @@ -75,7 +75,7 @@ private function handleCollection($input) private function handleArray($input) { foreach ($input as $key => $item) { - if (in_array($key, $this->keys) === true) { + if (in_array($key, $this->keys, true) === true) { $input[$key] = '********'; continue; } diff --git a/tests/ConcealerTest.php b/tests/ConcealerTest.php index a497f86..2b47f58 100644 --- a/tests/ConcealerTest.php +++ b/tests/ConcealerTest.php @@ -199,13 +199,25 @@ public function it_handles_numeric_keys_for_collections(): void 'password' => new Collection([ 'test', 'secret', - ]) + ]), + 'test' => new Collection([ + 'test', + 'secret', + ]), + 'test2' => [ + 'test', + 'secret', + ] ]); $output = $this->concealer->conceal($data); $this->assertEquals('wouter', $output['username']); $this->assertEquals('********', $output['password']); + $this->assertEquals('test', $output['test'][0]); + $this->assertEquals('secret', $output['test'][1]); + $this->assertEquals('test', $output['test2'][0]); + $this->assertEquals('secret', $output['test2'][1]); } /** @test */