|
<?php
|
|
namespace nur\mapper\base\impl;
|
|
|
|
use nur\mapper\base\Mapper;
|
|
|
|
class ReduceMapper extends Mapper {
|
|
private static $sum;
|
|
|
|
static function sum(): int {
|
|
return self::$sum;
|
|
}
|
|
|
|
function setup(): void {
|
|
self::$sum = 0;
|
|
}
|
|
|
|
function mapper($item) {
|
|
return self::$sum += $item;
|
|
}
|
|
} |