@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | { |
102 | 102 | return Registry::cache()->array()->remember( |
103 | 103 | 'maj-available-admintasks', |
104 | - function (): Collection { |
|
104 | + function(): Collection { |
|
105 | 105 | /** @var Collection<string, string> $tasks */ |
106 | 106 | $tasks = $this->module_service |
107 | 107 | ->findByInterface(ModuleTasksProviderInterface::class) |
@@ -206,13 +206,13 @@ discard block |
||
206 | 206 | $query = DB::table('maj_admintasks') |
207 | 207 | ->select() |
208 | 208 | ->where('majat_status', '=', 'enabled') |
209 | - ->where(function (Builder $query): void { |
|
209 | + ->where(function(Builder $query): void { |
|
210 | 210 | $query->where('majat_running', '=', 0) |
211 | 211 | ->orWhere('majat_last_run', '<=', CarbonImmutable::now('UTC')->subSeconds(self::TASK_TIME_OUT)); |
212 | 212 | }); |
213 | 213 | |
214 | 214 | if (!$force) { |
215 | - $query->where(function (Builder $query): void { |
|
215 | + $query->where(function(Builder $query): void { |
|
216 | 216 | |
217 | 217 | $query->where('majat_last_result', '=', 0) |
218 | 218 | ->orWhereRaw('DATE_ADD(majat_last_run, INTERVAL majat_frequency MINUTE) <= NOW()'); |
@@ -264,9 +264,9 @@ discard block |
||
264 | 264 | $task_schedule->setLastResult($task->run($task_schedule)); |
265 | 265 | } catch (Throwable $ex) { |
266 | 266 | if ($first_error) { // Only record the first error, as this could fill the log. |
267 | - Log::addErrorLog(I18N::translate('Error while running task %s:', $task->name()) . ' ' . |
|
268 | - '[' . get_class($ex) . '] ' . $ex->getMessage() . ' ' . $ex->getFile() . ':' |
|
269 | - . $ex->getLine() . PHP_EOL . $ex->getTraceAsString()); |
|
267 | + Log::addErrorLog(I18N::translate('Error while running task %s:', $task->name()).' '. |
|
268 | + '['.get_class($ex).'] '.$ex->getMessage().' '.$ex->getFile().':' |
|
269 | + . $ex->getLine().PHP_EOL.$ex->getTraceAsString()); |
|
270 | 270 | } |
271 | 271 | } |
272 | 272 | |
@@ -287,16 +287,16 @@ discard block |
||
287 | 287 | */ |
288 | 288 | public static function rowMapper(): Closure |
289 | 289 | { |
290 | - return static function (stdClass $row): TaskSchedule { |
|
290 | + return static function(stdClass $row): TaskSchedule { |
|
291 | 291 | return new TaskSchedule( |
292 | - (int) $row->majat_id, |
|
292 | + (int)$row->majat_id, |
|
293 | 293 | $row->majat_task_id, |
294 | 294 | $row->majat_status === 'enabled', |
295 | 295 | CarbonImmutable::parse($row->majat_last_run, 'UTC'), |
296 | - (bool) $row->majat_last_result, |
|
297 | - (int) $row->majat_frequency, |
|
298 | - (int) $row->majat_nb_occur, |
|
299 | - (bool) $row->majat_running |
|
296 | + (bool)$row->majat_last_result, |
|
297 | + (int)$row->majat_frequency, |
|
298 | + (int)$row->majat_nb_occur, |
|
299 | + (bool)$row->majat_running |
|
300 | 300 | ); |
301 | 301 | }; |
302 | 302 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $map_adapter = $this->mapadapter_data_service->find($adapter_id); |
77 | 77 | |
78 | 78 | $map = $this->map_definition_service->find(Validator::parsedBody($request)->string('map_adapter_map', '')); |
79 | - $mapping_property = Validator::parsedBody($request)->string('map_adapter_property_selected', ''); |
|
79 | + $mapping_property = Validator::parsedBody($request)->string('map_adapter_property_selected', ''); |
|
80 | 80 | |
81 | 81 | $mapper = null; |
82 | 82 | try { |
@@ -101,14 +101,14 @@ discard block |
||
101 | 101 | 'success' |
102 | 102 | ); |
103 | 103 | //phpcs:ignore Generic.Files.LineLength.TooLong |
104 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” has been updated.'); |
|
104 | + Log::addConfigurationLog('Module '.$this->module->title().' : Map Adapter “'.$map_adapter->id().'” has been updated.'); |
|
105 | 105 | } catch (Throwable $ex) { |
106 | 106 | FlashMessages::addMessage( |
107 | 107 | I18N::translate('An error occured while updating the map configuration.'), |
108 | 108 | 'danger' |
109 | 109 | ); |
110 | 110 | //phpcs:ignore Generic.Files.LineLength.TooLong |
111 | - Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating Map Adapter “' . $map_adapter->id() . '”: ' . $ex->getMessage()); |
|
111 | + Log::addErrorLog('Module '.$this->module->title().' : Error when updating Map Adapter “'.$map_adapter->id().'”: '.$ex->getMessage()); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | return Registry::responseFactory()->redirect(MapAdapterEditPage::class, [ |
@@ -81,14 +81,14 @@ |
||
81 | 81 | 'success' |
82 | 82 | ); |
83 | 83 | //phpcs:ignore Generic.Files.LineLength.TooLong |
84 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.'); |
|
84 | + Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$view->id().'” has been updated.'); |
|
85 | 85 | } catch (Throwable $ex) { |
86 | 86 | FlashMessages::addMessage( |
87 | 87 | I18N::translate('An error occured while updating the geographical dispersion analysis view.'), |
88 | 88 | 'danger' |
89 | 89 | ); |
90 | 90 | //phpcs:ignore Generic.Files.LineLength.TooLong |
91 | - Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage()); |
|
91 | + Log::addErrorLog('Module '.$this->module->title().' : Error when updating view “'.$view->id().'”: '.$ex->getMessage()); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]); |
@@ -79,14 +79,14 @@ |
||
79 | 79 | 'success' |
80 | 80 | ); |
81 | 81 | //phpcs:ignore Generic.Files.LineLength.TooLong |
82 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” has been deleted.'); |
|
82 | + Log::addConfigurationLog('Module '.$this->module->title().' : Map Adapter “'.$map_adapter->id().'” has been deleted.'); |
|
83 | 83 | } else { |
84 | 84 | FlashMessages::addMessage( |
85 | 85 | I18N::translate('An error occured while deleting the map configuration.'), |
86 | 86 | 'danger' |
87 | 87 | ); |
88 | 88 | //phpcs:ignore Generic.Files.LineLength.TooLong |
89 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Map Adapter “' . $map_adapter->id() . '” could not be deleted. See error log.'); |
|
89 | + Log::addConfigurationLog('Module '.$this->module->title().' : Map Adapter “'.$map_adapter->id().'” could not be deleted. See error log.'); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return Registry::responseFactory()->redirect(GeoAnalysisViewEditPage::class, [ |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | 'success' |
99 | 99 | ); |
100 | 100 | //phpcs:ignore Generic.Files.LineLength.TooLong |
101 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $new_view_id . '” has been added.'); |
|
101 | + Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$new_view_id.'” has been added.'); |
|
102 | 102 | return Registry::responseFactory()->redirect( |
103 | 103 | GeoAnalysisViewEditPage::class, |
104 | - ['tree' => $tree->name(), 'view_id' => $new_view_id ] |
|
104 | + ['tree' => $tree->name(), 'view_id' => $new_view_id] |
|
105 | 105 | ); |
106 | 106 | } else { |
107 | 107 | FlashMessages::addMessage( |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | 'danger' |
110 | 110 | ); |
111 | 111 | //phpcs:ignore Generic.Files.LineLength.TooLong |
112 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : A new View could not be added. See error log.'); |
|
112 | + Log::addConfigurationLog('Module '.$this->module->title().' : A new View could not be added. See error log.'); |
|
113 | 113 | return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]); |
114 | 114 | } |
115 | 115 | } |
@@ -102,14 +102,14 @@ |
||
102 | 102 | 'success' |
103 | 103 | ); |
104 | 104 | //phpcs:ignore Generic.Files.LineLength.TooLong |
105 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been updated.'); |
|
105 | + Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$view->id().'” has been updated.'); |
|
106 | 106 | } catch (Throwable $ex) { |
107 | 107 | FlashMessages::addMessage( |
108 | 108 | I18N::translate('An error occured while updating the geographical dispersion analysis view.'), |
109 | 109 | 'danger' |
110 | 110 | ); |
111 | 111 | //phpcs:ignore Generic.Files.LineLength.TooLong |
112 | - Log::addErrorLog('Module ' . $this->module->title() . ' : Error when updating view “' . $view->id() . '”: ' . $ex->getMessage()); |
|
112 | + Log::addErrorLog('Module '.$this->module->title().' : Error when updating view “'.$view->id().'”: '.$ex->getMessage()); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | return Registry::responseFactory()->redirect(GeoAnalysisViewEditPage::class, [ |
@@ -100,7 +100,7 @@ |
||
100 | 100 | 'danger' |
101 | 101 | ); |
102 | 102 | //phpcs:ignore Generic.Files.LineLength.TooLong |
103 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : Error when deleting invalid map configurations: ' . $ex->getMessage()); |
|
103 | + Log::addConfigurationLog('Module '.$this->module->title().' : Error when deleting invalid map configurations: '.$ex->getMessage()); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | return Registry::responseFactory()->redirect(GeoAnalysisViewEditPage::class, [ |
@@ -79,14 +79,14 @@ |
||
79 | 79 | 'success' |
80 | 80 | ); |
81 | 81 | //phpcs:ignore Generic.Files.LineLength.TooLong |
82 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” has been deleted.'); |
|
82 | + Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$view->id().'” has been deleted.'); |
|
83 | 83 | } else { |
84 | 84 | FlashMessages::addMessage( |
85 | 85 | I18N::translate('An error occured while deleting the geographical dispersion analysis view.'), |
86 | 86 | 'danger' |
87 | 87 | ); |
88 | 88 | //phpcs:ignore Generic.Files.LineLength.TooLong |
89 | - Log::addConfigurationLog('Module ' . $this->module->title() . ' : View “' . $view->id() . '” could not be deleted. See error log.'); |
|
89 | + Log::addConfigurationLog('Module '.$this->module->title().' : View “'.$view->id().'” could not be deleted. See error log.'); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return Registry::responseFactory()->redirect(AdminConfigPage::class, ['tree' => $tree->name()]); |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | ); |
56 | 56 | |
57 | 57 | return Registry::responseFactory()->response(Registry::cache()->file()->remember( |
58 | - 'map-properties-' . $map_id, |
|
59 | - function () use ($map_id): array { |
|
58 | + 'map-properties-'.$map_id, |
|
59 | + function() use ($map_id): array { |
|
60 | 60 | $map = $this->map_definition_service->find($map_id); |
61 | 61 | if ($map === null) { |
62 | 62 | throw new HttpNotFoundException(I18N::translate('The map could not be found.')); |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | collect($map->features()) |
67 | 67 | ->map(fn(Feature $feature): ?stdClass => $feature->getProperties()) |
68 | 68 | ->filter() |
69 | - ->map(fn(stdClass $properties): array => array_keys(get_object_vars($properties))) |
|
70 | - ->each(function (array $properties) use (&$features): void { |
|
69 | + ->map(fn(stdClass $properties) : array => array_keys(get_object_vars($properties))) |
|
70 | + ->each(function(array $properties) use (&$features) : void { |
|
71 | 71 | $features = count($features) === 0 ? $properties : array_intersect($features, $properties); |
72 | 72 | }); |
73 | 73 |