Skip to content

Commit 09e2039

Browse files
committed
fix cs
1 parent 60750a8 commit 09e2039

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed
Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
2-
/**
3-
* Adds distance from a given origin column to query.
4-
*
5-
* @param double $latitude The latitude of the origin point.
6-
* @param double $longitude The longitude of the origin point.
7-
* @param double $unit The unit measure.
8-
*
9-
* @return <?php echo $queryClassName ?> The current query, for fluid interface
10-
*/
11-
public function withDistance($latitude, $longitude, $unit = <?php echo $defaultUnit ?>)
12-
{
13-
if (<?php echo $peerClassName ?>::MILES_UNIT === $unit) {
14-
$earthRadius = 3959;
15-
} elseif (<?php echo $peerClassName ?>::NAUTICAL_MILES_UNIT === $unit) {
16-
$earthRadius = 3440;
17-
} else {
18-
$earthRadius = 6371;
19-
}
20-
21-
$sql = 'ABS(%s * ACOS(%s * COS(RADIANS(%s)) * COS(RADIANS(%s) - %s) + %s * SIN(RADIANS(%s))))';
22-
$preparedSql = sprintf($sql,
23-
$earthRadius,
24-
cos(deg2rad($latitude)),
25-
$this->getAliasedColName(<?php echo $latitudeColumnConstant ?>),
26-
$this->getAliasedColName(<?php echo $longitudeColumnConstant ?>),
27-
deg2rad($longitude),
28-
sin(deg2rad($latitude)),
29-
$this->getAliasedColName(<?php echo $latitudeColumnConstant ?>)
30-
);
31-
32-
return $this
33-
->withColumn($preparedSql, 'Distance');
34-
}
1+
2+
/**
3+
* Adds distance from a given origin column to query.
4+
*
5+
* @param double $latitude The latitude of the origin point.
6+
* @param double $longitude The longitude of the origin point.
7+
* @param double $unit The unit measure.
8+
*
9+
* @return <?php echo $queryClassName ?> The current query, for fluid interface
10+
*/
11+
public function withDistance($latitude, $longitude, $unit = <?php echo $defaultUnit ?>)
12+
{
13+
if (<?php echo $peerClassName ?>::MILES_UNIT === $unit) {
14+
$earthRadius = 3959;
15+
} elseif (<?php echo $peerClassName ?>::NAUTICAL_MILES_UNIT === $unit) {
16+
$earthRadius = 3440;
17+
} else {
18+
$earthRadius = 6371;
19+
}
20+
21+
$sql = 'ABS(%s * ACOS(%s * COS(RADIANS(%s)) * COS(RADIANS(%s) - %s) + %s * SIN(RADIANS(%s))))';
22+
$preparedSql = sprintf($sql,
23+
$earthRadius,
24+
cos(deg2rad($latitude)),
25+
$this->getAliasedColName(<?php echo $latitudeColumnConstant ?>),
26+
$this->getAliasedColName(<?php echo $longitudeColumnConstant ?>),
27+
deg2rad($longitude),
28+
sin(deg2rad($latitude)),
29+
$this->getAliasedColName(<?php echo $latitudeColumnConstant ?>)
30+
);
31+
32+
return $this
33+
->withColumn($preparedSql, 'Distance');
34+
}

tests/GeocodableBehaviorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public function testWithDistanceAddsColumn()
246246
->filterByName('Lyon Area')
247247
->findOne()
248248
;
249-
$this->assertTrue((float)$object->getDistance() > 0);
249+
$this->assertTrue((float) $object->getDistance() > 0);
250250
}
251251

252252
public function testFilterByDistanceFromReturnsNoObjects()

0 commit comments

Comments
 (0)