mirror of
https://github.com/Karaka-Management/oms-Accounting.git
synced 2026-01-15 15:08:40 +00:00
33 lines
665 B
PHP
33 lines
665 B
PHP
<?php
|
|
|
|
class KeyCollection {
|
|
private $fromAccount = 0;
|
|
|
|
private $distributionKeys = [];
|
|
|
|
public function __construct(int $account, array $distributionKeys = []) {
|
|
$this->fromAccount = $account;
|
|
$this->distributionKeys = $distributionKeys;
|
|
}
|
|
|
|
public function getAccount() : int
|
|
{
|
|
return $this->fromAccount;
|
|
}
|
|
|
|
public function addKey(DistributionKey $key)
|
|
{
|
|
$this->distributionKeys[$key->getFromCostCenter()] = $key;
|
|
}
|
|
|
|
public function distribute(array $accountValues) : array
|
|
{
|
|
$values = [];
|
|
foreach($accountValues as $value) {
|
|
$values[] = $this->distributionKeys[$value->getCostCenter()]->distribute($value);
|
|
}
|
|
|
|
return $values;
|
|
}
|
|
}
|