Skip to content

Commit 65c4916

Browse files
committed
minor gitonomy#91 Fixed CS (lyrixx)
This PR was merged into the 1.0-dev branch. Discussion ---------- Fixed CS Commits ------- dc14e82 Fixed CS
2 parents d676512 + dc14e82 commit 65c4916

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+276
-325
lines changed

src/Gitonomy/Git/Admin.php

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* This source file is subject to the MIT license that is bundled
1010
* with this source code in the file LICENSE.
1111
*/
12-
1312
namespace Gitonomy\Git;
1413

1514
use Gitonomy\Git\Exception\RuntimeException;
@@ -25,9 +24,9 @@ class Admin
2524
/**
2625
* Initializes a repository and returns the instance.
2726
*
28-
* @param string $path path to the repository
29-
* @param boolean $bare indicate to create a bare repository
30-
* @param array $options options for Repository creation
27+
* @param string $path path to the repository
28+
* @param bool $bare indicate to create a bare repository
29+
* @param array $options options for Repository creation
3130
*
3231
* @return Repository
3332
*
@@ -56,7 +55,7 @@ public static function init($path, $bare = true, array $options = array())
5655
* @param string $url url of repository to check
5756
* @param array $options options for Repository creation
5857
*
59-
* @return boolean true if url is valid
58+
* @return bool true if url is valid
6059
*/
6160
public static function isValidRepository($url, array $options = array())
6261
{
@@ -70,10 +69,10 @@ public static function isValidRepository($url, array $options = array())
7069
/**
7170
* Clone a repository to a local path.
7271
*
73-
* @param string $path indicates where to clone repository
74-
* @param string $url url of repository to clone
75-
* @param boolean $bare indicates if repository should be bare or have a working copy
76-
* @param array $options options for Repository creation
72+
* @param string $path indicates where to clone repository
73+
* @param string $url url of repository to clone
74+
* @param bool $bare indicates if repository should be bare or have a working copy
75+
* @param array $options options for Repository creation
7776
*
7877
* @return Repository
7978
*/
@@ -87,11 +86,11 @@ public static function cloneTo($path, $url, $bare = true, array $options = array
8786
/**
8887
* Clone a repository branch to a local path.
8988
*
90-
* @param string $path indicates where to clone repository
91-
* @param string $url url of repository to clone
92-
* @param string $branch branch to clone
93-
* @param boolean $bare indicates if repository should be bare or have a working copy
94-
* @param array $options options for Repository creation
89+
* @param string $path indicates where to clone repository
90+
* @param string $url url of repository to clone
91+
* @param string $branch branch to clone
92+
* @param bool $bare indicates if repository should be bare or have a working copy
93+
* @param array $options options for Repository creation
9594
*
9695
* @return Repository
9796
*/
@@ -149,9 +148,9 @@ private static function getProcess($command, array $args = array(), array $optio
149148
{
150149
$is_windows = defined('PHP_WINDOWS_VERSION_BUILD');
151150
$options = array_merge(array(
152-
'environment_variables' => $is_windows ? array( 'PATH' => getenv('PATH') ) : array(),
153-
'command' => 'git',
154-
'process_timeout' => 3600
151+
'environment_variables' => $is_windows ? array('PATH' => getenv('PATH')) : array(),
152+
'command' => 'git',
153+
'process_timeout' => 3600,
155154
), $options);
156155

157156
$builder = ProcessBuilder::create(array_merge(array($options['command'], $command), $args));

src/Gitonomy/Git/Blame.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* This source file is subject to the MIT license that is bundled
1010
* with this source code in the file LICENSE.
1111
*/
12-
1312
namespace Gitonomy\Git;
1413

1514
use Gitonomy\Git\Blame\Line;
@@ -54,9 +53,9 @@ class Blame implements \Countable
5453
public function __construct(Repository $repository, Revision $revision, $file, $lineRange = null)
5554
{
5655
$this->repository = $repository;
57-
$this->revision = $revision;
58-
$this->lineRange = $lineRange;
59-
$this->file = $file;
56+
$this->revision = $revision;
57+
$this->lineRange = $lineRange;
58+
$this->file = $file;
6059
}
6160

6261
/**
@@ -84,8 +83,8 @@ public function getLine($number)
8483
*/
8584
public function getGroupedLines()
8685
{
87-
$result = array();
88-
$commit = null;
86+
$result = array();
87+
$commit = null;
8988
$current = array();
9089

9190
foreach ($this->getLines() as $lineNumber => $line) {

src/Gitonomy/Git/Blame/Line.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* This source file is subject to the MIT license that is bundled
1010
* with this source code in the file LICENSE.
1111
*/
12-
1312
namespace Gitonomy\Git\Blame;
1413

1514
use Gitonomy\Git\Commit;
@@ -33,11 +32,11 @@ class Line
3332
*/
3433
public function __construct(Commit $commit, $sourceLine, $targetLine, $blockLine, $content)
3534
{
36-
$this->commit = $commit;
35+
$this->commit = $commit;
3736
$this->sourceLine = $sourceLine;
3837
$this->targetLine = $targetLine;
39-
$this->blockLine = $blockLine;
40-
$this->content = $content;
38+
$this->blockLine = $blockLine;
39+
$this->content = $content;
4140
}
4241

4342
public function getContent()

src/Gitonomy/Git/Blob.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* This source file is subject to the MIT license that is bundled
1010
* with this source code in the file LICENSE.
1111
*/
12-
1312
namespace Gitonomy\Git;
1413

1514
/**
@@ -89,7 +88,7 @@ public function getMimetype()
8988
/**
9089
* Determines if file is binary.
9190
*
92-
* @return boolean
91+
* @return bool
9392
*/
9493
public function isBinary()
9594
{
@@ -99,7 +98,7 @@ public function isBinary()
9998
/**
10099
* Determines if file is text.
101100
*
102-
* @return boolean
101+
* @return bool
103102
*/
104103
public function isText()
105104
{

src/Gitonomy/Git/Commit.php

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* This source file is subject to the MIT license that is bundled
1010
* with this source code in the file LICENSE.
1111
*/
12-
1312
namespace Gitonomy\Git;
1413

1514
use Gitonomy\Git\Diff\Diff;
@@ -36,8 +35,7 @@ class Commit extends Revision
3635
* Constructor.
3736
*
3837
* @param Gitonomy\Git\Repository $repository Repository of the commit
39-
*
40-
* @param string $hash Hash of the commit
38+
* @param string $hash Hash of the commit
4139
*/
4240
public function __construct(Repository $repository, $hash, array $data = array())
4341
{
@@ -161,9 +159,9 @@ public function getLastModification($path = null)
161159
*
162160
* Ported from https://github.com/fabpot/Twig-extensions/blob/d67bc7e69788795d7905b52d31188bbc1d390e01/lib/Twig/Extensions/Extension/Text.php#L52-L109
163161
*
164-
* @param integer $length
165-
* @param boolean $preserve
166-
* @param string $separator
162+
* @param int $length
163+
* @param bool $preserve
164+
* @param string $separator
167165
*
168166
* @return string
169167
*/
@@ -193,10 +191,10 @@ public function resolveReferences()
193191
}
194192

195193
/**
196-
* Find branch containing the commit
194+
* Find branch containing the commit.
197195
*
198-
* @param boolean $local set true to try to locate a commit on local repository
199-
* @param boolean $remote set true to try to locate a commit on remote repository
196+
* @param bool $local set true to try to locate a commit on local repository
197+
* @param bool $remote set true to try to locate a commit on remote repository
200198
*
201199
* @return array An array of Reference\Branch
202200
*/
@@ -313,7 +311,7 @@ public function getMessage()
313311
}
314312

315313
/**
316-
* Returns the subject message (the first line)
314+
* Returns the subject message (the first line).
317315
*
318316
* @return string The subject message
319317
*/
@@ -323,7 +321,7 @@ public function getSubjectMessage()
323321
}
324322

325323
/**
326-
* Return the body message
324+
* Return the body message.
327325
*
328326
* @return string The body message
329327
*/
@@ -387,15 +385,15 @@ private function getData($name)
387385

388386
$parser->parse($result);
389387

390-
$this->data['treeHash'] = $parser->tree;
391-
$this->data['parentHashes'] = $parser->parents;
392-
$this->data['authorName'] = $parser->authorName;
393-
$this->data['authorEmail'] = $parser->authorEmail;
394-
$this->data['authorDate'] = $parser->authorDate;
395-
$this->data['committerName'] = $parser->committerName;
388+
$this->data['treeHash'] = $parser->tree;
389+
$this->data['parentHashes'] = $parser->parents;
390+
$this->data['authorName'] = $parser->authorName;
391+
$this->data['authorEmail'] = $parser->authorEmail;
392+
$this->data['authorDate'] = $parser->authorDate;
393+
$this->data['committerName'] = $parser->committerName;
396394
$this->data['committerEmail'] = $parser->committerEmail;
397-
$this->data['committerDate'] = $parser->committerDate;
398-
$this->data['message'] = $parser->message;
395+
$this->data['committerDate'] = $parser->committerDate;
396+
$this->data['message'] = $parser->message;
399397

400398
if (!isset($this->data[$name])) {
401399
throw new \InvalidArgumentException(sprintf('No data named "%s" in Commit.', $name));

src/Gitonomy/Git/CommitReference.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* This source file is subject to the MIT license that is bundled
1010
* with this source code in the file LICENSE.
1111
*/
12-
1312
namespace Gitonomy\Git;
1413

1514
class CommitReference

src/Gitonomy/Git/Diff/Diff.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* This source file is subject to the MIT license that is bundled
1010
* with this source code in the file LICENSE.
1111
*/
12-
1312
namespace Gitonomy\Git\Diff;
1413

1514
use Gitonomy\Git\Parser\DiffParser;
@@ -52,7 +51,7 @@ public static function parse($rawDiff)
5251
$parser = new DiffParser();
5352
$parser->parse($rawDiff);
5453

55-
return new Diff($parser->files, $rawDiff);
54+
return new self($parser->files, $rawDiff);
5655
}
5756

5857
public function setRepository(Repository $repository)
@@ -81,7 +80,7 @@ public function getFiles()
8180
}
8281

8382
/**
84-
* Returns the raw diff
83+
* Returns the raw diff.
8584
*
8685
* @return string The raw diff
8786
*/
@@ -91,15 +90,15 @@ public function getRawDiff()
9190
}
9291

9392
/**
94-
* Export a diff as array
93+
* Export a diff as array.
9594
*
9695
* @return array The array
9796
*/
9897
public function toArray()
9998
{
10099
return array(
101100
'rawDiff' => $this->rawDiff,
102-
'files' => array_map(
101+
'files' => array_map(
103102
function (File $file) {
104103
return $file->toArray();
105104
}, $this->files
@@ -108,7 +107,7 @@ function (File $file) {
108107
}
109108

110109
/**
111-
* Create a new instance of Diff from an array
110+
* Create a new instance of Diff from an array.
112111
*
113112
* @param array $array The array
114113
*

src/Gitonomy/Git/Diff/File.php

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
* This source file is subject to the MIT license that is bundled
1010
* with this source code in the file LICENSE.
1111
*/
12-
1312
namespace Gitonomy\Git\Diff;
1413

1514
use Gitonomy\Git\Repository;
@@ -50,7 +49,7 @@ class File
5049
protected $newIndex;
5150

5251
/**
53-
* @var boolean
52+
* @var bool
5453
*/
5554
protected $isBinary;
5655

@@ -69,10 +68,10 @@ class File
6968
*/
7069
public function __construct($oldName, $newName, $oldMode, $newMode, $oldIndex, $newIndex, $isBinary)
7170
{
72-
$this->oldName = $oldName;
73-
$this->newName = $newName;
74-
$this->oldMode = $oldMode;
75-
$this->newMode = $newMode;
71+
$this->oldName = $oldName;
72+
$this->newName = $newName;
73+
$this->oldMode = $oldMode;
74+
$this->newMode = $newMode;
7675
$this->oldIndex = $oldIndex;
7776
$this->newIndex = $newIndex;
7877
$this->isBinary = $isBinary;
@@ -88,7 +87,7 @@ public function addChange(FileChange $change)
8887
/**
8988
* Indicates if this diff file is a creation.
9089
*
91-
* @return boolean
90+
* @return bool
9291
*/
9392
public function isCreation()
9493
{
@@ -98,7 +97,7 @@ public function isCreation()
9897
/**
9998
* Indicates if this diff file is a modification.
10099
*
101-
* @return boolean
100+
* @return bool
102101
*/
103102
public function isModification()
104103
{
@@ -110,7 +109,7 @@ public function isModification()
110109
*
111110
* A rename can only occurs if it's a modification (not a creation or a deletion).
112111
*
113-
* @return boolean
112+
* @return bool
114113
*/
115114
public function isRename()
116115
{
@@ -128,7 +127,7 @@ public function isChangeMode()
128127
/**
129128
* Indicates if this diff file is a deletion.
130129
*
131-
* @return boolean
130+
* @return bool
132131
*/
133132
public function isDeletion()
134133
{
@@ -138,7 +137,7 @@ public function isDeletion()
138137
/**
139138
* Indicates if this diff file is a deletion.
140139
*
141-
* @return boolean
140+
* @return bool
142141
*/
143142
public function isDelete()
144143
{
@@ -232,13 +231,13 @@ public function toArray()
232231
'is_binary' => $this->isBinary,
233232
'changes' => array_map(function (FileChange $change) {
234233
return $change->toArray();
235-
}, $this->changes)
234+
}, $this->changes),
236235
);
237236
}
238237

239238
public static function fromArray(array $array)
240239
{
241-
$file = new File($array['old_name'], $array['new_name'], $array['old_mode'], $array['new_mode'], $array['old_index'], $array['new_index'], $array['is_binary']);
240+
$file = new self($array['old_name'], $array['new_name'], $array['old_mode'], $array['new_mode'], $array['old_index'], $array['new_index'], $array['is_binary']);
242241

243242
foreach ($array['changes'] as $change) {
244243
$file->addChange(FileChange::fromArray($change));

0 commit comments

Comments
 (0)