@@ -4,9 +4,20 @@ |
||
4 | 4 | |
5 | 5 | interface FormatterInterface |
6 | 6 | { |
7 | + /** |
|
8 | + * @param string $text |
|
9 | + * |
|
10 | + * @return string |
|
11 | + */ |
|
7 | 12 | public function asTitle($text, $level = 1); |
8 | 13 | |
14 | + /** |
|
15 | + * @return string |
|
16 | + */ |
|
9 | 17 | public function asBody($text); |
10 | 18 | |
19 | + /** |
|
20 | + * @return string |
|
21 | + */ |
|
11 | 22 | public function getDelimiter(); |
12 | 23 | } |
@@ -7,8 +7,9 @@ |
||
7 | 7 | /** |
8 | 8 | * Renders template. |
9 | 9 | * |
10 | - * @param $name |
|
10 | + * @param string $name |
|
11 | 11 | * @param $arguments |
12 | + * @return string |
|
12 | 13 | */ |
13 | 14 | public function render($name, $arguments); |
14 | 15 | } |
@@ -6,13 +6,30 @@ |
||
6 | 6 | |
7 | 7 | interface AdapterInterface |
8 | 8 | { |
9 | + /** |
|
10 | + * @return boolean |
|
11 | + */ |
|
9 | 12 | public function hasUpdate(); |
10 | 13 | |
14 | + /** |
|
15 | + * @return string |
|
16 | + */ |
|
11 | 17 | public function getOldVersion(); |
12 | 18 | |
19 | + /** |
|
20 | + * @return string |
|
21 | + */ |
|
13 | 22 | public function getNewVersion(); |
14 | 23 | |
24 | + /** |
|
25 | + * @param string $stability |
|
26 | + * |
|
27 | + * @return boolean |
|
28 | + */ |
|
15 | 29 | public function update($stability = Updater::STABILITY_ANY); |
16 | 30 | |
31 | + /** |
|
32 | + * @return boolean |
|
33 | + */ |
|
17 | 34 | public function rollback(); |
18 | 35 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
35 | - * @return mixed |
|
35 | + * @return string |
|
36 | 36 | */ |
37 | 37 | public function getOldVersion() |
38 | 38 | { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
43 | - * @return mixed |
|
43 | + * @return string |
|
44 | 44 | */ |
45 | 45 | public function getNewVersion() |
46 | 46 | { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
78 | - * @param $stability |
|
78 | + * @param string $stability |
|
79 | 79 | * |
80 | 80 | * @return string |
81 | 81 | */ |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | /** |
224 | 224 | * Returns the result (response body) of GET request. |
225 | 225 | * |
226 | - * @param $url |
|
226 | + * @param string $url |
|
227 | 227 | * |
228 | 228 | * @return string |
229 | 229 | */ |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | } |
236 | 236 | |
237 | 237 | /** |
238 | - * @param $version |
|
238 | + * @param string $version |
|
239 | 239 | * |
240 | 240 | * @return string |
241 | 241 | */ |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
248 | - * @param $version |
|
248 | + * @param string $version |
|
249 | 249 | * |
250 | 250 | * @return string |
251 | 251 | */ |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | /** |
330 | 330 | * Lightweight HTML purifier. |
331 | 331 | * |
332 | - * @param $html |
|
332 | + * @param string $html |
|
333 | 333 | * @param string $url |
334 | 334 | * @param array $options |
335 | 335 | * |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | // sort versions (ASC) |
76 | - usort($versions, function ($v1, $v2) { |
|
76 | + usort($versions, function($v1, $v2) { |
|
77 | 77 | return version_compare($v1, $v2, '<') ? -1 : (version_compare($v1, $v2, '>') ? 1 : 0); |
78 | 78 | }); |
79 | 79 | |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function getReleaseNotes($flav, array $versions) |
92 | 92 | { |
93 | - $newVersions = array_filter($versions, function ($version) use ($flav) { |
|
93 | + $newVersions = array_filter($versions, function($version) use ($flav) { |
|
94 | 94 | return !$this->cache->has($this->getCacheKey([$flav, 'release_notes', $version])); |
95 | 95 | }); |
96 | 96 | |
97 | - $requests = function () use ($flav, $newVersions) { |
|
97 | + $requests = function() use ($flav, $newVersions) { |
|
98 | 98 | foreach ($newVersions as $version) { |
99 | - yield $version => function () use ($flav, $version) { |
|
99 | + yield $version => function() use ($flav, $version) { |
|
100 | 100 | return $this->httpClient->getAsync($this->getReleaseNotesUri($flav, $version)); |
101 | 101 | }; |
102 | 102 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | if ($newVersions) { |
106 | 106 | $this->processRequestPool($requests, [ |
107 | - 'fulfilled' => function (ResponseInterface $response, $version) use ($flav) { |
|
107 | + 'fulfilled' => function(ResponseInterface $response, $version) use ($flav) { |
|
108 | 108 | $html = $response->getBody()->getContents(); |
109 | 109 | $crawler = new Crawler($this->purifyHtml($html, $this->getReleaseNotesUri($flav, $version))); |
110 | 110 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | $this->cache->set($this->getCacheKey([$flav, 'release_notes', $version]), $releaseNote); |
136 | 136 | }, |
137 | - 'rejected' => function ($reason, $version) { |
|
137 | + 'rejected' => function($reason, $version) { |
|
138 | 138 | throw new \RuntimeException( |
139 | 139 | sprintf('Can\'t get release notes for version: %s (reason: %s)', $version, $reason) |
140 | 140 | ); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | - uksort($releaseNotes, function ($v1, $v2) { |
|
153 | + uksort($releaseNotes, function($v1, $v2) { |
|
154 | 154 | return version_compare($v1, $v2, '<') ? -1 : (version_compare($v1, $v2, '>') ? 1 : 0); |
155 | 155 | }); |
156 | 156 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | { |
320 | 320 | $delimiter = '___'; |
321 | 321 | |
322 | - return implode($delimiter, array_map(function ($key) { |
|
322 | + return implode($delimiter, array_map(function($key) { |
|
323 | 323 | return preg_replace('/[^a-zA-Z0-9_\.]+/', '', mb_strtolower($key)); |
324 | 324 | }, $keyParts)); |
325 | 325 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
48 | - * @param $buildPath |
|
48 | + * @param string $buildPath |
|
49 | 49 | * @param $packages |
50 | 50 | * |
51 | 51 | * @return array |
@@ -141,8 +141,8 @@ discard block |
||
141 | 141 | /** |
142 | 142 | * Gets flav specific packages |
143 | 143 | * |
144 | - * @param $flav |
|
145 | - * @param $packagesPath |
|
144 | + * @param string $flav |
|
145 | + * @param string $packagesPath |
|
146 | 146 | * |
147 | 147 | * @return array |
148 | 148 | */ |
@@ -196,8 +196,8 @@ discard block |
||
196 | 196 | * Calculates an array of possible upgrade chains |
197 | 197 | * |
198 | 198 | * @param $packages |
199 | - * @param $buildVersion |
|
200 | - * @param $upgradeTo |
|
199 | + * @param string $buildVersion |
|
200 | + * @param string $upgradeTo |
|
201 | 201 | * |
202 | 202 | * @return array |
203 | 203 | */ |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $deletedFiles = array_diff(array_merge($deletedFiles, $packageDeletedFiles), $packageModifiedFiles); |
78 | 78 | } |
79 | 79 | |
80 | - $modifiedFiles = array_keys(array_filter($modifiedFiles, function ($package, $changedFile) use ($buildPath, $packageZips) { |
|
80 | + $modifiedFiles = array_keys(array_filter($modifiedFiles, function($package, $changedFile) use ($buildPath, $packageZips) { |
|
81 | 81 | if (($buildFile = @file_get_contents($buildPath . DS . $changedFile)) === false) { |
82 | 82 | return false; |
83 | 83 | } |
@@ -92,11 +92,11 @@ discard block |
||
92 | 92 | $zip->close(); |
93 | 93 | } |
94 | 94 | |
95 | - $modifiedFiles = array_values(array_filter($modifiedFiles, function ($file) use ($buildPath) { |
|
95 | + $modifiedFiles = array_values(array_filter($modifiedFiles, function($file) use ($buildPath) { |
|
96 | 96 | return file_exists($buildPath . '/custom/' . $file); |
97 | 97 | })); |
98 | 98 | |
99 | - $deletedFiles = array_values(array_filter($deletedFiles, function ($file) use ($buildPath) { |
|
99 | + $deletedFiles = array_values(array_filter($deletedFiles, function($file) use ($buildPath) { |
|
100 | 100 | return file_exists($buildPath . '/custom/' . $file); |
101 | 101 | })); |
102 | 102 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | return $this->suitablePackages; |
130 | 130 | } |
131 | 131 | |
132 | - usort($upgradeChains, function ($a1, $a2) { |
|
132 | + usort($upgradeChains, function($a1, $a2) { |
|
133 | 133 | return count($a1) < count($a2) ? -1 : (count($a1) > count($a2) ? 1 : 0); |
134 | 134 | }); |
135 | 135 | |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $versionMatrix = $this->getVersionMatrix($packages); |
212 | 212 | $allVersions = array_keys($versionMatrix); |
213 | 213 | |
214 | - $getExistingSubversions = function ($version) use ($allVersions) { |
|
214 | + $getExistingSubversions = function($version) use ($allVersions) { |
|
215 | 215 | $existingVersions = []; |
216 | 216 | |
217 | 217 | $fromParts = explode('.', $version); |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | }; |
227 | 227 | |
228 | 228 | // init chains with starting versions |
229 | - $chains = array_map(function ($version) use ($buildVersion) { |
|
229 | + $chains = array_map(function($version) use ($buildVersion) { |
|
230 | 230 | return [$version => $buildVersion]; |
231 | 231 | }, $getExistingSubversions($buildVersion)); |
232 | 232 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | } |
237 | 237 | |
238 | 238 | // gets last key of assoc array |
239 | - $getLastKey = function ($array) { |
|
239 | + $getLastKey = function($array) { |
|
240 | 240 | end($array); |
241 | 241 | |
242 | 242 | return key($array); |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | $chains = $fullChains; |
286 | 286 | } |
287 | 287 | |
288 | - $chains = array_map(function ($chain) use ($versionMatrix) { |
|
288 | + $chains = array_map(function($chain) use ($versionMatrix) { |
|
289 | 289 | $keys = array_keys($chain); |
290 | 290 | $values = array_values($chain); |
291 | 291 | |
@@ -315,17 +315,17 @@ discard block |
||
315 | 315 | */ |
316 | 316 | private function getVersionMatrix($packages) |
317 | 317 | { |
318 | - $allVersions = array_unique(call_user_func_array('array_merge', array_map(function ($package) { |
|
318 | + $allVersions = array_unique(call_user_func_array('array_merge', array_map(function($package) { |
|
319 | 319 | return [$package['from'], $package['to']]; |
320 | 320 | }, $packages))); |
321 | 321 | |
322 | 322 | // sort versions (ASC) |
323 | - usort($allVersions, function ($v1, $v2) { |
|
323 | + usort($allVersions, function($v1, $v2) { |
|
324 | 324 | return version_compare($v1, $v2, '<') ? -1 : (version_compare($v1, $v2, '>') ? 1 : 0); |
325 | 325 | }); |
326 | 326 | |
327 | 327 | // create matrix and fill it with zeros |
328 | - $versionMatrix = call_user_func_array('array_merge',array_map(function ($version) use ($allVersions) { |
|
328 | + $versionMatrix = call_user_func_array('array_merge', array_map(function($version) use ($allVersions) { |
|
329 | 329 | return [$version => array_combine($allVersions, array_fill(0, count($allVersions), 0))]; |
330 | 330 | }, $allVersions)); |
331 | 331 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | /** |
34 | 34 | * @param Upgrade $context |
35 | 35 | * |
36 | - * @return bool |
|
36 | + * @return string |
|
37 | 37 | */ |
38 | 38 | public function isRelevantTo(Upgrade $context) |
39 | 39 | { |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function getSuitableElements(Upgrade $context) |
52 | 52 | { |
53 | - $elements = array_filter($this->specElements, function (ElementInterface $element) use ($context) { |
|
53 | + $elements = array_filter($this->specElements, function(ElementInterface $element) use ($context) { |
|
54 | 54 | return $element->isRelevantTo($context); |
55 | 55 | }); |
56 | 56 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | // sort elements (ASC) |
66 | - usort($elements, function (ElementInterface $a, ElementInterface $b) { |
|
66 | + usort($elements, function(ElementInterface $a, ElementInterface $b) { |
|
67 | 67 | return $a->getOrder() > $b->getOrder() ? 1 : ($a->getOrder() < $b->getOrder() ? -1 : 0); |
68 | 68 | }); |
69 | 69 |