This pull request includes several changes to improve the handling of metric calculations and data retrieval, focusing on type consistency and better handling of edge cases. The most important changes include updating type hints and default values, refining the computation logic, and enhancing data retrieval methods.
Type Consistency and Default Values:
src/FilamentGoogleAnalytics.php: Updated type hints for the previous and value properties and their respective methods to use int|float instead of string, and set default values to 0.
Computation Logic:
src/FilamentGoogleAnalytics.php: Refined the compute method to use a match expression for better readability and handling of different conditions.
This pull request includes several changes to improve the handling of metric calculations and data retrieval, focusing on type consistency and better handling of edge cases. The most important changes include updating type hints and default values, refining the computation logic, and enhancing data retrieval methods.
Type Consistency and Default Values:
src/FilamentGoogleAnalytics.php
: Updated type hints for theprevious
andvalue
properties and their respective methods to useint|float
instead ofstring
, and set default values to0
.Computation Logic:
src/FilamentGoogleAnalytics.php
: Refined thecompute
method to use amatch
expression for better readability and handling of different conditions.Data Retrieval Enhancements:
src/Traits/MetricDiff.php
: AddedOrderBy
to theget
method to sort results by dimensions.src/Traits/Sessions.php
: Enhanced thesessionsToday
method to handle different scenarios using amatch
expression for improved clarity.src/Traits/SessionsDuration.php
: Improved thesessionDurationToday
method with amatch
expression to better handle edge cases.Dependency Management:
src/Traits/MetricDiff.php
: Added theOrderBy
import to support the new sorting functionality in data retrieval.