account = $account; $this->costCenter = $costCenter; $this->date = $date; $this->value = $value; } public function getAccount() { return $this->account; } public function getCostCenter() { return $this->costCenter; } public function getDate() { return $this->date; } public function getValue() : Money { return $this->value; } public static function group($values) : array { $accounts = []; foreach($values as $value) { if(!isset($accounts[$value->getAccount()])) { $accounts[$value->getAccount()] = []; } if(!isset($accounts[$value->getAccount()][$value->getCostCenter()])) { $accounts[$value->getAccount()][$value->getCostCenter()] = []; } $accounts[$value->getAccount()][$value->getCostCenter()] = $value; } return $accounts; } }