<?php


namespace AutoAdmin\Bundle\Core\Setup;


class SetupManager
{
    /** @var SetupHandlerInterface[] */
    protected array $handlers = [];

    public function __construct(array $handlers = [])
    {
        $this->handlers = $handlers;
    }

    public function getHandlers(): array
    {
        return $this->handlers;
    }

    public function getCopySourcePaths(): array
    {
        $copySourcePaths = [];

        /** @var SetupHandlerInterface $handler */
        foreach ($this->handlers as $handler) {
            $paths = $handler->getCopySourcePaths();
            if (!empty($paths)) {
                foreach ($paths as $path) {
                    $copySourcePaths[get_class($handler)] = $paths;
                }
            }
        }

        return $copySourcePaths;
    }
}
