loadRoutingFromFiles

@param array $files

@return  array
553050
public static function loadRoutingFiles(array $files)
    {
        $routing = new Structure();

        foreach ($files as $file) {
            if (!in_array(pathinfo($file, PATHINFO_EXTENSION), ['json', 'yml', 'yaml'])) {
                continue;
            }

            $routing = $routing->loadFile($file, pathinfo($file, PATHINFO_EXTENSION));
        }

        return $routing->toArray();
    }
437345
public function loadFiles($files)
    {
        $files = (array) $files;

        $success = true;
        foreach ($files as $file) {

            $this->loadFile($file);
        }
        return true;
    }
95651
public function load($file, $type = null)
    {
        $path = $this->locator->locate($file);

        $collection = new RouteCollection();
        if ($class = $this->findClass($path)) {
            // module file resource
            $collection->addResource(new FileResource($path));

            // module instance
            $module = $this->moduleManager->get($class);

            // routes prefixes
            $routeNamePrefix = $module->getRouteNamePrefix();
            $routePatternPrefix = $module->getRoutePatternPrefix();

            // route actions
            foreach ($module->getRouteActions() as $action) {
                // action file resource
                $reflection = new \ReflectionObject($action);
                $collection->addResource(new FileResource($reflection->getFileName()));

                // name (module prefix + action suffix)
                $name = $routeNamePrefix.$action->getRouteName();
                // pattern (module prefix + action suffix)
                if ('/' === $action->getRoutePattern() && '' !== $routePatternPrefix) {
                    $pattern = $routePatternPrefix;
                } else {
                    $pattern = $routePatternPrefix.$action->getRoutePattern();
                }
                // defaults (action defaults + defaults needed to execute)
                $defaults = array_merge($action->getRouteDefaults(), array(
                    '_controller' => 'PablodipModuleBundle:Module:execute',
                    '_module.module' => $class,
                    '_module.action' => $action->getName(),
                ));
                // requirements (just from the action)
                $requirements = $action->getRouteRequirements();
                // options (from the action)
                $options = $action->getRouteOptions();

                $collection->add($name, new Route($pattern, $defaults, $requirements, $options));
            }
        }

        return $collection;
    }
1243167
private function loadLocaleFiles($path)
    {
        $files = [];

        foreach ($this->filesystem->allFiles($path) as $file) {
            /** @var \Symfony\Component\Finder\SplFileInfo $file */
            $key = str_replace(
                ['.php', DS], ['', '.'], $file->getRelativePathname()
            );

            $files[$key] = [
                'path'    => $file->getRealPath(),
                'content' => $this->filesystem->getRequire($file),
            ];
        }

        return $files;
    }
1041069
public function createUploadedFilesFromArray(array $files)
    {
        $uploadedFiles = [];

        if (isset($files['tmp_name']) && ! is_array($files['tmp_name'])) {
            $uploadedFiles[] = $this->createUploadedFile(
                $files['tmp_name'],
                $files['size'],
                $files['error'],
                $files['name'],
                $files['type']
            );
        } elseif (isset($files['tmp_name']) && is_array($files['tmp_name'])) {
            foreach ($files['tmp_name'] as $key => $file) {
                $uploadedFiles[] = $this->createUploadedFile(
                    $file,
                    $files['size'][$key],
                    $files['error'][$key],
                    $files['name'][$key],
                    $files['type'][$key]
                );
            }
        } else {
            foreach ($files as $key => $value) {
                $uploadedFiles[$key] = $this->createUploadedFilesFromArray($value);
            }
        }

        return $uploadedFiles;
    }
601296
public function loadCollections(array $collections)
    {
        foreach ($collections as $subDir => $files) {
            if (is_array($files) and count($files)) {

                // normalize the subDirectory with a trailing separator
                $subDir = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $subDir);
                $subDir = rtrim($subDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;

                foreach ($files as $file) {
                    if (strpos($file, 'http') !== false) {
                        $this->loadUrl($file, $subDir);
                    } else {
                        $this->loadFile($file, $subDir);
                    }
                }
            } elseif (is_string($files)) {
                $this->loadFile($files);
            }
        }
    }
128282
private static function retrieveFilesFromPaths(array $paths): iterable
    {
        if ([] === $paths) {
            return [];
        }

        $pathsToSearch = [];
        $filesToAppend = [];

        foreach ($paths as $path) {
            if (false === file_exists($path)) {
                throw new RuntimeException(
                    sprintf(
                        'Could not find the file "%s".',
                        $path
                    )
                );
            }

            if (is_dir($path)) {
                $pathsToSearch[] = $path;
            } else {
                $filesToAppend[] = $path;
            }
        }

        $finder = new Finder();

        $finder->files()
            ->in($pathsToSearch)
            ->append($filesToAppend)
            ->filter(static function (SplFileInfo $fileInfo): ?bool {
                if ($fileInfo->isLink()) {
                    return false;
                }

                return null;
            })
            ->sortByName()
        ;

        return $finder;
    }
617971
protected function load(array $files = null)
    {
        $defaults = [
            'bindings' => null,
            'providers' => null,
            'minimal' => null,
            'config' => null,
            'subscribers' => null,
            'routes' => null,
            'modules' => null
        ];

        is_array($files) ? extract($files) : extract($defaults);

        $bindings = isset($bindings) ? $bindings : null;
        ArrayLoader::bindings(Config::paths('system') . $bindings);

        $providers = isset($providers) ? $providers : null;
        ArrayLoader::providers(Config::paths('system') . $providers);

        $minimal = isset($minimal) ? $minimal : null;
        ArrayLoader::config(Config::paths('system') . $minimal);

        $config = isset($config) ? $config : null;
        ArrayLoader::config(Config::paths('system') . $config);

        $subscribers = isset($subscribers) ? $subscribers : null;
        ArrayLoader::subscribers(Config::paths('system') . $subscribers);

        $routes = isset($routes) ? $routes : null;
        ArrayLoader::routes(Config::paths('system') . $routes);

        $modules = isset($modules) ? $modules : null;
        ArrayLoader::modules(Config::paths('system') . $modules);

    }
657369
public function loadFromDirectory($path)
    {
        return $this->file->listFiles($path)->mapWithKeys(function ($file, $key) {
            return [$key => $this->loadFile($file)];
        });
    }
552337
protected function setUploadedFiles(array $files)
    {
        $validate = function ($files) use (&$validate) {
            foreach ($files as $item) {
                if (is_array($item)) {
                    $validate($item);
                    continue;
                }
                if (! $item instanceof UploadedFileInterface) {
                    throw new InvalidArgumentException(
                        'Invalid structure of uploaded files provided.'
                    );
                }
            }
        };
        $validate($files);
        $this->uploadedFiles = $files;

        return $this;
    }
74887
final protected function loadArray($file)
    {
        if (is_file($file)) {
            $array = include($file);

            if (is_array($array)) {
                return $array;
            } else {
                trigger_error(sprintf('Included file "%s" should return an array not %s', $file, gettype($array)));
            }

        } else {
            return array();
        }
    }
1243339
protected function loadMigrations(array $files, ?string $namespace) : array
    {
        $includedFiles = [];
        foreach ($files as $file) {
            static::requireOnce($file);

            $realFile = realpath($file);
            assert($realFile !== false);

            $includedFiles[] = $realFile;
        }

        $classes  = $this->loadMigrationClasses($includedFiles, $namespace);
        $versions = [];
        foreach ($classes as $class) {
            $version = substr($class->getShortName(), 7);

            if ($version === '0') {
                throw NameIsReserved::new($version);
            }

            $versions[$version] = $class->getName();
        }

        ksort($versions, SORT_STRING);

        return $versions;
    }
767017
public function loadRoutes()
    {
        $routesJsonFile = $this->configDir . '/routes.json';
        $routesPhpFile = $this->configDir . '/routes.php';
        
        if (file_exists($this->resourcesDir) && file_exists($this->configDir)) {
            if (file_exists($routesJsonFile))
                return json_decode(file_get_contents($routesJsonFile), true);
            elseif (file_exists($routesPhpFile))
                return require_once $routesPhpFile;
        } else {
            return array();
        }
    }
1105402
protected function getFilenames(Collection $files)
    {
        $paths = $files->getFilenames();
        if (count($paths) < 1) {
            throw new FilesNotFoundException();
        }
        $this->log('Starting to process ' . count($paths) . ' files');

        return $paths;
    }
1043140
public function load($files)
    {
        $files = (! is_array($files)) ? (array) $files : $files;

        foreach ($files as $file) {
            synapse()->brain->teach($file);
        }
    }
61461
protected function registerRoutes($files = null)
    {
        $path = $this->getBasePath() . '/' . $this->convention->routesFolder();

        if (is_dir($path)) {
            $routes = is_array($files) ? $files : collect(File::glob($path . '/*.php'))->map(function ($file) {
                return File::name($file);
            })->all();

            foreach ($routes as $route) {
                Route::group(
                    [
                        'namespace'  => $this->config('routes.namespace', $this->getDefaultRouteNamespace()),
                        'prefix'     => $this->config('routes.prefix', $this->shortName()),
                        'as'         => $this->config('routes.as', $this->shortName() . '.'),
                        'middleware' => $this->config('routes.middleware', ['web'])
                    ],
                    sprintf('%s/%s.php', $path, $route)
                );
            }
        }
    }
374756
private static function convertFilesArray($files) {
		
		$result = [];

		foreach($files as $field => $data) {
			
			foreach($data as $key => $val) {
				
				$result[$field] = [];
				
				if(false === is_array($val)) {
					$result[$field] = $data;
				} 
				else {
					
					$res = [];
					static :: filesFlip($res, [], $data);
					$result[$field] += $res;
				}
			}
		}

		return $result;
	}