@@ -68,13 +68,13 @@ discard block |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // list of relevant elements (FQCNs) |
| 71 | - $classNames = array_filter($classNames, function ($className) use ($context) { |
|
| 71 | + $classNames = array_filter($classNames, function($className) use ($context) { |
|
| 72 | 72 | return (new \ReflectionClass($className))->implementsInterface(ElementInterface::class) |
| 73 | 73 | && $className::isRelevantTo($context); |
| 74 | 74 | }); |
| 75 | 75 | |
| 76 | 76 | // element factory |
| 77 | - $elements = array_map(function ($className) { |
|
| 77 | + $elements = array_map(function($className) { |
|
| 78 | 78 | $element = new $className(); |
| 79 | 79 | |
| 80 | 80 | $reflectionClass = new \ReflectionClass($className); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | }, $classNames); |
| 90 | 90 | |
| 91 | 91 | // sort elements (ASC) |
| 92 | - usort($elements, function (ElementInterface $a, ElementInterface $b) { |
|
| 92 | + usort($elements, function(ElementInterface $a, ElementInterface $b) { |
|
| 93 | 93 | return $a->getOrder() > $b->getOrder() ? 1 : ($a->getOrder() < $b->getOrder() ? -1 : 0); |
| 94 | 94 | }); |
| 95 | 95 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $path = parse_url($base, PHP_URL_PATH); |
| 85 | 85 | $scheme = parse_url($base, PHP_URL_SCHEME); |
| 86 | 86 | |
| 87 | - return preg_replace_callback($pattern, function ($matches) use ($base, $scheme, $host, $path) { |
|
| 87 | + return preg_replace_callback($pattern, function($matches) use ($base, $scheme, $host, $path) { |
|
| 88 | 88 | $hrefValue = $matches[0]; |
| 89 | 89 | |
| 90 | 90 | if (mb_strpos($hrefValue, '//') === 0) { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | private function convertCode($content) |
| 150 | 150 | { |
| 151 | 151 | // strpos with array support |
| 152 | - $strposa = function ($haystack, $needles = []) { |
|
| 152 | + $strposa = function($haystack, $needles = []) { |
|
| 153 | 153 | $chr = []; |
| 154 | 154 | foreach ($needles as $needle) { |
| 155 | 155 | $res = mb_strpos($haystack, $needle); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | $content = str_replace(['<pre>', '<pre ', '</pre>'], ['<code>', '<code ', '</code>'], $content); |
| 169 | 169 | |
| 170 | - return preg_replace_callback('/<code(.*?)>(.*?)<\/code>/s', function ($matches) use ($strposa) { |
|
| 170 | + return preg_replace_callback('/<code(.*?)>(.*?)<\/code>/s', function($matches) use ($strposa) { |
|
| 171 | 171 | $noLineBreaks = str_replace(["\r\n", "\r", "\n"], '<br />', $matches[0]); |
| 172 | 172 | $code = str_replace(['<br></br>', '<br>', '<br/>', '<br />'], PHP_EOL, $noLineBreaks); |
| 173 | 173 | |
@@ -56,7 +56,7 @@ |
||
| 56 | 56 | $title = $this->formatter->asTitle(sprintf('SugarCRM upgrade: %s', $context)) . $delimiter; |
| 57 | 57 | |
| 58 | 58 | return $title . implode($delimiter, array_map( |
| 59 | - function ($element) use ($context) { |
|
| 59 | + function($element) use ($context) { |
|
| 60 | 60 | return $this->elementGenerator->generate($element, $context); |
| 61 | 61 | }, |
| 62 | 62 | $elements |
@@ -71,7 +71,7 @@ |
||
| 71 | 71 | * all versions with $baseVersion base |
| 72 | 72 | * for example: 7.6.1 -> [7.6.1.0, 7.6.1.1], 7.6 -> [7.6.1.0, 7.6.1.1, 7.6.2]. |
| 73 | 73 | */ |
| 74 | - $minors = array_filter($versions, function ($minor) use ($baseVersion) { |
|
| 74 | + $minors = array_filter($versions, function($minor) use ($baseVersion) { |
|
| 75 | 75 | return implode('.', array_slice(explode('.', $minor), 0, count(explode('.', $baseVersion)))) === $baseVersion; |
| 76 | 76 | }); |
| 77 | 77 | |
@@ -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 | } |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | public function getReleaseNotes($flav, array $versions) |
| 38 | 38 | { |
| 39 | - return array_map(function ($version) use ($flav) { |
|
| 39 | + return array_map(function($version) use ($flav) { |
|
| 40 | 40 | return $this->get(sprintf('%s_%s_release_notes', $flav, $version), ''); |
| 41 | 41 | }, $versions); |
| 42 | 42 | } |
@@ -3,8 +3,8 @@ |
||
| 3 | 3 | // application or vendor context |
| 4 | 4 | $autoload = [ |
| 5 | 5 | __DIR__ . '/../vendor/autoload.php', // application bin or phar |
| 6 | - __DIR__ . '/../autoload.php', // vendor bin |
|
| 7 | - __DIR__ . '/../../../autoload.php', // vendor |
|
| 6 | + __DIR__ . '/../autoload.php', // vendor bin |
|
| 7 | + __DIR__ . '/../../../autoload.php', // vendor |
|
| 8 | 8 | ]; |
| 9 | 9 | |
| 10 | 10 | foreach ($autoload as $file) { |