Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v2.2.0' into v2.2.0
Browse files Browse the repository at this point in the history
# Conflicts:
#	.php-cs-fixer.cache
  • Loading branch information
karam-mustafa committed Feb 8, 2022
2 parents c1a537e + a8071c8 commit f38df88
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .php-cs-fixer.cache
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"php":"8.1.1","version":"3.5.0","indent":" ","lineEnding":"\n","rules":{"blank_line_after_opening_tag":true,"braces":{"allow_single_line_anonymous_class_with_empty_body":true},"class_definition":{"space_before_parenthesis":true},"compact_nullable_typehint":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"sort_algorithm":"alpha"},"return_type_declaration":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline":true,"phpdoc_scalar":true,"unary_operator_spaces":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["break","continue","declare","return","throw","try"]},"phpdoc_single_line_var_spacing":true,"phpdoc_var_without_name":true,"class_attributes_separation":{"elements":{"method":"one"}}},"hashes":{"src\/Commands\/InstallCommand.php":1784357225,"src\/Facade\/GeoFacade.php":480934503,"src\/Config\/geographical_calculator.php":3294119027,"src\/Providers\/GeoServiceProviders.php":246462924,"src\/Abstracts\/AbstractGeo.php":2234915042,"src\/Traits\/AngleStorage.php":3611536194,"src\/Traits\/GeoTraitContainer.php":1475175010,"src\/Traits\/DataStorage.php":3563385134,"src\/Traits\/Distances.php":3803457548,"src\/Traits\/Areas.php":3156759552,"src\/Traits\/Formatter.php":2328685074,"src\/Traits\/Ordering.php":1290530461,"src\/Traits\/Debugger.php":271558686,"src\/Traits\/PointsStorage.php":639114898,"src\/Traits\/Looper.php":3450511073,"src\/Interfaces\/GeoInterface.php":947671428,"src\/Classes\/Geo.php":1933510719,"tests\/Feature\/AllFeaturesTest.php":790584485,"tests\/Feature\/OrderingTest.php":2465841173,"tests\/Feature\/DistanceTest.php":952829964,"tests\/Feature\/AreasTest.php":950746981}}
{"php":"8.1.1","version":"3.5.0","indent":" ","lineEnding":"\n","rules":{"blank_line_after_opening_tag":true,"braces":{"allow_single_line_anonymous_class_with_empty_body":true},"class_definition":{"space_before_parenthesis":true},"compact_nullable_typehint":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"new_with_braces":true,"no_blank_lines_after_class_opening":true,"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"sort_algorithm":"alpha"},"return_type_declaration":true,"short_scalar_cast":true,"single_blank_line_before_namespace":true,"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"visibility_required":true,"blank_line_after_namespace":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline":true,"phpdoc_scalar":true,"unary_operator_spaces":true,"binary_operator_spaces":true,"blank_line_before_statement":{"statements":["break","continue","declare","return","throw","try"]},"phpdoc_single_line_var_spacing":true,"phpdoc_var_without_name":true,"class_attributes_separation":{"elements":{"method":"one"}}},"hashes":{"src\/Traits\/PointsStorage.php":2515415511,"src\/Traits\/Debugger.php":271558686,"src\/Traits\/Looper.php":1197184409,"src\/Traits\/Ordering.php":2807444233,"src\/Traits\/Distances.php":3419708995,"src\/Traits\/GeoTraitContainer.php":3516007813,"src\/Traits\/Areas.php":1963883125,"src\/Traits\/DataStorage.php":1837095138,"src\/Traits\/Formatter.php":2328685074,"src\/Traits\/AngleStorage.php":1188392081,"src\/Facade\/GeoFacade.php":417705943,"src\/Providers\/GeoServiceProviders.php":246462924,"src\/Classes\/Geo.php":2196962536,"src\/Abstracts\/AbstractGeo.php":2234915042,"src\/Interfaces\/GeoInterface.php":2568736414,"src\/Commands\/InstallCommand.php":1784357225,"src\/Config\/geographical_calculator.php":3294119027,"tests\/Feature\/OrderingTest.php":3290812563,"tests\/Feature\/AllFeaturesTest.php":3405987633,"tests\/Feature\/AreasTest.php":3506569351,"tests\/Feature\/DistanceTest.php":3142791870,"src\/Traits\/DiametersStorage.php":2005442298}}
8 changes: 5 additions & 3 deletions src/Traits/Areas.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function getCenter($callback = null)
$this->setInStorage('pointsCount', count($this->getPoints()));

// check if there are points or not.
if (!$this->getFromStorage('pointsCount')) {
if (! $this->getFromStorage('pointsCount')) {
return false;
}

Expand Down Expand Up @@ -96,10 +96,12 @@ public function isInArea()

// otherwise mean that the distance between the given point is locate in the circle that calculated
// from the main point and the diameter
$this->setInStorage('distanceToCompare',
$this->setInStorage(
'distanceToCompare',
$this->setOptions(['units' => ['km']])->getDistance(function (Collection $item) {
return $item->first()['km'];
}));
})
);

return $this->getFromStorage('distanceToCompare') > $this->getDiameter();
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Feature/AreasTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function test_center()
'long' => 38.424795502212,
], $result);
}

/**
* test if the given point is in custom area, depending on main point and diameter
*
Expand All @@ -53,6 +53,7 @@ public function test_if_given_point_is_in_custom_area()

$this->assertFalse($result);
}

/**
* get clean instance of geo class.
*
Expand Down
5 changes: 3 additions & 2 deletions tests/Feature/OrderingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public function test_closest_point_of_set_points()
],
], $result);
}

/**
*
* @return void
Expand All @@ -56,7 +57,7 @@ public function test_farthest_point_of_set_points()
->setPoint([40.92918, 14.44339])
->getFarthest();

$this->assertEquals([
$this->assertEquals([
// the key is the index of points insertion.
0 => [
40.92945,
Expand All @@ -77,7 +78,7 @@ public function test_farthest_point_of_set_points()
],
], $result);
}

/**
* @throws \Exception
*
Expand Down

0 comments on commit f38df88

Please sign in to comment.