Creates a Git Commit Process that will run on $file.
@param File $file File that the process will execute on.
@return ChurnProcess
423962
public function createGitCommitProcess(File $file): ChurnProcess
    {
        $process = new Process(
            'git -C ' . escapeshellarg(getcwd()) . ' log --since=' .
            escapeshellarg($this->commitsSince) . ' --name-only --pretty=format: ' .
            escapeshellarg($file->getFullPath()) . ' | sort | uniq -c | sort -nr'
        );

        return new ChurnProcess($file, $process, 'GitCommitProcess');
    }
299270
public function create($file = '')
    {
        $this->file   = $file;
        $this->memory = '';
        $this->fh     = 0;

        if ($this->file) {
            $this->fh = @fopen($this->file, 'wb');

            if (!$this->fh) {
                throw new ArchiveIOException('Could not open file for writing: '.$this->file);
            }
        }
        $this->writeaccess = true;
        $this->closed      = false;
        $this->ctrl_dir    = array();
    }
396448
public function buildProcess($file)
    {
        $validArguments = array_merge($this->optionalOptions, $this->optionalPageOptions);
        $arguments = array_merge(
            $this->buildArguments(array_intersect_key($this->options, $validArguments)),
            $this->buildArguments(array_intersect_key(
                $this->pageOptions,
                $this->optionalPageOptions
            ))
        );

        foreach ($this->pages as $page) {
            $arguments = array_merge($arguments, array($page['input']));
            unset($page['input']);
            $arguments = array_merge($arguments, $this->buildArguments($page));
        }

        $builder = new ProcessBuilder($arguments);
        $builder->setPrefix($this->getConfig('bin', '/usr/bin/wkhtmltopdf'));
        $builder->add($file);

        return $builder->getProcess();
    }
1073530
public function process($file, $level, $options)
    {
        $process = $this->processTool($file, $level, $options);

        return $this->setError($process);
    }
1019637
public static function createFromUploadedFile(UploadedFile $file = null)
    {
        if (!$file instanceof UploadedFile) {
            return;
        }

        $instance = new static();

        self::$generic_file->moveUploadedFile(new File($file,
            $file->getClientOriginalName()), null, $instance);

        return $instance;
    }
818854
public function make($file)
    {
        if ($file instanceof SymfonyUploadedFile) {
            return $this->createFromObject($file);
        }

        if (is_array($file)) {
            if (isset($file['base64']) && isset($file['name'])) {
                return $this->createFromBase64($file['name'], $file['base64']);
            }
            else {
                return $this->createFromArray($file);
            }
        }

        if (array_key_exists('scheme', parse_url($file))) {
            return $this->createFromUrl($file);
        }

        return $this->createFromString($file);
    }
1064260
public function runMigration($file)
    {
        $migration = $this->getMigrationObjectByFileName($file);

        $this->disableBitrixIblockHelperCache();

        $this->checkTransactionAndRun($migration, function () use ($migration, $file) {
            if ($migration->up() === false) {
                throw new Exception("Migration up from {$file}.php returned false");
            }
        });

        $this->logSuccessfulMigration($file);
    }
865878
public function setFile($file = null)
    {
        if (is_null($file)) {
            $this->file = ['name' => date('Ymd-His'), 'part' => 1];
        } else {
            if (!array_key_exists("name", $file) && !array_key_exists("part", $file)) {
                $this->file = $file['1'];
            } else {
                $this->file = $file;
            }
        }
        return $this;
    }
581555
public static function createFromFile($file) {
    $jsonConfig = json_decode(file_get_contents($file), true);
    return self::createFromConfig($jsonConfig);
  }
1139596
private function createDotenv($dir, $file)
    {
        if (method_exists(Dotenv::class, 'create')) {
            return Dotenv::create($dir, $file);
        } else {
            return new Dotenv($dir, $file);
        }
    }
530495
public function removeFile($file) {
		if(!is_array($file)) {
			$file = func_get_args();
		}
		$this->begin();
		foreach($file as $item) {
			$this->run('git rm', $item, '-r');
		}
		return $this->end();
	}
505637
public function create(FileResource $file)
    {
        $path = $this->buildUsersPath();
        $builder = (new MultipartStreamBuilder())->addResource($file->getName(), $file->getResource(), $file->getOptions());
        $headers = ['Content-Type' => sprintf('multipart/form-data; boundary="%s"', $builder->getBoundary())];

        return $this->postRaw($path, $builder->build(), $headers);
    }
706170
protected function createUploadedFile($file)
	{
		try {
			$imageManager = new ImageManager;
			$image = $imageManager->make($file);
			$extension = $this->getExtensionFromMime($image->mime());
			$fileName = $this->generateFileName($extension);
			$temporaryPath = $this->getTemporaryImageBasePath();
			$this->temporaryImage = $temporaryPath.'/'.$fileName;
			$image->save($this->temporaryImage);

			return new UploadedFile(
				$this->temporaryImage,
				$fileName, 
				$image->mime(),
				$image->filesize(),
				null,
				TRUE
			);
		} catch (Exception $e) {
			throw new ImageUploaderException("Error create uploaded file");
		}
	}
205966
private File processGitDirFile(@Nonnull File file) {
    try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
      // There should be just one line in the file, e.g.
      // "gitdir: /usr/local/src/parentproject/.git/modules/submodule"
      String line = reader.readLine();
      if (line == null) {
        return null;
      }
      // Separate the key and the value in the string.
      String[] parts = line.split(": ");

      // If we don't have 2 parts or if the key is not gitdir then give up.
      if (parts.length != 2 || !parts[0].equals("gitdir")) {
        return null;
      }

      // All seems ok so return the "gitdir" value read from the file.
      File gitDir = new File(parts[1]);
      if (gitDir.isAbsolute()) {
        // gitdir value is an absolute path. Return as-is
        return gitDir;
      } else {
        // gitdir value is relative.
        return new File(file.getParentFile(), parts[1]);
      }
    } catch (IOException e) {
      return null;
    }
  }
1242643
protected function extract($file, $path)
	{
		// we must use cmdline tar, as PharData::extract() messes up symlinks
		$command = 'tar -xzf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);

		if (0 === $this->process->execute($command, $ignoredOutput)) {
			return;
		}

		throw new \RuntimeException("Failed to execute '$command'\n\n" . $this->process->getErrorOutput());
	}
206629
public function getTotalCommits($file = null)
    {
        if (defined('PHP_WINDOWS_VERSION_BUILD')) {
            $command = "rev-list --count --all $file";
        } else {
            $command = "rev-list --all $file | wc -l";
        }

        $commits = $this->getClient()->run($this, $command);

        return trim($commits);
    }
1208157
public function setFile(File $file = null)
    {
        $this->file = $file;
        // Until php7/uploaderbundle 1.7
        if ($file instanceof UploadedFile) {
            $this->setMimeType($file->getMimeType());
            $this->setName($file->getClientOriginalName());
            $this->setSize($file->getSize());
        }
        
        return $this;
    }