Extracted the DI loading of an array from the YamlFileLoader

This allows to reuse the logic easily for other loaders needing to extract
data from an array.