@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | public function visitsThisYear(WelcomeBlockModule $module, int $block_id): ?int |
| 41 | 41 | { |
| 42 | 42 | return Registry::cache()->file()->remember( |
| 43 | - $module->name() . '-matomovisits-yearly-' . $block_id, |
|
| 44 | - function () use ($module, $block_id): ?int { |
|
| 43 | + $module->name().'-matomovisits-yearly-'.$block_id, |
|
| 44 | + function() use ($module, $block_id) : ?int { |
|
| 45 | 45 | $visits_year = $this->visits($module, $block_id, 'year'); |
| 46 | 46 | if ($visits_year === null) { |
| 47 | 47 | return null; |
| 48 | 48 | } |
| 49 | - $visits_today = (int) $this->visits($module, $block_id, 'day'); |
|
| 49 | + $visits_today = (int)$this->visits($module, $block_id, 'day'); |
|
| 50 | 50 | |
| 51 | 51 | return $visits_year - $visits_today; |
| 52 | 52 | }, |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | public function visitsToday(WelcomeBlockModule $module, int $block_id): ?int |
| 65 | 65 | { |
| 66 | 66 | return Registry::cache()->array()->remember( |
| 67 | - $module->name() . '-matomovisits-daily-' . $block_id, |
|
| 68 | - function () use ($module, $block_id): ?int { |
|
| 67 | + $module->name().'-matomovisits-daily-'.$block_id, |
|
| 68 | + function() use ($module, $block_id) : ?int { |
|
| 69 | 69 | return $this->visits($module, $block_id, 'day'); |
| 70 | 70 | } |
| 71 | 71 | ); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | ]); |
| 108 | 108 | |
| 109 | 109 | if ($response->getStatusCode() === StatusCodeInterface::STATUS_OK) { |
| 110 | - $result = json_decode((string) $response->getBody(), true)['value'] ?? null; |
|
| 110 | + $result = json_decode((string)$response->getBody(), true)['value'] ?? null; |
|
| 111 | 111 | if ($result !== null) { |
| 112 | 112 | return (int)$result; |
| 113 | 113 | } |
@@ -99,16 +99,16 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | public function loadRoutes($router): void |
| 101 | 101 | { |
| 102 | - $router->attach('', '', static function (Map $router): void { |
|
| 102 | + $router->attach('', '', static function(Map $router): void { |
|
| 103 | 103 | |
| 104 | - $router->attach('', '/module-maj/certificates', static function (Map $router): void { |
|
| 104 | + $router->attach('', '/module-maj/certificates', static function(Map $router): void { |
|
| 105 | 105 | |
| 106 | - $router->attach('', '/admin', static function (Map $router): void { |
|
| 106 | + $router->attach('', '/admin', static function(Map $router): void { |
|
| 107 | 107 | |
| 108 | 108 | $router->get(AdminTreesPage::class, '/trees', AdminTreesPage::class) |
| 109 | - ->extras(['middleware' => [ AuthAdministrator::class ]]); |
|
| 109 | + ->extras(['middleware' => [AuthAdministrator::class]]); |
|
| 110 | 110 | |
| 111 | - $router->attach('', '/config/{tree}', static function (Map $router): void { |
|
| 111 | + $router->attach('', '/config/{tree}', static function(Map $router): void { |
|
| 112 | 112 | |
| 113 | 113 | $router->extras([ |
| 114 | 114 | 'middleware' => [ |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | 'permission_preference' => 'MAJ_CERTIF_SHOW_CERT' |
| 127 | 127 | ]); |
| 128 | 128 | |
| 129 | - $router->attach('', '/certificate/{tree}/{cid}', static function (Map $router): void { |
|
| 129 | + $router->attach('', '/certificate/{tree}/{cid}', static function(Map $router): void { |
|
| 130 | 130 | |
| 131 | 131 | $router->extras([ |
| 132 | 132 | 'middleware' => [AuthTreePreference::class], |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | public function headContent(): string |
| 166 | 166 | { |
| 167 | - return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
| 167 | + return '<link rel="stylesheet" href="'.e($this->moduleCssUrl()).'">'; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | public function listUrl(Tree $tree, array $parameters = []): string |
| 175 | 175 | { |
| 176 | - return route(CertificatesList::class, ['tree' => $tree->name() ] + $parameters); |
|
| 176 | + return route(CertificatesList::class, ['tree' => $tree->name()] + $parameters); |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | /** |
@@ -191,6 +191,6 @@ discard block |
||
| 191 | 191 | */ |
| 192 | 192 | public function listIsEmpty(Tree $tree): bool |
| 193 | 193 | { |
| 194 | - return Auth::accessLevel($tree) > (int) $tree->getPreference('MAJ_CERTIF_SHOW_CERT', (string) Auth::PRIV_HIDE); |
|
| 194 | + return Auth::accessLevel($tree) > (int)$tree->getPreference('MAJ_CERTIF_SHOW_CERT', (string)Auth::PRIV_HIDE); |
|
| 195 | 195 | } |
| 196 | 196 | } |
@@ -202,11 +202,11 @@ |
||
| 202 | 202 | { |
| 203 | 203 | $sort_prefix = ''; |
| 204 | 204 | if (preg_match_all('/\b([A-Z]{3,})\b/', $this->description(), $matches, PREG_SET_ORDER) >= 1) { |
| 205 | - $sort_prefix = implode('_', array_map(function ($match) { |
|
| 205 | + $sort_prefix = implode('_', array_map(function($match) { |
|
| 206 | 206 | return $match[1]; |
| 207 | - }, $matches)) . '_'; |
|
| 207 | + }, $matches)).'_'; |
|
| 208 | 208 | } |
| 209 | - return $sort_prefix . $this->description(); |
|
| 209 | + return $sort_prefix.$this->description(); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -125,6 +125,6 @@ |
||
| 125 | 125 | */ |
| 126 | 126 | private function stringLengthEstimate(int $text_length, int $font_size): int |
| 127 | 127 | { |
| 128 | - return $text_length * (int) ceil(($font_size + 2) * 0.5); |
|
| 128 | + return $text_length * (int)ceil(($font_size + 2) * 0.5); |
|
| 129 | 129 | } |
| 130 | 130 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | $title = I18N::translate('Certificates'); |
| 81 | 81 | |
| 82 | - $cities = array_map(function (string $item): array { |
|
| 82 | + $cities = array_map(function(string $item): array { |
|
| 83 | 83 | return [$this->url_obfuscator_service->obfuscate($item), $item]; |
| 84 | 84 | }, $this->certif_filesystem->cities($tree)); |
| 85 | 85 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | $certificates = $this->certif_filesystem->certificatesForCity($tree, $city); |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - return $this->viewResponse($this->module->name() . '::certificates-list', [ |
|
| 93 | + return $this->viewResponse($this->module->name().'::certificates-list', [ |
|
| 94 | 94 | 'title' => $title, |
| 95 | 95 | 'tree' => $tree, |
| 96 | 96 | 'module_name' => $this->module->name(), |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | return redirect(route(AdminConfigPage::class, ['tree' => $trees->first()])); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - return $this->viewResponse($this->module->name() . '::admin/trees', [ |
|
| 75 | + return $this->viewResponse($this->module->name().'::admin/trees', [ |
|
| 76 | 76 | 'title' => $this->module->title(), |
| 77 | 77 | 'trees' => $this->tree_service->all() |
| 78 | 78 | ]); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | if ($certificate === null) { |
| 106 | 106 | return $this->certif_image_factory |
| 107 | - ->replacementImageResponse((string) StatusCodeInterface::STATUS_NOT_FOUND) |
|
| 107 | + ->replacementImageResponse((string)StatusCodeInterface::STATUS_NOT_FOUND) |
|
| 108 | 108 | ->withHeader('X-Image-Exception', I18N::translate('The certificate was not found in this family tree.')) |
| 109 | 109 | ; |
| 110 | 110 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $size = $certificate->tree()->getPreference('MAJ_CERTIF_WM_FONT_MAXSIZE'); |
| 133 | 133 | $text = $this->watermarkText($request, $certificate); |
| 134 | 134 | |
| 135 | - return new Watermark($text, $color, is_numeric($size) ? (int) $size : Watermark::DEFAULT_SIZE); |
|
| 135 | + return new Watermark($text, $color, is_numeric($size) ? (int)$size : Watermark::DEFAULT_SIZE); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | return redirect(route(TreePage::class, ['tree' => $tree->name()])); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - return $this->viewResponse($this->module->name() . '::certificate-page', [ |
|
| 103 | + return $this->viewResponse($this->module->name().'::certificate-page', [ |
|
| 104 | 104 | 'title' => I18N::translate('Certificate - %s', $certificate->name()), |
| 105 | 105 | 'tree' => $tree, |
| 106 | 106 | 'module_name' => $this->module->name(), |
@@ -63,12 +63,12 @@ discard block |
||
| 63 | 63 | return redirect($admin_config_route); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - $params = (array) $request->getParsedBody(); |
|
| 66 | + $params = (array)$request->getParsedBody(); |
|
| 67 | 67 | |
| 68 | - $tree->setPreference('MAJ_CERTIF_SHOW_CERT', $params['MAJ_CERTIF_SHOW_CERT'] ?? (string) Auth::PRIV_HIDE); |
|
| 68 | + $tree->setPreference('MAJ_CERTIF_SHOW_CERT', $params['MAJ_CERTIF_SHOW_CERT'] ?? (string)Auth::PRIV_HIDE); |
|
| 69 | 69 | $tree->setPreference( |
| 70 | 70 | 'MAJ_CERTIF_SHOW_NO_WATERMARK', |
| 71 | - $params['MAJ_CERTIF_SHOW_NO_WATERMARK'] ?? (string) Auth::PRIV_HIDE |
|
| 71 | + $params['MAJ_CERTIF_SHOW_NO_WATERMARK'] ?? (string)Auth::PRIV_HIDE |
|
| 72 | 72 | ); |
| 73 | 73 | $tree->setPreference('MAJ_CERTIF_WM_DEFAULT', $params['MAJ_CERTIF_WM_DEFAULT'] ?? ''); |
| 74 | 74 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | // Only accept valid folders for MAJ_CERT_ROOTDIR |
| 87 | 87 | $cert_root_dir = $params['MAJ_CERTIF_ROOTDIR'] ?? ''; |
| 88 | 88 | $cert_root_dir = preg_replace('/[:\/\\\\]+/', '/', $cert_root_dir); |
| 89 | - $cert_root_dir = trim($cert_root_dir, '/') . '/'; |
|
| 89 | + $cert_root_dir = trim($cert_root_dir, '/').'/'; |
|
| 90 | 90 | $tree->setPreference('MAJ_CERTIF_ROOTDIR', $cert_root_dir); |
| 91 | 91 | |
| 92 | 92 | FlashMessages::addMessage( |