dwo / aggregator
collect and aggregate data for statistical analysis
Installs: 209
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/dwo/aggregator
Requires
- php: >=5.3.0
- dwo/math: ~1.0
- dwo/simple_accessor: ~0.1
- symfony/property-access: >=2.0
Requires (Dev)
- dwo/tracedump: @dev
README
Aggregator
collect, group & aggregate data
$collector = new Collector(array('country')); $collector->addEntry(['country' => 'DE', 'counts'=>1]); $collector->addEntry(['country' => 'DE', 'counts'=>2]); $collector->addEntry(['country' => 'AT', 'counts'=>2]); $collector->addEntry(['country' => 'AT', 'counts'=>3]); $aggregationGroup = Aggregator::aggregate($collector); print_r($aggregationGroup->toArray());
Array ( [DE] => Array ( [country] => DE [counts] => 3 ) [AT] => Array ( [country] => AT [counts] => 5 ) )
Merger
merge two arrays
$origin = ['counts' => 1]; $merge = ['counts' => 2]; Merger::merge($origin, $merge); print_r($origin);
Array ( [counts] => 3 )