Skip to content

Commit

Permalink
Revert Array Conversion
Browse files Browse the repository at this point in the history
Signed-off-by: Raj Mohan <[email protected]>
  • Loading branch information
cod43156 committed Jan 7, 2025
1 parent 0ce6f56 commit 61ed108
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions src/StorageFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -310,28 +310,14 @@ public static function pluginFactory($pluginName, $options = []): Storage\Plugin

if ($options !== []) {
if (! $options instanceof Storage\Plugin\PluginOptions) {
$options = new PluginOptions(self::convertArrayToIterable($options));
$options = new PluginOptions($options);
}
$plugin->setOptions($options);
}

return $plugin;
}

/**
* Convert a non-empty-array<array-key, mixed> to iterable<string, mixed>
*
* @param non-empty-array<array-key, mixed> $array
* @return iterable<string, mixed>
*/
private static function convertArrayToIterable(array $array): iterable
{
/** @var mixed $value */
foreach ($array as $key => $value) {
yield (string) $key => $value;
}
}

public static function getPluginManager(): Storage\PluginManager
{
if (self::$plugins === null) {
Expand Down

0 comments on commit 61ed108

Please sign in to comment.