# code-snippets/3.10.0/vendor/typisttech/imposter/src/ConfigCollection.php

Code Snippets, version 3.10.0. 44 lines.

- Page: https://pluginprobe.com/plugins/code-snippets/3.10.0/code/vendor/typisttech/imposter/src/ConfigCollection.php
- Raw: https://pluginprobe.com/plugins/code-snippets/3.10.0/raw/vendor/typisttech/imposter/src/ConfigCollection.php
- Modified: 2025-10-16T19:08:06+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/code-snippets/3.10.0/code/vendor/typisttech/imposter/src/ConfigCollection.php#L10-L20`.

```php
<?php

declare(strict_types=1);

namespace TypistTech\Imposter;

class ConfigCollection implements ConfigCollectionInterface
{
    /**
     * @var ConfigInterface[]
     */
    private $configs = [];

    /**
     * @param ConfigInterface $config
     *
     * @return void
     */
    public function add(ConfigInterface $config)
    {
        $this->configs[$config->getPackageDir()] = $config;
    }

    /**
     * @return string[]
     */
    public function getAutoloads(): array
    {
        $autoloads = ArrayUtil::flattenMap(function (ConfigInterface $config) {
            return $config->getAutoloads();
        }, $this->all());

        return array_unique($autoloads);
    }

    /**
     * @return ConfigInterface[]
     */
    public function all(): array
    {
        return $this->configs;
    }
}

```
