mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
Apply Laravel coding style
Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions. You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root. For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
This commit is contained in:
committed by
HolgerHatGarKeineNode
parent
a15ca4a2bc
commit
5776b01d15
@@ -20,6 +20,7 @@ class PrepareForBtcMapItem extends Component
|
||||
public string $search = '';
|
||||
|
||||
public $population;
|
||||
|
||||
public $population_date = '';
|
||||
|
||||
public ?int $osm_id = null;
|
||||
@@ -52,7 +53,7 @@ class PrepareForBtcMapItem extends Component
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'search' => 'required|string',
|
||||
'search' => 'required|string',
|
||||
'currentPercentage' => 'required|numeric',
|
||||
|
||||
'model.simplified_geojson' => 'nullable',
|
||||
@@ -60,7 +61,7 @@ class PrepareForBtcMapItem extends Component
|
||||
'OSMBoundaries' => 'bool',
|
||||
'polygonsOSMfr' => 'bool',
|
||||
|
||||
'population' => 'nullable|numeric',
|
||||
'population' => 'nullable|numeric',
|
||||
'population_date' => 'nullable|string',
|
||||
|
||||
'polygonsOSMfrX' => 'numeric|max:1',
|
||||
@@ -84,7 +85,7 @@ class PrepareForBtcMapItem extends Component
|
||||
|
||||
private function getSearchResults(): void
|
||||
{
|
||||
$responses = Http::pool(fn(Pool $pool) => [
|
||||
$responses = Http::pool(fn (Pool $pool) => [
|
||||
$pool->acceptJson()
|
||||
->get(
|
||||
sprintf('https://nominatim.openstreetmap.org/search?q=%s&format=json&polygon_geojson=1&polygon_threshold=0.0003&email='.config('services.nominatim.email'),
|
||||
@@ -93,7 +94,7 @@ class PrepareForBtcMapItem extends Component
|
||||
]);
|
||||
|
||||
$this->osmSearchResults = collect($responses[0]->json())
|
||||
->filter(fn($item
|
||||
->filter(fn ($item
|
||||
) => (
|
||||
$item['geojson']['type'] === 'Polygon'
|
||||
|| $item['geojson']['type'] === 'MultiPolygon'
|
||||
@@ -156,7 +157,6 @@ class PrepareForBtcMapItem extends Component
|
||||
|
||||
// emit event for AlpineJS
|
||||
$this->emit('geoJsonUpdated');
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$this->notification()
|
||||
->error('Error', $e->getMessage());
|
||||
@@ -180,9 +180,9 @@ class PrepareForBtcMapItem extends Component
|
||||
->post(
|
||||
'https://polygons.openstreetmap.fr/?id='.$this->selectedItemOSMPolygons['osm_id'],
|
||||
[
|
||||
'x' => $this->polygonsOSMfrX,
|
||||
'y' => $this->polygonsOSMfrY,
|
||||
'z' => $this->polygonsOSMfrZ,
|
||||
'x' => $this->polygonsOSMfrX,
|
||||
'y' => $this->polygonsOSMfrY,
|
||||
'z' => $this->polygonsOSMfrZ,
|
||||
'generate' => 'Submit+Query',
|
||||
]
|
||||
);
|
||||
@@ -247,9 +247,9 @@ class PrepareForBtcMapItem extends Component
|
||||
$response = Http::acceptJson()
|
||||
->asForm()
|
||||
->post('https://osm-boundaries.com/Ajax/GetBoundary', [
|
||||
'db' => 'osm20221205',
|
||||
'db' => 'osm20221205',
|
||||
'waterOrLand' => 'water',
|
||||
'osmId' => '-'.$this->selectedItemOSMPolygons['osm_id'],
|
||||
'osmId' => '-'.$this->selectedItemOSMPolygons['osm_id'],
|
||||
]);
|
||||
if ($response->json()) {
|
||||
if (count($response->json()['coordinates'], COUNT_RECURSIVE) > 100000) {
|
||||
@@ -286,7 +286,7 @@ class PrepareForBtcMapItem extends Component
|
||||
$this->model->population = str($value)
|
||||
->replace(['.', ','], '')
|
||||
->toInteger();
|
||||
if (!$this->model->population_date) {
|
||||
if (! $this->model->population_date) {
|
||||
$this->model->population_date = '2021-12-31';
|
||||
}
|
||||
$this->model->save();
|
||||
|
||||
Reference in New Issue
Block a user