20 lines
		
	
	
		
			437 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			437 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
namespace nur\mapper\base\impl;
 | 
						|
 | 
						|
use nur\mapper\base\Mapper;
 | 
						|
 | 
						|
class Add2Mapper extends Mapper {
 | 
						|
  function __construct(int $a, ?int $b = null, ?int $c = null, ?iterable $source = null) {
 | 
						|
    parent::__construct($source);
 | 
						|
    $amount = $a;
 | 
						|
    if ($b !== null) $amount += $b;
 | 
						|
    if ($c !== null) $amount += $c;
 | 
						|
    $this->amount = $amount;
 | 
						|
  }
 | 
						|
 | 
						|
  private $amount;
 | 
						|
 | 
						|
  function mapper($item) {
 | 
						|
    return $item + $this->amount;
 | 
						|
  }
 | 
						|
} |