@@ -148,7 +148,7 @@ |
||
148 | 148 | */ |
149 | 149 | protected function sortFilesByDirectoryThenName(array &$fileArray): void |
150 | 150 | { |
151 | - usort($fileArray, static function (FileInfoInterface $a, FileInfoInterface $b) { |
|
151 | + usort($fileArray, static function(FileInfoInterface $a, FileInfoInterface $b) { |
|
152 | 152 | if ($a->isDir()) { |
153 | 153 | if ($b->isDir()) { |
154 | 154 | return strnatcasecmp($a->getFilename(), $b->getFilename()); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function getDiffFile($filename) |
70 | 70 | { |
71 | - $diffString = $this->command->runCommand('git --no-pager diff --oneline '.escapeshellarg($filename).''); |
|
71 | + $diffString = $this->command->runCommand('git --no-pager diff --oneline ' . escapeshellarg($filename) . ''); |
|
72 | 72 | $diffParser = new GitDiffParser($diffString); |
73 | 73 | return $diffParser->parse(); |
74 | 74 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function getDiffFileBetweenCommits($filename, $previousCommitHash, $commitHash) |
88 | 88 | { |
89 | - $diffString = $this->command->runCommand('git --no-pager diff --oneline '.escapeshellarg($previousCommitHash).' '.escapeshellarg($commitHash).' -- '.escapeshellarg($filename).''); |
|
89 | + $diffString = $this->command->runCommand('git --no-pager diff --oneline ' . escapeshellarg($previousCommitHash) . ' ' . escapeshellarg($commitHash) . ' -- ' . escapeshellarg($filename) . ''); |
|
90 | 90 | $diffParser = new GitDiffParser($diffString); |
91 | 91 | return $diffParser->parse(); |
92 | 92 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function getFilesInCommit($commitHash) |
103 | 103 | { |
104 | - $response = $this->command->runCommand('git diff-tree --no-commit-id --name-status -r '.escapeshellarg($commitHash).''); |
|
104 | + $response = $this->command->runCommand('git diff-tree --no-commit-id --name-status -r ' . escapeshellarg($commitHash) . ''); |
|
105 | 105 | $responseLines = $this->splitOnNewLine($response); |
106 | 106 | $files = new GitCommitFileCollection(); |
107 | 107 | foreach ($responseLines as $line) { |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | public function getPreviousCommitHash($commitHash = 'HEAD', $fileName = false) |
125 | 125 | { |
126 | 126 | $previousCommitHash = ''; |
127 | - $command = " git log --pretty=format:'%h' -n 2 ".escapeshellarg($commitHash).''; |
|
127 | + $command = " git log --pretty=format:'%h' -n 2 " . escapeshellarg($commitHash) . ''; |
|
128 | 128 | if ($fileName !== false) { |
129 | - $command .= ' '.escapeshellarg($fileName); |
|
129 | + $command .= ' ' . escapeshellarg($fileName); |
|
130 | 130 | } |
131 | 131 | $response = $this->command->runCommand($command); |
132 | 132 | $responseLines = $this->splitOnNewLine($response); |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | * @throws RunGitCommandException |
145 | 145 | * @throws RuntimeException |
146 | 146 | */ |
147 | - public function getConflictFileNames(){ |
|
147 | + public function getConflictFileNames() { |
|
148 | 148 | |
149 | 149 | $command = ' git diff --name-only --diff-filter=U'; |
150 | 150 | $response = $this->command->runCommand($command); |
@@ -185,7 +185,7 @@ |
||
185 | 185 | { |
186 | 186 | $this->logCommand = 'git --no-pager log -m "--pretty=format:\'' . $this->format . '\'"'; |
187 | 187 | if ($this->logCount) { |
188 | - $this->logCommand .= ' -' . (int)$this->logCount . ' '; |
|
188 | + $this->logCommand .= ' -' . (int) $this->logCount . ' '; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | if ($this->showReferences === true) { |
@@ -311,7 +311,7 @@ |
||
311 | 311 | $currentBranch = $this->getCurrentBranch(); |
312 | 312 | if ($branchName === $currentBranch) { |
313 | 313 | throw new RuntimeException( |
314 | - 'You cannot merge a branch with itself. Please checkout a '. |
|
314 | + 'You cannot merge a branch with itself. Please checkout a ' . |
|
315 | 315 | 'different branch before trying to merge.' |
316 | 316 | ); |
317 | 317 | } |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | throw new InvalidBranchNameException('This is not a valid branch name'); |
66 | 66 | } |
67 | 67 | |
68 | - $command = sprintf($this->initGitCommand().' tag -a %s -m %s', escapeshellarg($version), escapeshellarg($message)); |
|
68 | + $command = sprintf($this->initGitCommand() . ' tag -a %s -m %s', escapeshellarg($version), escapeshellarg($message)); |
|
69 | 69 | if ($commitShortCode) { |
70 | 70 | $command .= ' ' . escapeshellarg($commitShortCode); |
71 | 71 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function pushTag($remote, $tag): string |
87 | 87 | { |
88 | - $command = sprintf($this->initGitCommand().' push %s %s', escapeshellarg(trim($remote)), escapeshellarg(trim($tag))); |
|
88 | + $command = sprintf($this->initGitCommand() . ' push %s %s', escapeshellarg(trim($remote)), escapeshellarg(trim($tag))); |
|
89 | 89 | |
90 | 90 | return $this->command->runCommand($command); |
91 | 91 | } |
@@ -72,16 +72,16 @@ |
||
72 | 72 | if (isset($username) && $privateKey != null) { |
73 | 73 | $key = new RSA(); |
74 | 74 | |
75 | - //Set Private Key Password |
|
76 | - if ($privateKeyPassword) { |
|
77 | - $key->setPassword($privateKeyPassword); |
|
78 | - } |
|
75 | + //Set Private Key Password |
|
76 | + if ($privateKeyPassword) { |
|
77 | + $key->setPassword($privateKeyPassword); |
|
78 | + } |
|
79 | 79 | $key->loadKey($privateKey); |
80 | 80 | |
81 | - //Login using private key |
|
82 | - if (!$this->sftp->login($username, $key)) { |
|
83 | - throw new SshLoginException(sprintf('SFTP authentication failed for user "%s" using private key', $username)); |
|
84 | - } |
|
81 | + //Login using private key |
|
82 | + if (!$this->sftp->login($username, $key)) { |
|
83 | + throw new SshLoginException(sprintf('SFTP authentication failed for user "%s" using private key', $username)); |
|
84 | + } |
|
85 | 85 | } else { |
86 | 86 | if (!$this->sftp->login($username, $password)) { |
87 | 87 | throw new SshLoginException(sprintf('SFTP authentication failed for user "%s" using password', $username)); |
@@ -108,8 +108,7 @@ |
||
108 | 108 | $path = $this->path; |
109 | 109 | |
110 | 110 | $filename = $folder == null ? |
111 | - $path . DIRECTORY_SEPARATOR . $name : |
|
112 | - $path . DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR . $name; |
|
111 | + $path . DIRECTORY_SEPARATOR . $name : $path . DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR . $name; |
|
113 | 112 | $handle = fopen($filename, 'wb'); |
114 | 113 | $fileContent = $content == null ? 'test content' : $content; |
115 | 114 | $this->assertNotSame(false, fwrite($handle, $fileContent), sprintf('unable to write the file %s', $name)); |
@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | $this->updateFile('test', 'Test Data has changed'); |
38 | 38 | } |
39 | 39 | |
40 | - public function testGetPreviousCommitHash(){ |
|
40 | + public function testGetPreviousCommitHash() { |
|
41 | 41 | |
42 | 42 | $previousCommitHash = $this->gitCommands->command('diff')->getPreviousCommitHash(); |
43 | - $this->assertTrue(strlen($previousCommitHash) === 7,'Previous Commit hash does not equal 7 characters: '.$previousCommitHash); |
|
43 | + $this->assertTrue(strlen($previousCommitHash) === 7, 'Previous Commit hash does not equal 7 characters: ' . $previousCommitHash); |
|
44 | 44 | |
45 | 45 | } |
46 | 46 | |
@@ -52,26 +52,26 @@ discard block |
||
52 | 52 | |
53 | 53 | $diffs = $this->gitCommands->command('diff')->getDiffFile('test'); |
54 | 54 | |
55 | - $this->assertCount(1, $diffs,'Diff count does not equal expected 17. Actual:'.count($diffs).print_r($diffs,true)); |
|
55 | + $this->assertCount(1, $diffs, 'Diff count does not equal expected 17. Actual:' . count($diffs) . print_r($diffs, true)); |
|
56 | 56 | foreach ($diffs as $diff) { |
57 | 57 | $this->assertInstanceOf(GitDiff::class, $diff); |
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | - public function testGetDiffFileBetweenCommits(){ |
|
61 | + public function testGetDiffFileBetweenCommits() { |
|
62 | 62 | |
63 | 63 | $previousCommitHash = $this->gitCommands->command('diff')->getPreviousCommitHash(); |
64 | 64 | |
65 | - $diffs = $this->gitCommands->command('diff')->getDiffFileBetweenCommits('test',$previousCommitHash,'HEAD'); |
|
65 | + $diffs = $this->gitCommands->command('diff')->getDiffFileBetweenCommits('test', $previousCommitHash, 'HEAD'); |
|
66 | 66 | foreach ($diffs as $diff) { |
67 | 67 | $this->assertInstanceOf(GitDiff::class, $diff); |
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | - public function testGetFilesInCommit(){ |
|
71 | + public function testGetFilesInCommit() { |
|
72 | 72 | $filesCommitted = $this->gitCommands->command('diff')->getFilesInCommit('HEAD'); |
73 | 73 | |
74 | - $this->assertCount(1, $filesCommitted,'Only one file should have been commited. Actual:'.count($filesCommitted)); |
|
74 | + $this->assertCount(1, $filesCommitted, 'Only one file should have been commited. Actual:' . count($filesCommitted)); |
|
75 | 75 | |
76 | 76 | foreach ($filesCommitted as $commitFile) { |
77 | 77 | $this->assertInstanceOf(GitCommitFile::class, $commitFile); |
@@ -60,7 +60,7 @@ |
||
60 | 60 | $diffParser = new GitDiffParser($diffString); |
61 | 61 | $diffs = $diffParser->parse(); |
62 | 62 | |
63 | - $this->assertCount(1, $diffs,'Diff count does not equal expected 17. Actual:'.count($diffs).print_r($diffs,true)); |
|
63 | + $this->assertCount(1, $diffs, 'Diff count does not equal expected 17. Actual:' . count($diffs) . print_r($diffs, true)); |
|
64 | 64 | foreach ($diffs as $diff) { |
65 | 65 | $this->assertInstanceOf(GitDiff::class, $diff); |
66 | 66 | } |