nur-sery/nur_tests/mapper/base/impl/ReduceMapper.php

20 lines
303 B
PHP
Raw Normal View History

2024-04-04 16:26:22 +04:00
<?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;
}
}