@param FilesCollection $filesCollection

@return array
334119
private function getJsonFiles(FilesCollection $filesCollection)
    {
        $jsonFiles = [];

        foreach ($filesCollection->getFiles() as $file) {
            if (true === (bool)preg_match('/^(.*)(\.json)$/', $file->value())) {
                $jsonFiles[] = $file->value();
            }
        }

        return $jsonFiles;
    }
784412
private function retrieveFiles($filesProvider): iterable
    {
        if ($filesProvider instanceof Finder) {
            return $filesProvider->files();
        }

        if (is_string($filesProvider)) {
            return (new Finder())->in($filesProvider)->files();
        }

        if (is_array($filesProvider)) {
            Assert::allIsInstanceOf($filesProvider, \SplFileInfo::class, 'When using array all files need to implement SPLFileInfo');

            return $filesProvider;
        }

        throw new \LogicException(sprintf('Invalid files provider type: "%s', gettype($filesProvider)));
    }
316714
protected function getFilePayload(?array $files) : ?array
    {
        if (empty($files)) {
            return null;
        }

        $files = array_filter($files, function($file) {
            return $file instanceof ResourceSettings || (isset($file['key']) && isset($file['filename']));
        });

        return $files;
    }
181189
public static function normalizeFilesArray(array $files): array
    {
        $return = [];
        foreach ($files as $i => $file) {
            foreach ($file as $key => $value) {
                $return[$key][$i] = $value;
            }
        }

        return $return;
    }
1266297
public function findDemoFileObjects(): array
    {
        /** @var StorageRepository $storageRepository */
        $storageRepository = GeneralUtility::makeInstance(StorageRepository::class);
        $storage = $storageRepository->findByUid(1);
        $folder = $storage->getRootLevelFolder();
        $folder = $folder->getSubfolder('styleguide');
        return $folder->getFiles();
    }
668543
private function serializeTypes(TypeCollection $types)
    {
        $typesData = [];
        /** @var Type $type */
        foreach ($types as $type) {
            $typesData[] = $type->getType();
        }

        return $typesData;
    }
1314495
public function locateInFolders(array $folders, $filename = null)
    {
        $list = [];
        foreach ($folders as $folder) {
            $path = trim(Folder::getRelativePath($folder), '/');
            $list[$path] = $this->detectInFolder($folder, $filename);
        }
        return $list;
    }
80204
protected static function _sourceFiles($collector)
    {
        $result = [];
        foreach ($collector->export() as $file => $data) {
            $content = file_get_contents($file);
            $nbLines = substr_count($content, "\n");

            $lines = [];
            for ($i = 0; $i <= $nbLines; $i++) {
                $lines[] = isset($data[$i]) ? $data[$i] : null;
            }

            $result[] = [
                'name'     => $file,
                'coverage' => json_encode($lines),
                'blob_id'  => sha1('blob ' . strlen($content) . "\0" . $content)
            ];
        }

        return $result;
    }
1179335
protected function prepareFiles($files) {
    $values = [];

    foreach ($files as $file_uuid) {
      $file = $this->fileStorage->loadByProperties([
        'uuid' => $file_uuid,
      ]);

      if ($file) {
        $values[] = [
          'target_id' => current($file)->id(),
        ];
      }
    }

    return $values;
  }
1207711
public function files()
    {
        $filesList = array_filter($this->items, function($item) {
            return ($item['instance'] instanceof FileInterface);
        });

        $filesList = array_map(function($item) {
            return $item['instance'];
        }, $filesList);

        return new Collection($filesList);
    }
300512
public function getViolations(RuleSet $ruleSet, array $files)
    {
        $result = array();
        foreach ($files as $i => $file) {
            $unfilteredResult = $this->violationChecker->check($file, $ruleSet);
            foreach ($unfilteredResult as $unfilteredViolation) {
                if (false === $this->violationFilter->isViolationFiltered($unfilteredViolation)) {
                    $result[] = $unfilteredViolation;
                }
            }
        }

        return $result;
    }
1730
public static function createFromFilesGlobal(array $files) : array
    {
        $items = [];
        $files = self::normalizeSuperglobal($files);
        self::buildMap($files, $items);

        return $items;
    }
337356
private function groupStaticRoutes(RouteCollection $collection): array
    {
        $staticRoutes = $dynamicRegex = [];
        $dynamicRoutes = new RouteCollection();

        foreach ($collection->all() as $name => $route) {
            $compiledRoute = $route->compile();
            $regex = $compiledRoute->getRegex();

            if (!$compiledRoute->getVariables()) {
                $pattern = $route->getPattern();

                foreach ($dynamicRegex as $rx) {
                    if (preg_match($rx, $pattern)) {
                        $dynamicRegex[] = $regex;
                        $dynamicRoutes->add($name, $route);
                        continue 2;
                    }
                }

                $staticRoutes[$pattern][$name] = $route;
            } else {
                $dynamicRegex[] = $regex;
                $dynamicRoutes->add($name, $route);
            }
        }

        return [$staticRoutes, $dynamicRoutes];
    }
38449
public function getObjectsByCollection(CollectionInterface $collection)
    {
        $objects = array();
        $that = $this;
        $bucketName = $this->bucketName;

        foreach ($this->resourceRepository->findByCollectionName($collection->getName()) as $resource) {
            /** @var \Neos\Flow\ResourceManagement\PersistentResource $resource */
            $object = new StorageObject();
            $object->setFilename($resource->getFilename());
            $object->setSha1($resource->getSha1());
            $object->setStream(function () use ($that, $bucketName, $resource) {
                return fopen('s3://' . $bucketName . '/' . $this->keyPrefix . $resource->getSha1(), 'r');
            });
            $objects[] = $object;
        }

        return $objects;
    }
270208
public function read(Collection $files, Collection $locales)
    {
        return $locales->reduce(function ($translations, $locale) use ($files) {
            $files->each(function ($file) use ($locale, &$translations) {
                if (file_exists($path = $this->pathToFile($file, $locale))) {
                    $content[$file] = include_once $path;

                    foreach (array_dot($content) as $key => $value) {
                        $translations[$key][$locale->iso6391()] = $value ? $value : '';
                    }
                }
            });

            return $translations;
        }, []);
    }
1245897
public function insertFileUploadFolders(array $collection) {
		$timeStamp = microtime(true);

		$countInserts = 0;
		$insertedItems = [];
		foreach($collection as $data){
			if($data instanceof BundleEntity\FileUploadFolder){
				$entity = $data;
				$this->em->persist($entity);
				$insertedItems[] = $entity;
				$countInserts++;
			}
			else if(is_object($data)){
				$entity = new BundleEntity\FileUploadFolder();
				foreach($data as $column => $value){
					$set = 'set'.$this->translateColumnName($column);
					switch($column){
						case 'site':
							$sModel = $this->kernel->getContainer()->get('sitemanagement.model');
							$response = $sModel->getSite($value);
							if(!$response->error->exist){
								$entity->$set($response->result->set);
							}
							unset($response, $sModel);
							break;
						default:
							$entity->$set($value);
							break;
					}
				}
				$this->em->persist($entity);
				$insertedItems[] = $entity;
				$countInserts++;
			}
		}
		if($countInserts > 0){
			$this->em->flush();
			return new ModelResponse($insertedItems, $countInserts, 0, null, false, 'S:D:003', 'Selected entries have been successfully inserted into database.', $timeStamp, microtime(true));
		}
		return new ModelResponse(null, 0, 0, null, true, 'E:D:003', 'One or more entities cannot be inserted into database.', $timeStamp, microtime(true));
	}
211277
public static function findFileReferenceObjects(array $fileUids)
    {
        $entities = new ObjectStorage();

        if (!empty($fileUids)) {
            $resourceFactory = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\ResourceFactory');

            foreach ($fileUids as $uid) {
                $fileReference = $resourceFactory->getFileReferenceObject($uid);
                $entities->attach($fileReference->getProperties());
            }
        }

        return $entities;
    }