@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace TheCodingMachine\WashingMachine\Clover; |
5 | 5 |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace TheCodingMachine\WashingMachine\Clover; |
5 | 5 |
@@ -60,7 +60,7 @@ |
||
60 | 60 | |
61 | 61 | // Now, let's order the differences by crap order. |
62 | 62 | usort($differences, function(Difference $d1, Difference $d2) { |
63 | - return $d2->getCrapScore() <=> $d1->getCrapScore(); |
|
63 | + return $d2->getCrapScore() <=> $d1->getCrapScore(); |
|
64 | 64 | }); |
65 | 65 | |
66 | 66 | // Now, let's limit the number of returned differences |
@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | -declare(strict_types=1); |
|
2 | +declare(strict_types = 1); |
|
3 | 3 | |
4 | 4 | namespace TheCodingMachine\WashingMachine\Clover; |
5 | 5 |
@@ -236,7 +236,7 @@ |
||
236 | 236 | * |
237 | 237 | * @param Client $client |
238 | 238 | * @param Project $project |
239 | - * @param $commitRef |
|
239 | + * @param string $commitRef |
|
240 | 240 | * @return int|null |
241 | 241 | */ |
242 | 242 | private function getCommiterId(Client $client, Project $project, $commitRef) |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | |
271 | 271 | $buildService->dumpArtifactFromBranch($projectName, $targetBranch, $jobStage, $tmpFile); |
272 | 272 | $zipFile = new \ZipArchive(); |
273 | - if ($zipFile->open($tmpFile)!==true) { |
|
273 | + if ($zipFile->open($tmpFile) !== true) { |
|
274 | 274 | throw new \RuntimeException('Invalid ZIP archive '.$tmpFile); |
275 | 275 | } |
276 | 276 | return $this->getMeasuresFromZipFile($zipFile, $cloverPath, $crap4JPath); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | $build = $buildService->getLatestBuildFromCommitId($projectName, $commitId); |
295 | 295 | $buildService->dumpArtifact($projectName, $build['id'], $jobStage, $tmpFile); |
296 | 296 | $zipFile = new \ZipArchive(); |
297 | - if ($zipFile->open($tmpFile)!==true) { |
|
297 | + if ($zipFile->open($tmpFile) !== true) { |
|
298 | 298 | throw new \RuntimeException('Invalid ZIP archive '.$tmpFile); |
299 | 299 | } |
300 | 300 | return $this->getMeasuresFromZipFile($zipFile, $cloverPath, $crap4JPath); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param string $projectName |
69 | 69 | * @param string $commitId |
70 | 70 | * @param int $numIter |
71 | - * @return array |
|
71 | + * @return string |
|
72 | 72 | * @throws BuildNotFoundException |
73 | 73 | */ |
74 | 74 | public function getLatestBuildFromCommitId(string $projectName, string $commitId, int $numIter = 0) : array |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | /** |
102 | 102 | * @param string $projectName |
103 | 103 | * @param string $branchName |
104 | - * @return array |
|
104 | + * @return string |
|
105 | 105 | * @throws BuildNotFoundException |
106 | 106 | */ |
107 | 107 | public function getLatestBuildFromBranch(string $projectName, string $branchName) : array |
@@ -8,14 +8,14 @@ |
||
8 | 8 | { |
9 | 9 | public function getMergeBase(string $commit1, string $commit2) : string |
10 | 10 | { |
11 | - $results = $this->extractFromCommand('git merge-base ' . escapeshellarg($commit1). ' '. escapeshellarg($commit2)); |
|
11 | + $results = $this->extractFromCommand('git merge-base '.escapeshellarg($commit1).' '.escapeshellarg($commit2)); |
|
12 | 12 | |
13 | 13 | return $results[0]; |
14 | 14 | } |
15 | 15 | |
16 | 16 | public function getLatestCommitForBranch(string $branch) : string |
17 | 17 | { |
18 | - $results = $this->extractFromCommand('git log -n 1 --pretty=format:"%H" ' . escapeshellarg($branch)); |
|
18 | + $results = $this->extractFromCommand('git log -n 1 --pretty=format:"%H" '.escapeshellarg($branch)); |
|
19 | 19 | |
20 | 20 | return $results[0]; |
21 | 21 | } |
@@ -125,7 +125,7 @@ |
||
125 | 125 | $url = $this->getArtifactFileUrl($file->getFilename(), $gitlabUrl, $projectName, $buildId); |
126 | 126 | |
127 | 127 | $this->msg .= sprintf("\n<strong>[%s](%s)</strong>\n", $file->getFilename(), $url); |
128 | - $this->msg .= sprintf("```\n%s%s```\n", $text, $isComplete?'':"... (file truncated)\n"); |
|
128 | + $this->msg .= sprintf("```\n%s%s```\n", $text, $isComplete ? '' : "... (file truncated)\n"); |
|
129 | 129 | |
130 | 130 | if (!$isComplete) { |
131 | 131 | $this->msg .= sprintf("[Download complete file](%s)\n", $url); |
@@ -56,9 +56,9 @@ |
||
56 | 56 | } |
57 | 57 | } |
58 | 58 | $parsed_url = parse_url($ciProjectUrl); |
59 | - $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; |
|
59 | + $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'].'://' : ''; |
|
60 | 60 | $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; |
61 | - $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; |
|
61 | + $port = isset($parsed_url['port']) ? ':'.$parsed_url['port'] : ''; |
|
62 | 62 | $gitlabUrl = $scheme.$host.$port; |
63 | 63 | } |
64 | 64 | return rtrim($gitlabUrl, '/'); |