private static function loadDefinitionsFromPath(string $path): array
    {
        if (!\file_exists($path)) {
            throw new \RuntimeException(\sprintf('Path "%s" does not exist', $path));
        }

        if (!\is_dir($path)) {
            return self::loadDefinitionsFromFile($path);
        }

        $definitions = [];
        foreach (\glob($path . '/*.php', \GLOB_ERR) as $file) {
            if (\is_file($file)) {
                $definitions[] = self::loadDefinitionsFromFile($file);
            }
        }

        return \count($definitions) === 0 ? [] : \array_merge(...$definitions);
    }