@@ -73,7 +73,7 @@ |
||
73 | 73 | return null; |
74 | 74 | } |
75 | 75 | |
76 | - return static function ($value) use ($callback) { |
|
76 | + return static function($value) use ($callback) { |
|
77 | 77 | return promise_for($callback($value)); |
78 | 78 | }; |
79 | 79 | } |
@@ -153,7 +153,7 @@ |
||
153 | 153 | $this->info['previous_info'][] = $this->response->getInfo(); |
154 | 154 | if (null !== $onProgress = $options['on_progress'] ?? null) { |
155 | 155 | $thisInfo = &$this->info; |
156 | - $options['on_progress'] = static function (int $dlNow, int $dlSize, array $info) use (&$thisInfo, $onProgress) { |
|
156 | + $options['on_progress'] = static function(int $dlNow, int $dlSize, array $info) use (&$thisInfo, $onProgress) { |
|
157 | 157 | $onProgress($dlNow, $dlSize, $thisInfo + $info); |
158 | 158 | }; |
159 | 159 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | public function __construct(?callable $clientConfigurator, int $maxHostConnections, int $maxPendingPushes, ?LoggerInterface &$logger) |
55 | 55 | { |
56 | - $this->clientConfigurator = $clientConfigurator ?? static function (PooledHttpClient $client) { |
|
56 | + $this->clientConfigurator = $clientConfigurator ?? static function(PooledHttpClient $client) { |
|
57 | 57 | return new InterceptedHttpClient($client, new RetryRequests(2)); |
58 | 58 | }; |
59 | 59 | $this->maxHostConnections = $maxHostConnections; |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | } |
95 | 95 | |
96 | 96 | $request->addEventListener(new AmpListener($info, $options['peer_fingerprint']['pin-sha256'] ?? [], $onProgress, $handle)); |
97 | - $request->setPushHandler(function ($request, $response) use ($options): Promise { |
|
97 | + $request->setPushHandler(function($request, $response) use ($options): Promise { |
|
98 | 98 | return $this->handlePush($request, $response, $options); |
99 | 99 | }); |
100 | 100 | |
101 | 101 | ($request->hasHeader('content-length') ? new Success((int) $request->getHeader('content-length')) : $request->getBody()->getBodyLength()) |
102 | - ->onResolve(static function ($e, $bodySize) use (&$info) { |
|
102 | + ->onResolve(static function($e, $bodySize) use (&$info) { |
|
103 | 103 | if (null !== $bodySize && 0 <= $bodySize) { |
104 | 104 | $info['upload_content_length'] = ((1 + $info['upload_content_length']) ?? 1) - 1 + $bodySize; |
105 | 105 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | [$client, $connector] = $this->getClient($options); |
109 | 109 | $response = $client->request($request, $cancellation); |
110 | - $response->onResolve(static function ($e) use ($connector, &$handle) { |
|
110 | + $response->onResolve(static function($e) use ($connector, &$handle) { |
|
111 | 111 | if (null === $e) { |
112 | 112 | $handle = $connector->handle; |
113 | 113 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | public function connect(string $uri, ?ConnectContext $context = null, ?CancellationToken $token = null): Promise |
153 | 153 | { |
154 | 154 | $result = $this->connector->connect($this->uri ?? $uri, $context, $token); |
155 | - $result->onResolve(function ($e, $socket) { |
|
155 | + $result->onResolve(function($e, $socket) { |
|
156 | 156 | $this->handle = null !== $socket ? $socket->getResource() : false; |
157 | 157 | }); |
158 | 158 |
@@ -78,7 +78,7 @@ |
||
78 | 78 | ($this->onProgress)(); |
79 | 79 | |
80 | 80 | $chunk = $this->doRead(); |
81 | - $chunk->onResolve(function ($e, $data) { |
|
81 | + $chunk->onResolve(function($e, $data) { |
|
82 | 82 | if (null !== $data) { |
83 | 83 | $this->uploaded = \strlen($data); |
84 | 84 | } else { |
@@ -39,7 +39,7 @@ |
||
39 | 39 | |
40 | 40 | private $defaultOptions = self::OPTIONS_DEFAULTS + [ |
41 | 41 | 'auth_ntlm' => null, // array|string - an array containing the username as first value, and optionally the |
42 | - // password as the second one; or string like username:password - enabling NTLM auth |
|
42 | + // password as the second one; or string like username:password - enabling NTLM auth |
|
43 | 43 | 'extra' => [ |
44 | 44 | 'curl' => [], // A list of extra curl options indexed by their corresponding CURLOPT_* |
45 | 45 | ], |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | 'auth_ntlm' => null, // array|string - an array containing the username as first value, and optionally the |
42 | 42 | // password as the second one; or string like username:password - enabling NTLM auth |
43 | 43 | 'extra' => [ |
44 | - 'curl' => [], // A list of extra curl options indexed by their corresponding CURLOPT_* |
|
44 | + 'curl' => [], // A list of extra curl options indexed by their corresponding CURLOPT_* |
|
45 | 45 | ], |
46 | 46 | ]; |
47 | 47 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | return; |
98 | 98 | } |
99 | 99 | |
100 | - curl_multi_setopt($this->multi->handle, \CURLMOPT_PUSHFUNCTION, function ($parent, $pushed, array $requestHeaders) use ($maxPendingPushes) { |
|
100 | + curl_multi_setopt($this->multi->handle, \CURLMOPT_PUSHFUNCTION, function($parent, $pushed, array $requestHeaders) use ($maxPendingPushes) { |
|
101 | 101 | return $this->handlePush($parent, $pushed, $requestHeaders, $maxPendingPushes); |
102 | 102 | }); |
103 | 103 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | } else { |
244 | 244 | $eof = false; |
245 | 245 | $buffer = ''; |
246 | - $curlopts[\CURLOPT_READFUNCTION] = static function ($ch, $fd, $length) use ($body, &$buffer, &$eof) { |
|
246 | + $curlopts[\CURLOPT_READFUNCTION] = static function($ch, $fd, $length) use ($body, &$buffer, &$eof) { |
|
247 | 247 | return self::readRequestBody($length, $body, $buffer, $eof); |
248 | 248 | }; |
249 | 249 | } |
@@ -473,18 +473,18 @@ discard block |
||
473 | 473 | $redirectHeaders = []; |
474 | 474 | if (0 < $options['max_redirects']) { |
475 | 475 | $redirectHeaders['host'] = $host; |
476 | - $redirectHeaders['with_auth'] = $redirectHeaders['no_auth'] = \array_filter($options['headers'], static function ($h) { |
|
476 | + $redirectHeaders['with_auth'] = $redirectHeaders['no_auth'] = \array_filter($options['headers'], static function($h) { |
|
477 | 477 | return 0 !== stripos($h, 'Host:'); |
478 | 478 | }); |
479 | 479 | |
480 | 480 | if (isset($options['normalized_headers']['authorization'][0]) || isset($options['normalized_headers']['cookie'][0])) { |
481 | - $redirectHeaders['no_auth'] = \array_filter($options['headers'], static function ($h) { |
|
481 | + $redirectHeaders['no_auth'] = \array_filter($options['headers'], static function($h) { |
|
482 | 482 | return 0 !== stripos($h, 'Authorization:') && 0 !== stripos($h, 'Cookie:'); |
483 | 483 | }); |
484 | 484 | } |
485 | 485 | } |
486 | 486 | |
487 | - return static function ($ch, string $location) use ($redirectHeaders) { |
|
487 | + return static function($ch, string $location) use ($redirectHeaders) { |
|
488 | 488 | try { |
489 | 489 | $location = self::parseUrl($location); |
490 | 490 | } catch (InvalidArgumentException $e) { |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | |
505 | 505 | private function findConstantName($opt): ?string |
506 | 506 | { |
507 | - $constants = \array_filter(get_defined_constants(), static function ($v, $k) use ($opt) { |
|
507 | + $constants = \array_filter(get_defined_constants(), static function($v, $k) use ($opt) { |
|
508 | 508 | return $v === $opt && 'C' === $k[0] && (0 === \strpos($k, 'CURLOPT_') || 0 === \strpos($k, 'CURLINFO_')); |
509 | 509 | }, \ARRAY_FILTER_USE_BOTH); |
510 | 510 |
@@ -136,7 +136,7 @@ |
||
136 | 136 | return new ResponseStream(MockResponse::stream($mockResponses, $timeout)); |
137 | 137 | } |
138 | 138 | |
139 | - return new ResponseStream((function () use ($mockResponses, $clientResponses, $timeout) { |
|
139 | + return new ResponseStream((function() use ($mockResponses, $clientResponses, $timeout) { |
|
140 | 140 | yield from MockResponse::stream($mockResponses, $timeout); |
141 | 141 | yield $this->client->stream($clientResponses, $timeout); |
142 | 142 | })()); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $buffer = $options['buffer'] ?? true; |
47 | 47 | |
48 | 48 | if ($buffer instanceof \Closure) { |
49 | - $options['buffer'] = static function (array $headers) use ($buffer) { |
|
49 | + $options['buffer'] = static function(array $headers) use ($buffer) { |
|
50 | 50 | if (!\is_bool($buffer = $buffer($headers))) { |
51 | 51 | if (!\is_array($bufferInfo = @stream_get_meta_data($buffer))) { |
52 | 52 | throw new \LogicException(\sprintf('The closure passed as option "buffer" must return bool or stream resource, got "%s".', get_debug_type($buffer))); |
@@ -287,8 +287,8 @@ discard block |
||
287 | 287 | return $body; |
288 | 288 | } |
289 | 289 | |
290 | - $generatorToCallable = static function (\Generator $body): \Closure { |
|
291 | - return static function () use ($body) { |
|
290 | + $generatorToCallable = static function(\Generator $body): \Closure { |
|
291 | + return static function() use ($body) { |
|
292 | 292 | while ($body->valid()) { |
293 | 293 | $chunk = $body->current(); |
294 | 294 | $body->next(); |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | } |
308 | 308 | |
309 | 309 | if ($body instanceof \Traversable) { |
310 | - return $generatorToCallable((static function ($body) { yield from $body; })($body)); |
|
310 | + return $generatorToCallable((static function($body) { yield from $body; })($body)); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | if ($body instanceof \Closure) { |
@@ -477,11 +477,11 @@ discard block |
||
477 | 477 | |
478 | 478 | if (false !== \strpos($parts[$part], '%')) { |
479 | 479 | // https://tools.ietf.org/html/rfc3986#section-2.3 |
480 | - $parts[$part] = preg_replace_callback('/%(?:2[DE]|3[0-9]|[46][1-9A-F]|5F|[57][0-9A]|7E)++/i', function ($m) { return rawurldecode($m[0]); }, $parts[$part]); |
|
480 | + $parts[$part] = preg_replace_callback('/%(?:2[DE]|3[0-9]|[46][1-9A-F]|5F|[57][0-9A]|7E)++/i', function($m) { return rawurldecode($m[0]); }, $parts[$part]); |
|
481 | 481 | } |
482 | 482 | |
483 | 483 | // https://tools.ietf.org/html/rfc3986#section-3.3 |
484 | - $parts[$part] = preg_replace_callback("#[^-A-Za-z0-9._~!$&/'()*+,;=:@%]++#", function ($m) { return rawurlencode($m[0]); }, $parts[$part]); |
|
484 | + $parts[$part] = preg_replace_callback("#[^-A-Za-z0-9._~!$&/'()*+,;=:@%]++#", function($m) { return rawurlencode($m[0]); }, $parts[$part]); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | return [ |
@@ -56,7 +56,7 @@ |
||
56 | 56 | $content = ''; |
57 | 57 | $firstChunk = null; |
58 | 58 | |
59 | - return new AsyncResponse($this->client, $method, $url, $options, function (ChunkInterface $chunk, AsyncContext $context) use ($method, $url, $options, &$retryCount, &$content, &$firstChunk) { |
|
59 | + return new AsyncResponse($this->client, $method, $url, $options, function(ChunkInterface $chunk, AsyncContext $context) use ($method, $url, $options, &$retryCount, &$content, &$firstChunk) { |
|
60 | 60 | $exception = null; |
61 | 61 | try { |
62 | 62 | if ($chunk->isTimeout() || null !== $chunk->getInformationalStatus()) { |
@@ -47,38 +47,38 @@ |
||
47 | 47 | $GLOBALS['xoopsTpl']->assign('showItem', $dirId > 0); |
48 | 48 | |
49 | 49 | switch ($op) { |
50 | - case 'show': |
|
51 | - case 'list': |
|
52 | - default: |
|
53 | - $crDirectories = new \CriteriaCompo(); |
|
54 | - if ($dirId > 0) { |
|
55 | - $crDirectories->add(new \Criteria('dir_id', $dirId)); |
|
56 | - } |
|
57 | - $directoriesCount = $directoriesHandler->getCount($crDirectories); |
|
58 | - $GLOBALS['xoopsTpl']->assign('directoriesCount', $directoriesCount); |
|
59 | - $crDirectories->setStart($start); |
|
60 | - $crDirectories->setLimit($limit); |
|
61 | - $directoriesAll = $directoriesHandler->getAll($crDirectories); |
|
62 | - if ($directoriesCount > 0) { |
|
63 | - $directories = []; |
|
64 | - // Get All Directories |
|
65 | - foreach (\array_keys($directoriesAll) as $i) { |
|
66 | - $directories[$i] = $directoriesAll[$i]->getValuesDirectories(); |
|
67 | - $keywords[$i] = $directoriesAll[$i]->getVar('dir_name'); |
|
68 | - } |
|
69 | - $GLOBALS['xoopsTpl']->assign('directories', $directories); |
|
70 | - unset($directories); |
|
71 | - // Display Navigation |
|
72 | - if ($directoriesCount > $limit) { |
|
73 | - include_once \XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
74 | - $pagenav = new \XoopsPageNav($directoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
75 | - $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
|
76 | - } |
|
77 | - $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); |
|
78 | - $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); |
|
79 | - $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); |
|
80 | - } |
|
81 | - break; |
|
50 | + case 'show': |
|
51 | + case 'list': |
|
52 | + default: |
|
53 | + $crDirectories = new \CriteriaCompo(); |
|
54 | + if ($dirId > 0) { |
|
55 | + $crDirectories->add(new \Criteria('dir_id', $dirId)); |
|
56 | + } |
|
57 | + $directoriesCount = $directoriesHandler->getCount($crDirectories); |
|
58 | + $GLOBALS['xoopsTpl']->assign('directoriesCount', $directoriesCount); |
|
59 | + $crDirectories->setStart($start); |
|
60 | + $crDirectories->setLimit($limit); |
|
61 | + $directoriesAll = $directoriesHandler->getAll($crDirectories); |
|
62 | + if ($directoriesCount > 0) { |
|
63 | + $directories = []; |
|
64 | + // Get All Directories |
|
65 | + foreach (\array_keys($directoriesAll) as $i) { |
|
66 | + $directories[$i] = $directoriesAll[$i]->getValuesDirectories(); |
|
67 | + $keywords[$i] = $directoriesAll[$i]->getVar('dir_name'); |
|
68 | + } |
|
69 | + $GLOBALS['xoopsTpl']->assign('directories', $directories); |
|
70 | + unset($directories); |
|
71 | + // Display Navigation |
|
72 | + if ($directoriesCount > $limit) { |
|
73 | + include_once \XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
74 | + $pagenav = new \XoopsPageNav($directoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
75 | + $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
|
76 | + } |
|
77 | + $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); |
|
78 | + $GLOBALS['xoopsTpl']->assign('divideby', $helper->getConfig('divideby')); |
|
79 | + $GLOBALS['xoopsTpl']->assign('numb_col', $helper->getConfig('numb_col')); |
|
80 | + } |
|
81 | + break; |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // Breadcrumbs |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | use XoopsModules\Wggithub\Constants; |
26 | 26 | use XoopsModules\Wggithub\Common; |
27 | 27 | |
28 | -require __DIR__ . '/header.php'; |
|
28 | +require __DIR__.'/header.php'; |
|
29 | 29 | $GLOBALS['xoopsOption']['template_main'] = 'wggithub_directories.tpl'; |
30 | -include_once \XOOPS_ROOT_PATH . '/header.php'; |
|
30 | +include_once \XOOPS_ROOT_PATH.'/header.php'; |
|
31 | 31 | |
32 | 32 | $op = Request::getCmd('op', 'list'); |
33 | 33 | $start = Request::getInt('start', 0); |
@@ -70,8 +70,8 @@ discard block |
||
70 | 70 | unset($directories); |
71 | 71 | // Display Navigation |
72 | 72 | if ($directoriesCount > $limit) { |
73 | - include_once \XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
74 | - $pagenav = new \XoopsPageNav($directoriesCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
|
73 | + include_once \XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
74 | + $pagenav = new \XoopsPageNav($directoriesCount, $limit, $start, 'start', 'op=list&limit='.$limit); |
|
75 | 75 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
76 | 76 | } |
77 | 77 | $GLOBALS['xoopsTpl']->assign('type', $helper->getConfig('table_type')); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $xoBreadcrumbs[] = ['title' => \_MA_WGGITHUB_DIRECTORIES]; |
86 | 86 | |
87 | 87 | // Keywords |
88 | -wggithubMetaKeywords($helper->getConfig('keywords') . ', ' . \implode(',', $keywords)); |
|
88 | +wggithubMetaKeywords($helper->getConfig('keywords').', '.\implode(',', $keywords)); |
|
89 | 89 | unset($keywords); |
90 | 90 | |
91 | 91 | // Description |
@@ -93,4 +93,4 @@ discard block |
||
93 | 93 | $GLOBALS['xoopsTpl']->assign('xoops_mpageurl', WGGITHUB_URL.'/directories.php'); |
94 | 94 | $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
95 | 95 | |
96 | -require __DIR__ . '/footer.php'; |
|
96 | +require __DIR__.'/footer.php'; |