@@ -53,7 +53,7 @@ |
||
53 | 53 | * @param ParserInterface $parser An output parser |
54 | 54 | * @param ResourceManager $manager A resource manager |
55 | 55 | * @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 |
|
57 | 57 | */ |
58 | 58 | public function __construct( |
59 | 59 | ParserInterface $parser, |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | |
182 | 182 | private static function findABinary($wish, array $defaults, ExecutableFinder $finder) |
183 | 183 | { |
184 | - $possibles = $wish ? (array)$wish : $defaults; |
|
184 | + $possibles = $wish ? (array) $wish : $defaults; |
|
185 | 185 | |
186 | 186 | $binary = null; |
187 | 187 | |
@@ -207,11 +207,10 @@ discard block |
||
207 | 207 | { |
208 | 208 | $iterations = 0; |
209 | 209 | |
210 | - array_walk($files, function ($file) use ($builder, &$iterations) { |
|
210 | + array_walk($files, function($file) use ($builder, &$iterations) { |
|
211 | 211 | $builder->add( |
212 | 212 | $file instanceof \SplFileInfo ? |
213 | - $file->getRealpath() : |
|
214 | - ($file instanceof MemberInterface ? $file->getLocation() : $file) |
|
213 | + $file->getRealpath() : ($file instanceof MemberInterface ? $file->getLocation() : $file) |
|
215 | 214 | ); |
216 | 215 | |
217 | 216 | $iterations++; |
@@ -345,6 +345,9 @@ |
||
345 | 345 | return new \SplFileInfo($to ? : $resource->getResource()); |
346 | 346 | } |
347 | 347 | |
348 | + /** |
|
349 | + * @param string $to |
|
350 | + */ |
|
348 | 351 | protected function doTarExtractMembers($options, ResourceInterface $resource, $members, $to = null, $overwrite = false) |
349 | 352 | { |
350 | 353 | if (null !== $to && !is_dir($to)) { |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | )); |
90 | 90 | } |
91 | 91 | |
92 | - return $this->parser->parseInflatorVersion($process->getOutput() ? : ''); |
|
92 | + return $this->parser->parseInflatorVersion($process->getOutput() ?: ''); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | /** |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $builder->add('-f'); |
125 | 125 | $builder->add($path); |
126 | 126 | $builder->add('-T'); |
127 | - $builder->add( $nullFile); |
|
127 | + $builder->add($nullFile); |
|
128 | 128 | |
129 | 129 | $process = $builder->getProcess(); |
130 | 130 | $process->run(); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | |
142 | 142 | $builder->setWorkingDirectory($collection->getContext()); |
143 | 143 | |
144 | - $collection->forAll(function ($i, Resource $resource) use ($builder) { |
|
144 | + $collection->forAll(function($i, Resource $resource) use ($builder) { |
|
145 | 145 | return $builder->add($resource->getTarget()); |
146 | 146 | }); |
147 | 147 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | |
201 | 201 | $members = array(); |
202 | 202 | |
203 | - foreach ($this->parser->parseFileListing($process->getOutput() ? : '') as $member) { |
|
203 | + foreach ($this->parser->parseFileListing($process->getOutput() ?: '') as $member) { |
|
204 | 204 | $members[] = new Member( |
205 | 205 | $resource, |
206 | 206 | $this, |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | $builder->setWorkingDirectory($collection->getContext()); |
242 | 242 | |
243 | - $collection->forAll(function ($i, Resource $resource) use ($builder) { |
|
243 | + $collection->forAll(function($i, Resource $resource) use ($builder) { |
|
244 | 244 | return $builder->add($resource->getTarget()); |
245 | 245 | }); |
246 | 246 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | )); |
343 | 343 | } |
344 | 344 | |
345 | - return new \SplFileInfo($to ? : $resource->getResource()); |
|
345 | + return new \SplFileInfo($to ?: $resource->getResource()); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | protected function doTarExtractMembers($options, ResourceInterface $resource, $members, $to = null, $overwrite = false) |
@@ -301,6 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | /** |
303 | 303 | * @info is public for PHP 5.3 compatibility, should be private |
304 | + * @param string $file |
|
304 | 305 | */ |
305 | 306 | public function checkReadability(\ZipArchive $zip, $file) |
306 | 307 | { |
@@ -314,6 +315,7 @@ discard block |
||
314 | 315 | |
315 | 316 | /** |
316 | 317 | * @info is public for PHP 5.3 compatibility, should be private |
318 | + * @param string $file |
|
317 | 319 | */ |
318 | 320 | public function addFileToZip(\ZipArchive $zip, $file) |
319 | 321 | { |
@@ -251,11 +251,11 @@ |
||
251 | 251 | $adapter = $this; |
252 | 252 | |
253 | 253 | 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) { |
|
255 | 255 | $adapter->checkReadability($zipresource->getResource(), $resource->getTarget()); |
256 | 256 | if (is_dir($resource->getTarget())) { |
257 | 257 | 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)); |
|
259 | 259 | } else { |
260 | 260 | $adapter->addEmptyDir($zipresource->getResource(), $resource->getTarget()); |
261 | 261 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | /** |
30 | 30 | * Maps the corresponding parser to the selected adapter |
31 | 31 | * |
32 | - * @param $adapterName An adapter name |
|
32 | + * @param string $adapterName An adapter name |
|
33 | 33 | * |
34 | 34 | * @return ParserInterface |
35 | 35 | * |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $container['zip.inflator'] = null; |
43 | 43 | $container['zip.deflator'] = null; |
44 | 44 | |
45 | - $container['resource-manager'] = function ($container) { |
|
45 | + $container['resource-manager'] = function($container) { |
|
46 | 46 | return new ResourceManager( |
47 | 47 | $container['request-mapper'], |
48 | 48 | $container['resource-teleporter'], |
@@ -50,31 +50,31 @@ discard block |
||
50 | 50 | ); |
51 | 51 | }; |
52 | 52 | |
53 | - $container['executable-finder'] = function ($container) { |
|
53 | + $container['executable-finder'] = function($container) { |
|
54 | 54 | return new ExecutableFinder(); |
55 | 55 | }; |
56 | 56 | |
57 | - $container['request-mapper'] = function ($container) { |
|
57 | + $container['request-mapper'] = function($container) { |
|
58 | 58 | return new RequestMapper($container['target-locator']); |
59 | 59 | }; |
60 | 60 | |
61 | - $container['target-locator'] = function () { |
|
61 | + $container['target-locator'] = function() { |
|
62 | 62 | return new TargetLocator(); |
63 | 63 | }; |
64 | 64 | |
65 | - $container['teleporter-container'] = function ($container) { |
|
65 | + $container['teleporter-container'] = function($container) { |
|
66 | 66 | return TeleporterContainer::load(); |
67 | 67 | }; |
68 | 68 | |
69 | - $container['resource-teleporter'] = function ($container) { |
|
69 | + $container['resource-teleporter'] = function($container) { |
|
70 | 70 | return new ResourceTeleporter($container['teleporter-container']); |
71 | 71 | }; |
72 | 72 | |
73 | - $container['filesystem'] = function () { |
|
73 | + $container['filesystem'] = function() { |
|
74 | 74 | return new Filesystem(); |
75 | 75 | }; |
76 | 76 | |
77 | - $container['Alchemy\\Zippy\\Adapter\\ZipAdapter'] = function ($container) { |
|
77 | + $container['Alchemy\\Zippy\\Adapter\\ZipAdapter'] = function($container) { |
|
78 | 78 | return ZipAdapter::newInstance( |
79 | 79 | $container['executable-finder'], |
80 | 80 | $container['resource-manager'], |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $container['gnu-tar.inflator'] = null; |
87 | 87 | $container['gnu-tar.deflator'] = null; |
88 | 88 | |
89 | - $container['Alchemy\\Zippy\\Adapter\\GNUTar\\TarGNUTarAdapter'] = function ($container) { |
|
89 | + $container['Alchemy\\Zippy\\Adapter\\GNUTar\\TarGNUTarAdapter'] = function($container) { |
|
90 | 90 | return TarGNUTarAdapter::newInstance( |
91 | 91 | $container['executable-finder'], |
92 | 92 | $container['resource-manager'], |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ); |
96 | 96 | }; |
97 | 97 | |
98 | - $container['Alchemy\\Zippy\\Adapter\\GNUTar\\TarGzGNUTarAdapter'] = function ($container) { |
|
98 | + $container['Alchemy\\Zippy\\Adapter\\GNUTar\\TarGzGNUTarAdapter'] = function($container) { |
|
99 | 99 | return TarGzGNUTarAdapter::newInstance( |
100 | 100 | $container['executable-finder'], |
101 | 101 | $container['resource-manager'], |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | ); |
105 | 105 | }; |
106 | 106 | |
107 | - $container['Alchemy\\Zippy\\Adapter\\GNUTar\\TarBz2GNUTarAdapter'] = function ($container) { |
|
107 | + $container['Alchemy\\Zippy\\Adapter\\GNUTar\\TarBz2GNUTarAdapter'] = function($container) { |
|
108 | 108 | return TarBz2GNUTarAdapter::newInstance( |
109 | 109 | $container['executable-finder'], |
110 | 110 | $container['resource-manager'], |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $container['bsd-tar.inflator'] = null; |
117 | 117 | $container['bsd-tar.deflator'] = null; |
118 | 118 | |
119 | - $container['Alchemy\\Zippy\\Adapter\\BSDTar\\TarBSDTarAdapter'] = function ($container) { |
|
119 | + $container['Alchemy\\Zippy\\Adapter\\BSDTar\\TarBSDTarAdapter'] = function($container) { |
|
120 | 120 | return TarBSDTarAdapter::newInstance( |
121 | 121 | $container['executable-finder'], |
122 | 122 | $container['resource-manager'], |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | ); |
126 | 126 | }; |
127 | 127 | |
128 | - $container['Alchemy\\Zippy\\Adapter\\BSDTar\\TarGzBSDTarAdapter'] = function ($container) { |
|
128 | + $container['Alchemy\\Zippy\\Adapter\\BSDTar\\TarGzBSDTarAdapter'] = function($container) { |
|
129 | 129 | return TarGzBSDTarAdapter::newInstance( |
130 | 130 | $container['executable-finder'], |
131 | 131 | $container['resource-manager'], |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | ); |
135 | 135 | }; |
136 | 136 | |
137 | - $container['Alchemy\\Zippy\\Adapter\\BSDTar\\TarBz2BSDTarAdapter'] = function ($container) { |
|
137 | + $container['Alchemy\\Zippy\\Adapter\\BSDTar\\TarBz2BSDTarAdapter'] = function($container) { |
|
138 | 138 | return TarBz2BSDTarAdapter::newInstance( |
139 | 139 | $container['executable-finder'], |
140 | 140 | $container['resource-manager'], |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $container['bsd-tar.deflator']); |
143 | 143 | }; |
144 | 144 | |
145 | - $container['Alchemy\\Zippy\\Adapter\\ZipExtensionAdapter'] = function () { |
|
145 | + $container['Alchemy\\Zippy\\Adapter\\ZipExtensionAdapter'] = function() { |
|
146 | 146 | return ZipExtensionAdapter::newInstance(); |
147 | 147 | }; |
148 | 148 |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | protected function doCreate($path, $files, $recursive) |
49 | 49 | { |
50 | - $files = (array)$files; |
|
50 | + $files = (array) $files; |
|
51 | 51 | |
52 | 52 | $builder = $this |
53 | 53 | ->inflator |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $collection = $this->manager->handle(getcwd(), $files); |
67 | 67 | $builder->setWorkingDirectory($collection->getContext()); |
68 | 68 | |
69 | - $collection->forAll(function ($i, Resource $resource) use ($builder) { |
|
69 | + $collection->forAll(function($i, Resource $resource) use ($builder) { |
|
70 | 70 | return $builder->add($resource->getTarget()); |
71 | 71 | }); |
72 | 72 | |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | protected function doAdd(ResourceInterface $resource, $files, $recursive) |
137 | 137 | { |
138 | - $files = (array)$files; |
|
138 | + $files = (array) $files; |
|
139 | 139 | |
140 | 140 | $builder = $this |
141 | 141 | ->inflator |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | $builder->setWorkingDirectory($collection->getContext()); |
155 | 155 | |
156 | - $collection->forAll(function ($i, Resource $resource) use ($builder) { |
|
156 | + $collection->forAll(function($i, Resource $resource) use ($builder) { |
|
157 | 157 | return $builder->add($resource->getTarget()); |
158 | 158 | }); |
159 | 159 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | */ |
231 | 231 | protected function doRemove(ResourceInterface $resource, $files) |
232 | 232 | { |
233 | - $files = (array)$files; |
|
233 | + $files = (array) $files; |
|
234 | 234 | |
235 | 235 | $builder = $this |
236 | 236 | ->inflator |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | throw new InvalidArgumentException(sprintf("%s is not a directory", $to)); |
331 | 331 | } |
332 | 332 | |
333 | - $members = (array)$members; |
|
333 | + $members = (array) $members; |
|
334 | 334 | |
335 | 335 | $builder = $this |
336 | 336 | ->deflator |
@@ -117,12 +117,12 @@ |
||
117 | 117 | /** |
118 | 118 | * @inheritdoc |
119 | 119 | */ |
120 | - public function extract($toDirectory) |
|
121 | - { |
|
120 | + public function extract($toDirectory) |
|
121 | + { |
|
122 | 122 | $this->adapter->extract($this->resource, $toDirectory); |
123 | 123 | |
124 | 124 | return $this; |
125 | - } |
|
125 | + } |
|
126 | 126 | |
127 | 127 | /** |
128 | 128 | * @inheritdoc |
@@ -132,7 +132,7 @@ |
||
132 | 132 | */ |
133 | 133 | public function extract($to = null, $overwrite = false) |
134 | 134 | { |
135 | - $this->adapter->extractMembers($this->resource, $this->location, $to, (bool)$overwrite); |
|
135 | + $this->adapter->extractMembers($this->resource, $this->location, $to, (bool) $overwrite); |
|
136 | 136 | |
137 | 137 | return new \SplFileInfo(sprintf('%s%s', rtrim(null === $to ? getcwd() : $to, '/'), $this->location)); |
138 | 138 | } |
@@ -78,7 +78,7 @@ |
||
78 | 78 | throw new RuntimeException(sprintf('Failed to parse mtime date from %s', $line)); |
79 | 79 | } |
80 | 80 | |
81 | - $members[] = array( |
|
81 | + $members[] = array( |
|
82 | 82 | 'location' => $chunks[7], |
83 | 83 | 'size' => $chunks[5], |
84 | 84 | 'mtime' => $date, |
@@ -44,13 +44,13 @@ |
||
44 | 44 | // drw-rw-r-- 0 toto titi 0 Jan 3 1980 practice/ |
45 | 45 | // -rw-rw-r-- 0 toto titi 10240 Jan 22 13:31 practice/records |
46 | 46 | 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) |
|
54 | 54 | "#", $line, $matches, PREG_SET_ORDER |
55 | 55 | )) { |
56 | 56 | continue; |