diff --git a/src/Component/Action/KeyMapperAction.php b/src/Component/Action/KeyMapperAction.php index 99f1db6c..c360c470 100644 --- a/src/Component/Action/KeyMapperAction.php +++ b/src/Component/Action/KeyMapperAction.php @@ -33,7 +33,7 @@ public function apply(array $item): array return $item; } - $list = $this->getOption('list'); + $list = array_filter($this->getOption('list')); // when dealing with converted data we need the primary keys // we just need to replace these keys $newList = []; diff --git a/src/Component/Debugger/ItemDebugger.php b/src/Component/Debugger/ItemDebugger.php index dbf5ca9d..fc0d2311 100644 --- a/src/Component/Debugger/ItemDebugger.php +++ b/src/Component/Debugger/ItemDebugger.php @@ -8,6 +8,7 @@ class ItemDebugger { public function log($item, $message) { - dump($message, TypeGuesser::guess($item)); + dump($message, $item); + //dump($message, TypeGuesser::guess($item)); } } \ No newline at end of file diff --git a/src/Component/Source/Command/SourceKeyValueCommand.php b/src/Component/Source/Command/SourceKeyValueCommand.php index 6bc2294d..9c181217 100644 --- a/src/Component/Source/Command/SourceKeyValueCommand.php +++ b/src/Component/Source/Command/SourceKeyValueCommand.php @@ -17,17 +17,24 @@ class SourceKeyValueCommand implements SourceAwareInterface, ExecuteSourceComman 'list' => null, 'key' => null, 'value' => null, - 'key_prefix' => '' + 'key_prefix' => '', + 'display_empty_values' => true, ]; public function execute(): array { - return KeyValuePairBuilder::build( + $list = KeyValuePairBuilder::build( $this->getSource()->getCachedReader(), $this->getOption('key'), $this->getOption('value'), $this->getOption('key_prefix'), ); + + if (true !== $this->getOption('display_empty_values')) { + return array_filter($list); + } + + return $list; } public function executeWithOptions(array $options)