@param FilesInterface $files

@throws \ReflectionException
172879
public function perform(FilesInterface $files)
    {
        if (!$this->verifyConfigured()) {
            return;
        }

        if (empty($this->migrator->getMigrations())) {
            $this->writeln("<comment>No migrations were found.</comment>");

            return;
        }

        $table = $this->table(['Migration', 'Filename', 'Created at', 'Executed at']);
        foreach ($this->migrator->getMigrations() as $migration) {
            $filename = (new \ReflectionClass($migration))->getFileName();

            $state = $migration->getState();

            $table->addRow([
                $state->getName(),
                '<comment>'
                . $files->relativePath($filename, $this->config->getDirectory())
                . '</comment>',
                $state->getTimeCreated()->format('Y-m-d H:i:s'),
                $state->getStatus() == State::STATUS_PENDING
                    ? self::PENDING
                    : '<info>' . $state->getTimeExecuted()->format('Y-m-d H:i:s') . '</info>'
            ]);
        }

        $table->render();
    }
29987
public function delete(KeyInterface $key)
    {
        if ($this->exists($key)) {
            $this->fileService->delete($key->getKeyName());
        }
    }
742353
private function getImage(FileInterface $file) {
    // Make sure we deal with a file.
    $image_factory = \Drupal::service('image.factory');

    return $image_factory->get($file->getFileUri());
  }
694970
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $files = $input->getArgument('files');
        $fileSuffix = ' -f ' . implode(' -f ', $files);

        $command = sprintf('%s stop -d', $fileSuffix);
        $response = $this->getFacade()->runDockerCompose($command);

        if ($output->isVerbose()) {
            $output->writeln($response);
        }
    }
507105
private function getRelatedFiles(FileInterface $file)
    {
        // Match foo(_local).*(.dist)
        $base = $file->getFilename();
        $ext = Path::getExtension($base);
        $base = Path::getFilenameWithoutExtension($base);
        $base = Str::replaceLast($base, '_local', '');

        $dir = $file->getParent();
        $related = [];
        foreach ([".$ext", "_local.$ext"] as $tail) {
            $f = $dir->getFile($base . $tail);
            if ($f->getFilename() !== $file->getFilename() && $f->exists()) {
                $related[] = $f;
            }
        }

        return $related;
    }
1109651
protected function initialize(InputInterface $input, OutputInterface $output)
    {
        $this->input = $input;
        $this->output = $output;
        $this->formatter = $this->getHelper('formatter');
        $this->fs = new Filesystem();
    }
679547
public function downloadFile(FileInterface $file)
    {
        /**
         * @var string $content
         */
        $content = $this
            ->filesystem
            ->read($this
                ->fileIdentifierTransformer
                ->transform($file)
            );

        $file->setContent($content);

        return $file;
    }
1362292
public function findFiles(FileNodeCollectionInterface $files)
    {
        return $files->filter(function (FileNode $file) {
            $metadata = $file->getMetadata();
            if ($metadata) {
                return ($this->filter->matches($file->getMetadata()));
            } else {
                return false;
            }
        });
    }
1255815
public function setFiles($files = [])
    {
        if (!$files instanceof FileBag) {
            $files = new FileBag($files);
        }

        $this->_files = $files;
    }
643409
public function load($files)
    {
        if (!is_array($files)) {
            $files = [$files];
        }
        foreach ($files as $file) {
            $file = new File($file);
            $extName = $file->extName();
            if ($extName == 'json') {
                $data = json_decode($file->readAll(), true);
                if (!$data) {
                    throw new \Exception("File '{$file}' is not valid JSON");
                }
            } else {
                $data = require (string) $file;
            }
            $this->fromArray($data);
        }
    }
252357
protected function registerAssets($files)
    {
        foreach ($files as $type => $_files) {
            if ($type == 'script') {
                foreach ($_files as $file) {
                    $this->view->registerJsFile($this->assetUrl . $file);
                }
            } else {
                foreach ($_files as $file) {
                    $this->view->registerCssFile($this->assetUrl . $file);
                }
            }
        }
    }
619884
public function setFiles($files) {
		$files = $this->parseFiles($files);
		$this->file->setAll($files);
	}
642970
protected function fixFiles(
        InputInterface $input,
        OutputInterface $output,
        Finder $files,
        FixerInterface $fixer
    ) {
        $verbose = $output->getVerbosity();

        /*
         * Each found php file is processed
         */
        foreach ($files as $file) {
            $data = $file->getContents();
            $result = $fixer->fix($data);

            if ($result === false || $data === $result) {
                continue;
            }

            if ($verbose >= OutputInterface::VERBOSITY_NORMAL) {
                $output->writeln('# ' . $file);
            }

            if (!$input->getOption('dry-run')) {
                file_put_contents($file->getRealPath(), $result);
            }
        }
    }
1185019
public function watch($files)
    {
        $files = (array) $files;

        foreach ($files as $file) {
            $path = realpath($file);
            $this->_watched[$path] = $path;
        }
        $this->refreshWatched();
    }
717833
protected function _handleFiles(EntityInterface $entity) {
		$files = $this->getConfig('file');
		if (is_string($files)) {
			$files = [$files => $this->getConfig('defaults')];
		}

		$results = [];
		foreach ($files as $key => $file) {
			if (is_string($key)) {
				$field = $key;
				$options = $this->getConfig('defaults');
				$options += $file;
			}
			if (is_string($file)) {
				$field = $file;
				$options = $this->getConfig('defaults');
			}
			$results[$field] = $this->saveFile($entity->{$field}, $options);
		}

		return $results;
	}
183430
public function handleUploadFiles($files)
    {
        $dir = $this->getFileManager()->getDir();

        /** @var FileManagerDriver $driver */
        $driver = $this->container->get('youwe.file_manager.driver');

        $this->getFileManager()->event(YouweFileManagerEvents::BEFORE_FILE_UPLOADED);
        
        /** @var UploadedFile $file */
        foreach ($files as $file) {
            $extension = $file->guessExtension();
            if (!$extension) {
                $extension = 'bin';
            }

            if (in_array($file->getClientMimeType(), $this->getFileManager()->getExtensionsAllowed())) {
                $driver->handleUploadedFiles($file, $extension, $dir);
            } else {
                $this->getFileManager()->throwError("Mimetype is not allowed", 500);
            }
        }

        $this->getFileManager()->event(YouweFileManagerEvents::AFTER_FILE_UPLOADED);
    }
386555
protected function executeClear(ContainerInterface $container, IoInterface $inOut): void
    {
        assert($inOut);

        $appConfig     = $this->getApplicationConfiguration($container);
        $cacheCallable = $appConfig[ApplicationConfigurationInterface::KEY_CACHE_CALLABLE];
        assert(is_string($cacheCallable));

        // if exists
        if (is_callable($cacheCallable) === true) {
            // location of the cache file
            $path = (new ReflectionMethod($cacheCallable))->getDeclaringClass()->getFileName();

            $fileSystem = $this->getFileSystem($container);
            if ($fileSystem->exists($path) === true) {
                $fileSystem->delete($path);
                $inOut->writeInfo("Cache file deleted `$path`." . PHP_EOL, IoInterface::VERBOSITY_VERBOSE);

                return;
            }
        }

        $inOut->writeInfo('Cache already clean.' . PHP_EOL);
    }