@@ -146,8 +146,9 @@ |
||
146 | 146 | */ |
147 | 147 | public function checkNumber(string $number): bool |
148 | 148 | { |
149 | - if (strlen($number) < 10) |
|
150 | - return false; |
|
149 | + if (strlen($number) < 10) { |
|
150 | + return false; |
|
151 | + } |
|
151 | 152 | $area = substr($number, 0, strlen($this->area)); |
152 | 153 | return $this->area == $area; |
153 | 154 | } |
@@ -145,7 +145,7 @@ |
||
145 | 145 | protected function getFlattenData(): Collection |
146 | 146 | { |
147 | 147 | $newRegions = new Collection(); |
148 | - $this->regions->each(function (RegionModel $region) use ($newRegions) { |
|
148 | + $this->regions->each(function(RegionModel $region) use ($newRegions) { |
|
149 | 149 | $newRegions->add($this->flatten($region)); |
150 | 150 | }); |
151 | 151 | return $newRegions->flatten(10); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | if (empty($value)) { |
31 | 31 | return null; |
32 | 32 | } |
33 | - if(!is_string($value) || !mb_check_encoding($value, 'UTF-8')) |
|
33 | + if (!is_string($value) || !mb_check_encoding($value, 'UTF-8')) |
|
34 | 34 | { |
35 | 35 | $tableName = $model->getTable(); |
36 | 36 | $keyName = $model->getKeyName(); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $points = explode(',', $pointString); |
47 | 47 | |
48 | - $decoded = array_map(function ($point) { |
|
48 | + $decoded = array_map(function($point) { |
|
49 | 49 | $_value = array_reverse(explode(' ', trim($point))); |
50 | 50 | return [(float) $_value[0], (float) $_value[1]]; |
51 | 51 | }, $points); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | public function set($model, $key, $value, $attributes) |
65 | 65 | { |
66 | 66 | $srid = 4326; |
67 | - $array = Arr::map($value, function ($rs) { |
|
67 | + $array = Arr::map($value, function($rs) { |
|
68 | 68 | return Arr::join(array_reverse($rs), ' '); |
69 | 69 | }); |
70 | 70 | return DB::raw("ST_GeomFromText('LINESTRING(" . Arr::join($array, ',') . ")',$srid)"); |
@@ -67,11 +67,11 @@ discard block |
||
67 | 67 | protected function addMacro(): void |
68 | 68 | { |
69 | 69 | if (class_exists('SimpleCMS\Framework\Services\SimpleService')) { |
70 | - SimpleService::macro('queryDistance', function (SimpleService $service, float $lat, float $lng, float $maxDistance = 50, string $geoColumn) { |
|
70 | + SimpleService::macro('queryDistance', function(SimpleService $service, float $lat, float $lng, float $maxDistance = 50, string $geoColumn) { |
|
71 | 71 | $distanceService = new DistanceService; |
72 | 72 | return $distanceService->queryDistance($service, $lat, $lng, $maxDistance, $geoColumn); |
73 | 73 | }); |
74 | - SimpleService::macro('selectDistance', function (SimpleService $service, float $lat, float $lng, string $geoColumn, string $alias) { |
|
74 | + SimpleService::macro('selectDistance', function(SimpleService $service, float $lat, float $lng, string $geoColumn, string $alias) { |
|
75 | 75 | $distanceService = new DistanceService; |
76 | 76 | return $distanceService->selectDistance($service, $lat, $lng, $geoColumn, $alias); |
77 | 77 | }); |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | protected function addService(): void |
88 | 88 | { |
89 | 89 | if (class_exists('SimpleCMS\Framework\Services\SimpleService')) { |
90 | - SimpleService::macro('queryDistance', function (SimpleService $service, float $lat, float $lng, float $maxDistance = 50, string $geoColumn) { |
|
90 | + SimpleService::macro('queryDistance', function(SimpleService $service, float $lat, float $lng, float $maxDistance = 50, string $geoColumn) { |
|
91 | 91 | $distanceService = new DistanceService; |
92 | 92 | return $distanceService->queryDistance($service, $lat, $lng, $maxDistance, $geoColumn); |
93 | 93 | }); |
94 | - SimpleService::macro('selectDistance', function (SimpleService $service, float $lat, float $lng, string $geoColumn) { |
|
94 | + SimpleService::macro('selectDistance', function(SimpleService $service, float $lat, float $lng, string $geoColumn) { |
|
95 | 95 | $distanceService = new DistanceService; |
96 | 96 | return $distanceService->selectDistance($service, $lat, $lng, $geoColumn); |
97 | 97 | }); |
@@ -55,7 +55,7 @@ |
||
55 | 55 | $distanceRaw = $this->distanceRaw($lat, $lng, $column); |
56 | 56 | $service->appendQuery([ |
57 | 57 | [ |
58 | - function ($query) use ($distanceRaw, $maxDistance) { |
|
58 | + function($query) use ($distanceRaw, $maxDistance) { |
|
59 | 59 | $query->whereRaw("$distanceRaw <= $maxDistance"); |
60 | 60 | } |
61 | 61 | ] |