17 lines
319 B
PHP
17 lines
319 B
PHP
|
<?php
|
||
|
namespace nur\mapper\base\impl;
|
||
|
|
||
|
use nur\mapper\base\Mapper;
|
||
|
|
||
|
class AddMapper extends Mapper {
|
||
|
function __construct(int $amount, ?iterable $source = null) {
|
||
|
parent::__construct($source);
|
||
|
$this->amount = $amount;
|
||
|
}
|
||
|
|
||
|
private $amount;
|
||
|
|
||
|
function mapper($item) {
|
||
|
return $item + $this->amount;
|
||
|
}
|
||
|
}
|