Skip to content

Commit dd7eb36

Browse files
committed
Merge pull request #1 from aztech-dev/scrutinizer-patch-1
Scrutinizer Auto-Fixes
2 parents f432e4d + 43108b7 commit dd7eb36

20 files changed

+74
-72
lines changed

src/Adapter/AbstractAdapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,6 @@ private function makeTargetAbsolute($path)
247247
throw new InvalidArgumentException(sprintf('Target path %s is not writeable.', $directory));
248248
}
249249

250-
return realpath($directory).'/'.PathUtil::basename($path);
250+
return realpath($directory) . '/' . PathUtil::basename($path);
251251
}
252252
}

src/Adapter/AbstractBinaryAdapter.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ abstract class AbstractBinaryAdapter extends AbstractAdapter implements BinaryAd
5353
* @param ParserInterface $parser An output parser
5454
* @param ResourceManager $manager A resource manager
5555
* @param ProcessBuilderFactoryInterface $inflator A process builder factory for the inflator binary
56-
* @param ProcessBuilderFactoryInterface|null $deflator A process builder factory for the deflator binary
56+
* @param ProcessBuilderFactoryInterface $deflator A process builder factory for the deflator binary
5757
*/
5858
public function __construct(
5959
ParserInterface $parser,
@@ -181,7 +181,7 @@ public static function newInstance(
181181

182182
private static function findABinary($wish, array $defaults, ExecutableFinder $finder)
183183
{
184-
$possibles = $wish ? (array)$wish : $defaults;
184+
$possibles = $wish ? (array) $wish : $defaults;
185185

186186
$binary = null;
187187

@@ -207,11 +207,10 @@ protected function addBuilderFileArgument(array $files, ProcessBuilder $builder)
207207
{
208208
$iterations = 0;
209209

210-
array_walk($files, function ($file) use ($builder, &$iterations) {
210+
array_walk($files, function($file) use ($builder, &$iterations) {
211211
$builder->add(
212212
$file instanceof \SplFileInfo ?
213-
$file->getRealpath() :
214-
($file instanceof MemberInterface ? $file->getLocation() : $file)
213+
$file->getRealpath() : ($file instanceof MemberInterface ? $file->getLocation() : $file)
215214
);
216215

217216
$iterations++;

src/Adapter/AbstractTarAdapter.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ protected function doGetInflatorVersion()
8989
));
9090
}
9191

92-
return $this->parser->parseInflatorVersion($process->getOutput() ? : '');
92+
return $this->parser->parseInflatorVersion($process->getOutput() ?: '');
9393
}
9494

9595
/**
@@ -124,7 +124,7 @@ protected function doTarCreate($options, $path, $files = null, $recursive = true
124124
$builder->add('-f');
125125
$builder->add($path);
126126
$builder->add('-T');
127-
$builder->add( $nullFile);
127+
$builder->add($nullFile);
128128

129129
$process = $builder->getProcess();
130130
$process->run();
@@ -141,7 +141,7 @@ protected function doTarCreate($options, $path, $files = null, $recursive = true
141141

142142
$builder->setWorkingDirectory($collection->getContext());
143143

144-
$collection->forAll(function ($i, Resource $resource) use ($builder) {
144+
$collection->forAll(function($i, Resource $resource) use ($builder) {
145145
return $builder->add($resource->getTarget());
146146
});
147147

@@ -200,7 +200,7 @@ protected function doTarListMembers($options, ResourceInterface $resource)
200200

201201
$members = array();
202202

203-
foreach ($this->parser->parseFileListing($process->getOutput() ? : '') as $member) {
203+
foreach ($this->parser->parseFileListing($process->getOutput() ?: '') as $member) {
204204
$members[] = new Member(
205205
$resource,
206206
$this,
@@ -240,7 +240,7 @@ protected function doTarAdd($options, ResourceInterface $resource, $files, $recu
240240

241241
$builder->setWorkingDirectory($collection->getContext());
242242

243-
$collection->forAll(function ($i, Resource $resource) use ($builder) {
243+
$collection->forAll(function($i, Resource $resource) use ($builder) {
244244
return $builder->add($resource->getTarget());
245245
});
246246

@@ -342,9 +342,12 @@ protected function doTarExtract($options, ResourceInterface $resource, $to = nul
342342
));
343343
}
344344

345-
return new \SplFileInfo($to ? : $resource->getResource());
345+
return new \SplFileInfo($to ?: $resource->getResource());
346346
}
347347

348+
/**
349+
* @param string $to
350+
*/
348351
protected function doTarExtractMembers($options, ResourceInterface $resource, $members, $to = null, $overwrite = false)
349352
{
350353
if (null !== $to && !is_dir($to)) {

src/Adapter/AdapterContainer.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,39 +42,39 @@ public static function load()
4242
$container['zip.inflator'] = null;
4343
$container['zip.deflator'] = null;
4444

45-
$container['resource-manager'] = function ($container) {
45+
$container['resource-manager'] = function($container) {
4646
return new ResourceManager(
4747
$container['request-mapper'],
4848
$container['resource-teleporter'],
4949
$container['filesystem']
5050
);
5151
};
5252

53-
$container['executable-finder'] = function ($container) {
53+
$container['executable-finder'] = function($container) {
5454
return new ExecutableFinder();
5555
};
5656

57-
$container['request-mapper'] = function ($container) {
57+
$container['request-mapper'] = function($container) {
5858
return new RequestMapper($container['target-locator']);
5959
};
6060

61-
$container['target-locator'] = function () {
61+
$container['target-locator'] = function() {
6262
return new TargetLocator();
6363
};
6464

65-
$container['teleporter-container'] = function ($container) {
65+
$container['teleporter-container'] = function($container) {
6666
return TeleporterContainer::load();
6767
};
6868

69-
$container['resource-teleporter'] = function ($container) {
69+
$container['resource-teleporter'] = function($container) {
7070
return new ResourceTeleporter($container['teleporter-container']);
7171
};
7272

73-
$container['filesystem'] = function () {
73+
$container['filesystem'] = function() {
7474
return new Filesystem();
7575
};
7676

77-
$container['Alchemy\\Zippy\\Adapter\\ZipAdapter'] = function ($container) {
77+
$container['Alchemy\\Zippy\\Adapter\\ZipAdapter'] = function($container) {
7878
return ZipAdapter::newInstance(
7979
$container['executable-finder'],
8080
$container['resource-manager'],
@@ -86,7 +86,7 @@ public static function load()
8686
$container['gnu-tar.inflator'] = null;
8787
$container['gnu-tar.deflator'] = null;
8888

89-
$container['Alchemy\\Zippy\\Adapter\\GNUTar\\TarGNUTarAdapter'] = function ($container) {
89+
$container['Alchemy\\Zippy\\Adapter\\GNUTar\\TarGNUTarAdapter'] = function($container) {
9090
return TarGNUTarAdapter::newInstance(
9191
$container['executable-finder'],
9292
$container['resource-manager'],
@@ -95,7 +95,7 @@ public static function load()
9595
);
9696
};
9797

98-
$container['Alchemy\\Zippy\\Adapter\\GNUTar\\TarGzGNUTarAdapter'] = function ($container) {
98+
$container['Alchemy\\Zippy\\Adapter\\GNUTar\\TarGzGNUTarAdapter'] = function($container) {
9999
return TarGzGNUTarAdapter::newInstance(
100100
$container['executable-finder'],
101101
$container['resource-manager'],
@@ -104,7 +104,7 @@ public static function load()
104104
);
105105
};
106106

107-
$container['Alchemy\\Zippy\\Adapter\\GNUTar\\TarBz2GNUTarAdapter'] = function ($container) {
107+
$container['Alchemy\\Zippy\\Adapter\\GNUTar\\TarBz2GNUTarAdapter'] = function($container) {
108108
return TarBz2GNUTarAdapter::newInstance(
109109
$container['executable-finder'],
110110
$container['resource-manager'],
@@ -116,7 +116,7 @@ public static function load()
116116
$container['bsd-tar.inflator'] = null;
117117
$container['bsd-tar.deflator'] = null;
118118

119-
$container['Alchemy\\Zippy\\Adapter\\BSDTar\\TarBSDTarAdapter'] = function ($container) {
119+
$container['Alchemy\\Zippy\\Adapter\\BSDTar\\TarBSDTarAdapter'] = function($container) {
120120
return TarBSDTarAdapter::newInstance(
121121
$container['executable-finder'],
122122
$container['resource-manager'],
@@ -125,7 +125,7 @@ public static function load()
125125
);
126126
};
127127

128-
$container['Alchemy\\Zippy\\Adapter\\BSDTar\\TarGzBSDTarAdapter'] = function ($container) {
128+
$container['Alchemy\\Zippy\\Adapter\\BSDTar\\TarGzBSDTarAdapter'] = function($container) {
129129
return TarGzBSDTarAdapter::newInstance(
130130
$container['executable-finder'],
131131
$container['resource-manager'],
@@ -134,15 +134,15 @@ public static function load()
134134
);
135135
};
136136

137-
$container['Alchemy\\Zippy\\Adapter\\BSDTar\\TarBz2BSDTarAdapter'] = function ($container) {
137+
$container['Alchemy\\Zippy\\Adapter\\BSDTar\\TarBz2BSDTarAdapter'] = function($container) {
138138
return TarBz2BSDTarAdapter::newInstance(
139139
$container['executable-finder'],
140140
$container['resource-manager'],
141141
$container['bsd-tar.inflator'],
142142
$container['bsd-tar.deflator']);
143143
};
144144

145-
$container['Alchemy\\Zippy\\Adapter\\ZipExtensionAdapter'] = function () {
145+
$container['Alchemy\\Zippy\\Adapter\\ZipExtensionAdapter'] = function() {
146146
return ZipExtensionAdapter::newInstance();
147147
};
148148

src/Adapter/ZipAdapter.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __construct(
4747
*/
4848
protected function doCreate($path, $files, $recursive)
4949
{
50-
$files = (array)$files;
50+
$files = (array) $files;
5151

5252
$builder = $this
5353
->inflator
@@ -66,7 +66,7 @@ protected function doCreate($path, $files, $recursive)
6666
$collection = $this->manager->handle(getcwd(), $files);
6767
$builder->setWorkingDirectory($collection->getContext());
6868

69-
$collection->forAll(function ($i, Resource $resource) use ($builder) {
69+
$collection->forAll(function($i, Resource $resource) use ($builder) {
7070
return $builder->add($resource->getTarget());
7171
});
7272

@@ -135,7 +135,7 @@ protected function doListMembers(ResourceInterface $resource)
135135
*/
136136
protected function doAdd(ResourceInterface $resource, $files, $recursive)
137137
{
138-
$files = (array)$files;
138+
$files = (array) $files;
139139

140140
$builder = $this
141141
->inflator
@@ -153,7 +153,7 @@ protected function doAdd(ResourceInterface $resource, $files, $recursive)
153153

154154
$builder->setWorkingDirectory($collection->getContext());
155155

156-
$collection->forAll(function ($i, Resource $resource) use ($builder) {
156+
$collection->forAll(function($i, Resource $resource) use ($builder) {
157157
return $builder->add($resource->getTarget());
158158
});
159159

@@ -230,7 +230,7 @@ protected function doGetInflatorVersion()
230230
*/
231231
protected function doRemove(ResourceInterface $resource, $files)
232232
{
233-
$files = (array)$files;
233+
$files = (array) $files;
234234

235235
$builder = $this
236236
->inflator
@@ -330,7 +330,7 @@ protected function doExtractMembers(ResourceInterface $resource, $members, $to,
330330
throw new InvalidArgumentException(sprintf("%s is not a directory", $to));
331331
}
332332

333-
$members = (array)$members;
333+
$members = (array) $members;
334334

335335
$builder = $this
336336
->deflator

src/Adapter/ZipExtensionAdapter.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,11 @@ private function addEntries(ZipArchiveResource $zipresource, array $files, $recu
251251
$adapter = $this;
252252

253253
try {
254-
$collection->forAll(function ($i, Resource $resource) use ($zipresource, $stack, $recursive, $adapter) {
254+
$collection->forAll(function($i, Resource $resource) use ($zipresource, $stack, $recursive, $adapter) {
255255
$adapter->checkReadability($zipresource->getResource(), $resource->getTarget());
256256
if (is_dir($resource->getTarget())) {
257257
if ($recursive) {
258-
$stack->push($resource->getTarget() . ((substr($resource->getTarget(), -1) === DIRECTORY_SEPARATOR) ? '' : DIRECTORY_SEPARATOR ));
258+
$stack->push($resource->getTarget() . ((substr($resource->getTarget(), -1) === DIRECTORY_SEPARATOR) ? '' : DIRECTORY_SEPARATOR));
259259
} else {
260260
$adapter->addEmptyDir($zipresource->getResource(), $resource->getTarget());
261261
}
@@ -301,6 +301,7 @@ private function addEntries(ZipArchiveResource $zipresource, array $files, $recu
301301

302302
/**
303303
* @info is public for PHP 5.3 compatibility, should be private
304+
* @param string $file
304305
*/
305306
public function checkReadability(\ZipArchive $zip, $file)
306307
{
@@ -314,6 +315,7 @@ public function checkReadability(\ZipArchive $zip, $file)
314315

315316
/**
316317
* @info is public for PHP 5.3 compatibility, should be private
318+
* @param string $file
317319
*/
318320
public function addFileToZip(\ZipArchive $zip, $file)
319321
{

src/Archive/Archive.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ public function removeMembers($sources)
117117
/**
118118
* @inheritdoc
119119
*/
120-
public function extract($toDirectory)
121-
{
120+
public function extract($toDirectory)
121+
{
122122
$this->adapter->extract($this->resource, $toDirectory);
123123

124124
return $this;
125-
}
125+
}
126126

127127
/**
128128
* @inheritdoc

src/Archive/Member.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function __toString()
132132
*/
133133
public function extract($to = null, $overwrite = false)
134134
{
135-
$this->adapter->extractMembers($this->resource, $this->location, $to, (bool)$overwrite);
135+
$this->adapter->extractMembers($this->resource, $this->location, $to, (bool) $overwrite);
136136

137137
return new \SplFileInfo(sprintf('%s%s', rtrim(null === $to ? getcwd() : $to, '/'), $this->location));
138138
}

src/Parser/BSDTarOutputParser.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ public function parseFileListing($output)
4444
// drw-rw-r-- 0 toto titi 0 Jan 3 1980 practice/
4545
// -rw-rw-r-- 0 toto titi 10240 Jan 22 13:31 practice/records
4646
if (!preg_match_all("#" .
47-
self::PERMISSIONS . "\s+" . // match (drw-r--r--)
48-
self::HARD_LINK . "\s+" . // match (1)
49-
self::OWNER . "\s" . // match (toto)
50-
self::GROUP . "\s+" . // match (titi)
51-
self::FILESIZE . "\s+" . // match (0)
52-
self::DATE . "\s+" . // match (Jan 3 1980)
53-
self::FILENAME . // match (practice)
47+
self::PERMISSIONS . "\s+" . // match (drw-r--r--)
48+
self::HARD_LINK . "\s+" . // match (1)
49+
self::OWNER . "\s" . // match (toto)
50+
self::GROUP . "\s+" . // match (titi)
51+
self::FILESIZE . "\s+" . // match (0)
52+
self::DATE . "\s+" . // match (Jan 3 1980)
53+
self::FILENAME . // match (practice)
5454
"#", $line, $matches, PREG_SET_ORDER
5555
)) {
5656
continue;
@@ -78,7 +78,7 @@ public function parseFileListing($output)
7878
throw new RuntimeException(sprintf('Failed to parse mtime date from %s', $line));
7979
}
8080

81-
$members[] = array(
81+
$members[] = array(
8282
'location' => $chunks[7],
8383
'size' => $chunks[5],
8484
'mtime' => $date,

src/Parser/ParserFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static function setZipDateFormat($format)
2929
/**
3030
* Maps the corresponding parser to the selected adapter
3131
*
32-
* @param $adapterName An adapter name
32+
* @param string $adapterName An adapter name
3333
*
3434
* @return ParserInterface
3535
*

0 commit comments

Comments
 (0)