Skip to content

Commit 930885e

Browse files
Merge pull request #135 from keradus/CS
Apply CS for PSR2
2 parents 932a960 + 8ec447f commit 930885e

File tree

10 files changed

+31
-22
lines changed

10 files changed

+31
-22
lines changed

src/Gitonomy/Git/Commit.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ public function getIncludingBranches($local = true, $remote = true)
221221
}
222222

223223
$branchesName = explode("\n", trim(str_replace('*', '', $result)));
224-
$branchesName = array_filter($branchesName, function ($v) { return false === StringHelper::strpos($v, '->');});
224+
$branchesName = array_filter($branchesName, function ($v) {
225+
return false === StringHelper::strpos($v, '->');
226+
});
225227
$branchesName = array_map('trim', $branchesName);
226228

227229
$references = $this->repository->getReferences();

src/Gitonomy/Git/Diff/Diff.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@ public function toArray()
101101
'files' => array_map(
102102
function (File $file) {
103103
return $file->toArray();
104-
}, $this->files
104+
},
105+
$this->files
105106
),
106107
);
107108
}
@@ -119,7 +120,8 @@ public static function fromArray(array $array)
119120
array_map(
120121
function ($array) {
121122
return File::fromArray($array);
122-
}, $array['files']
123+
},
124+
$array['files']
123125
),
124126
$array['rawDiff']
125127
);

src/Gitonomy/Git/Exception/ProcessException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ class ProcessException extends RuntimeException implements GitExceptionInterface
1010

1111
public function __construct(Process $process)
1212
{
13-
parent::__construct("Error while running git command:\n".
13+
parent::__construct(
14+
"Error while running git command:\n".
1415
$process->getCommandLine()."\n".
1516
"\n".
1617
$process->getErrorOutput()."\n".

src/Gitonomy/Git/Parser/LogParser.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ protected function doParse()
5858
$message .= $this->consumeTo("\n")."\n";
5959
$this->consumeNewLine();
6060
}
61-
}
62-
else {
61+
} else {
6362
$this->cursor--;
6463
}
6564

src/Gitonomy/Git/Parser/ParserBase.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,12 @@ protected function consumeNewLine()
123123
/**
124124
* @return string
125125
*/
126-
protected function consumeGPGSignature() {
126+
protected function consumeGPGSignature()
127+
{
127128
$expected = "\ngpgsig ";
128129
$length = strlen($expected);
129130
$actual = substr($this->content, $this->cursor, $length);
130-
if($actual != $expected) {
131+
if ($actual != $expected) {
131132
return '';
132133
}
133134
$this->cursor += $length;

src/Gitonomy/Git/Repository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private function initDir($gitDir, $workingDir = null)
153153

154154
if (false === $realGitDir) {
155155
throw new InvalidArgumentException(sprintf('Directory "%s" does not exist or is not a directory', $gitDir));
156-
} else if (!is_dir($realGitDir)) {
156+
} elseif (!is_dir($realGitDir)) {
157157
throw new InvalidArgumentException(sprintf('Directory "%s" does not exist or is not a directory', $realGitDir));
158158
} elseif (null === $workingDir && is_dir($realGitDir.'/.git')) {
159159
$workingDir = $realGitDir;

src/Gitonomy/Git/WorkingCopy.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@ public function getStatus()
4242
public function getUntrackedFiles()
4343
{
4444
$lines = explode("\0", $this->run('status', array('--porcelain', '--untracked-files=all', '-z')));
45-
$lines = array_filter($lines, function ($l) { return substr($l, 0, 3) === '?? '; });
46-
$lines = array_map(function ($l) { return substr($l, 3); }, $lines);
45+
$lines = array_filter($lines, function ($l) {
46+
return substr($l, 0, 3) === '?? ';
47+
});
48+
$lines = array_map(function ($l) {
49+
return substr($l, 3);
50+
}, $lines);
4751

4852
return $lines;
4953
}

tests/Gitonomy/Git/Tests/AdminTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function testBare()
3636
$objectDir = $this->tmpDir.'/objects';
3737

3838
$this->assertTrue($repository->isBare(), 'Repository is bare');
39-
$this->assertTrue(is_dir($objectDir), 'objects/ folder is present');
39+
$this->assertTrue(is_dir($objectDir), 'objects/ folder is present');
4040
$this->assertTrue($repository instanceof Repository, 'Admin::init returns a repository');
4141
$this->assertEquals($this->tmpDir, $repository->getGitDir(), 'The folder passed as argument is git dir');
4242
$this->assertNull($repository->getWorkingDir(), 'No working dir in bare repository');

tests/Gitonomy/Git/Tests/DiffTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ protected function verifyCreateCommitDiff(Diff $diff)
4848

4949
$this->assertTrue($files[0]->isCreation(), 'script_A.php created');
5050

51-
$this->assertEquals(null, $files[0]->getOldName(), 'First file name is a new file');
51+
$this->assertEquals(null, $files[0]->getOldName(), 'First file name is a new file');
5252
$this->assertEquals('script_A.php', $files[0]->getNewName(), 'First file name is script_A.php');
53-
$this->assertEquals(null, $files[0]->getOldMode(), 'First file mode is a new file');
54-
$this->assertEquals('100644', $files[0]->getNewMode(), 'First file mode is correct');
53+
$this->assertEquals(null, $files[0]->getOldMode(), 'First file mode is a new file');
54+
$this->assertEquals('100644', $files[0]->getNewMode(), 'First file mode is correct');
5555

5656
$this->assertEquals(1, $files[0]->getAdditions(), '1 line added');
57-
$this->assertEquals(0, $files[0]->getDeletions(), '0 lines deleted');
57+
$this->assertEquals(0, $files[0]->getDeletions(), '0 lines deleted');
5858
}
5959

6060
/**
@@ -70,8 +70,8 @@ public function testGetFiles_Modification($repository)
7070

7171
$this->assertEquals('image.jpg', $files[0]->getOldName(), 'Second file name is image.jpg');
7272
$this->assertEquals('image.jpg', $files[0]->getNewName(), 'Second file name is image.jpg');
73-
$this->assertEquals('100644', $files[0]->getOldMode(), 'Second file mode is a new file');
74-
$this->assertEquals('100644', $files[0]->getNewMode(), 'Second file mode is correct');
73+
$this->assertEquals('100644', $files[0]->getOldMode(), 'Second file mode is a new file');
74+
$this->assertEquals('100644', $files[0]->getNewMode(), 'Second file mode is correct');
7575

7676
$this->assertTrue($files[0]->isBinary(), 'binary file');
7777
$this->assertEquals(0, $files[0]->getAdditions(), '0 lines added');

tests/Gitonomy/Git/Tests/PushReferenceTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ public function provideIsers()
3737
public function testIsers($reference, $before, $after, $mask)
3838
{
3939
$reference = new PushReference(self::createFoobarRepository(), $reference, $before, $after);
40-
$this->assertEquals($mask & self::CREATE, $reference->isCreate(), 'Create value is correct.');
41-
$this->assertEquals($mask & self::DELETE, $reference->isDelete(), 'Delete value is correct.');
42-
$this->assertEquals($mask & self::FORCE, $reference->isForce(), 'Force value is correct.');
43-
$this->assertEquals($mask & self::FAST_FORWARD, $reference->isFastForward(), 'FastForward value is correct.');
40+
$this->assertEquals($mask & self::CREATE, $reference->isCreate(), 'Create value is correct.');
41+
$this->assertEquals($mask & self::DELETE, $reference->isDelete(), 'Delete value is correct.');
42+
$this->assertEquals($mask & self::FORCE, $reference->isForce(), 'Force value is correct.');
43+
$this->assertEquals($mask & self::FAST_FORWARD, $reference->isFastForward(), 'FastForward value is correct.');
4444
}
4545

4646
/**

0 commit comments

Comments
 (0)