@param array $imports

@return array
772158
protected function setupFontAwesome(array $imports)
    {
        if (!$this->config->getUseFontAwesome()) {
            return $imports;
        }

        $this->lessFilter->addLoadPath($this->config->getFontAwesomePath() . '/less');

        if (false !== ($key = array_search('sprites.less', $imports))) {
            $imports[$key] = 'font-awesome.less';
        } else {
            $imports[] = 'font-awesome.less';
        }

        return $imports;
    }
649681
private function convertToClosures($tasks): array
    {
        $map = function ($task) {
            $params = $task[0];

            if ($task[1] == 'event') {
                return function () use ($params) {
                    resolve('events')->dispatch(...$params);
                };
            }

            return function () use ($params) {
                app()->call(...$params);
            };
        };

        return array_map($map, $tasks);
    }
1012568
public function addImport(Import $import)
    {
        if (isset($this->imports[$import->getClassName()])) {
            return $this;
        }

        $symbol = $import->getAlias() ?: $import->getShortClassName();

        if (isset($this->importedSymbols[$symbol])) {
            throw new RuntimeException(sprintf(
                'The symbol "%s" was imported already.',
                $import->getShortClassName()
            ));
        }

        $this->imports[$import->getClassName()] = $import;
        $this->importedSymbols[$symbol] = true;

        ksort($this->imports);

        return $this;
    }
371220
protected function formatRequirements(array $packages)
    {
        $requires = [];
        $packages = $this->normalizeRequirements($packages);
        foreach ($packages as $package) {
            $requires[$package['name']] = $package['version'];
        }

        return $requires;
    }
37530
public function getImportPaths($path = null)
    {
        if ($path === null) {
            return $this->importPaths;
        }

        return isset($this->importPaths[$path])
            ? $this->importPaths[$path]
            : [];
    }
253973
private function getSupportedPackages(array $packages)
    {
        $supported_packages = [];
        foreach ($packages as $package) {
            /* @var $package \Composer\Package\PackageInterface */
            if ($this->supportsPackage($package)) {
                $supported_packages[] = $package;
            }
        }
        return $supported_packages;
    }
1302842
protected function getNamespaces(LayoutUpdateImport $import)
    {
        $namespaces = [];
        if ($import->getParent()) {
            $namespaces = array_merge($namespaces, $this->getNamespaces($import->getParent()));
        }
        if ($import->getNamespace()) {
            array_push($namespaces, $import->getNamespace());
        }

        return $namespaces;
    }
404822
protected function checkModuleRelations(array $modules) : array
    {
        $modulesWithRelations = [];

        foreach ($modules as $name => $module) {
            $module['relations'] = [];
            foreach ($module as $field) {
                if (empty($field['type'])) {
                    continue;
                }
                if (strpos($field['type'], 'related') !== false) {
                    //get related module
                    $type = $this->getStringEnclosedInParenthesis($field['type']);
                    $module['relations'][] = $type;
                }
            }
            $modulesWithRelations[$name] = $module;
        }

        return $modulesWithRelations;
    }
570302
public function getWorksheets($import): array
    {
        // Csv doesn't have worksheets.
        if (!method_exists($this->reader, 'listWorksheetNames')) {
            return ['Worksheet' => $import];
        }

        $worksheets     = [];
        $worksheetNames = $this->reader->listWorksheetNames($this->currentFile->getLocalPath());
        if ($import instanceof WithMultipleSheets) {
            $sheetImports = $import->sheets();

            // Load specific sheets.
            if (method_exists($this->reader, 'setLoadSheetsOnly')) {
                $this->reader->setLoadSheetsOnly(array_keys($sheetImports));
            }

            foreach ($sheetImports as $index => $sheetImport) {
                // Translate index to name.
                if (is_numeric($index)) {
                    $index = $worksheetNames[$index] ?? $index;
                }

                // Specify with worksheet name should have which import.
                $worksheets[$index] = $sheetImport;
            }
        } else {
            // Each worksheet the same import class.
            foreach ($worksheetNames as $name) {
                $worksheets[$name] = $import;
            }
        }

        return $worksheets;
    }
6391
private function extractSupportedLoaders(array $loaders)
    {
        $supportedLoaders = [];

        foreach ($loaders as $loader) {
            if ($loader instanceof XmlFileLoader || $loader instanceof YamlFileLoader) {
                $supportedLoaders[] = $loader;
            } elseif ($loader instanceof LoaderChain) {
                $supportedLoaders = array_merge($supportedLoaders, $this->extractSupportedLoaders($loader->getLoaders()));
            }
        }

        return $supportedLoaders;
    }
337650
public function toModels(ToModel $import, array $attributes): Collection
    {
        $model = $import->model($attributes);

        if (null !== $model) {
            return \is_array($model) ? new Collection($model) : new Collection([$model]);
        }

        return new Collection([]);
    }
1207405
protected function assignToHandlers(array $objects)
    {
        $result = [];
        $perType = TypedUtils::groupByType($objects);
        foreach ($this->handlers as $handler) {
            $remainingTypes = array_keys($perType);
            $handlerTypes = $handler->getSupportedEntityTypes();
            $useTypes = $handlerTypes === null ? $remainingTypes : array_intersect($handlerTypes, $remainingTypes);
            if (count($useTypes) > 0) {
                $assigned = [];
                foreach ($useTypes as $type) {
                    $assigned[] = $perType[$type];
                    unset($perType[$type]);
                }
                $result[] = [$handler, Arrays::flatten($assigned)];
                if (count($perType) === 0) {
                    // Done
                    break;
                }
            }
        }

        return $result;
    }
1163303
public function removeExcludedTables(array $tables): array
    {
        if (!$tables) {
            return [];
        }

        $filteredTables = [];
        $excludedTables = array_merge(
            [$this->db->schema->getRawTableName($this->migrationTable)],
            $this->excludeTables
        );

        foreach ($tables as $table) {
            if (!in_array($table, $excludedTables, true)) {
                $filteredTables[] = $table;
            }
        }

        return $filteredTables;
    }
575881
public function getMigrationsDefinitions(array $paths = array())
    {
        // we try to be flexible in file types we support, and the same time avoid loading all files in a directory
        $handledDefinitions = array();
        foreach ($this->loader->listAvailableDefinitions($paths) as $migrationName => $definitionPath) {
            foreach ($this->DefinitionParsers as $definitionParser) {
                if ($definitionParser->supports($migrationName)) {
                    $handledDefinitions[] = $definitionPath;
                }
            }
        }

        // we can not call loadDefinitions with an empty array using the Filesystem loader, or it will start looking in bundles...
        if (empty($handledDefinitions) && !empty($paths)) {
            return new MigrationDefinitionCollection();
        }

        return $this->loader->loadDefinitions($handledDefinitions);
    }
585186
protected function filterImportFiles(array $imports)
    {
        $config             = $this->config;
        $excludedComponents = $config->getExcludedComponents();
        $includedComponents = $config->getIncludedComponents();

        if (!empty($excludedComponents) && !empty($includedComponents)) {
            throw new Exception\RuntimeException(
                'You may not set both excluded and included components.'
            );
        }

        if (!empty($excludedComponents)) {
            $imports = $this->removeImportFiles($imports, $excludedComponents);
        } elseif (!empty($includedComponents)) {
            $imports = $this->addImportFiles($imports, $includedComponents);
        }

        $imports = $this->setupFontAwesome($imports);

        array_walk($imports, function (&$val) {
            $val = "@import \"$val\";";
        });

        return implode(PHP_EOL, $imports);
    }
883401
protected function bootstrap(array $classes): array
    {
        foreach ($classes as $index => $class) {
            $classes[$index] = $this->app->make($class)->bootstrap();
        }

        return $classes;
    }
61970
protected function map(array $packages): array
    {
        $manifest = [];

        $packages = array_filter($packages, function ($package) {
            return $package['type'] === self::PACKAGE_TYPE;
        });

        foreach ($packages as $package) {
            $manifest[$package['name']] = [self::EXTRA_OBSERVER => $package['extra'][self::EXTRA_OBSERVER] ?? []];
        }

        return $manifest;
    }