![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/sebastianfeldmann/git/src/Command/DiffTree/ |
<?php /** * This file is part of SebastianFeldmann\Git. * * (c) Sebastian Feldmann <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace SebastianFeldmann\Git\Command\DiffTree; use SebastianFeldmann\Git\Command\Base; /** * Class ChangedFiles * * @package SebastianFeldmann\Git * @author Sebastian Feldmann <[email protected]> * @link https://github.com/sebastianfeldmann/git * @since Class available since Release 2.0.1 */ class ChangedFiles extends Base { /** * @var string */ private $from; /** * @var string */ private $to; /** * @var array<string> */ private $filter; /** * @param string $from * @return \SebastianFeldmann\Git\Command\DiffTree\ChangedFiles */ public function fromRevision(string $from): ChangedFiles { $this->from = $from; return $this; } /** * @param string $to * @return \SebastianFeldmann\Git\Command\DiffTree\ChangedFiles */ public function toRevision(string $to): ChangedFiles { $this->to = $to; return $this; } /** * Set --diff-filter * * @param array<string> $filter * @return \SebastianFeldmann\Git\Command\DiffTree\ChangedFiles */ public function useFilter(array $filter): ChangedFiles { $this->filter = $filter; return $this; } /** * Return the command to execute. * * @return string * @throws \RuntimeException */ protected function getGitCommand(): string { return 'diff-tree' . ' --diff-algorithm=myers' . ' --no-ext-diff' . ' --no-commit-id' . ' --name-only' . ' -r' . (!empty($this->filter) ? ' --diff-filter=' . implode('', $this->filter) : '') . ' ' . $this->getVersionsToCompare(); } /** * Returns the commit range for the diff command * * @return string */ protected function getVersionsToCompare(): string { return escapeshellarg($this->from) . (empty($this->to) ? '' : ' ' . escapeshellarg($this->to)); } }