setNeedLegalAccess(true); } public function getDirectory(): ?Directory { return $this->directory; } public function setDirectory(?Directory $directory): self { $this->directory = $directory; return $this; } public function getAmountMoney(): ?float { return $this->amountMoney; } public function setAmountMoney(?float $amountMoney): self { $this->amountMoney = $amountMoney; return $this; } public function getAmountTime(): ?int { return $this->amountTime; } public function setAmountTime(?int $amountTime): self { $this->amountTime = $amountTime; return $this; } public function getAmountCommunityWork(): ?int { return $this->amountCommunityWork; } public function setAmountCommunityWork(?int $amountCommunityWork): self { $this->amountCommunityWork = $amountCommunityWork; return $this; } public function getContent(): ?string { return $this->content; } public function setContent(?string $content): self { $this->content = $content; return $this; } public function getAmountMoneySettled(): ?float { return $this->amountMoneySettled; } public function setAmountMoneySettled(?float $amountMoneySettled): self { $this->amountMoneySettled = $amountMoneySettled; return $this; } public function getAmountTimeSettled(): ?int { return $this->amountTimeSettled; } public function setAmountTimeSettled(?int $amountTimeSettled): self { $this->amountTimeSettled = $amountTimeSettled; return $this; } public function getAmountCommunityWorkSettled(): ?int { return $this->amountCommunityWorkSettled; } public function setAmountCommunityWorkSettled(?int $amountCommunityWorkSettled): self { $this->amountCommunityWorkSettled = $amountCommunityWorkSettled; return $this; } public function addSettlement($type, $amount) { if ($type == Criminal::TYPE_FINE) { if ($this->getAmountMoney() - $this->getAmountMoneySettled() < $amount) { throw new OutOfRangeException(); } $this->setAmountMoneySettled($this->getAmountMoneySettled() + $amount); } elseif ($type == Criminal::TYPE_JAIL) { if ($this->getAmountTime() - $this->getAmountTimeSettled() < $amount) { throw new OutOfRangeException(); } $this->setAmountTimeSettled($this->getAmountTimeSettled() + $amount); } elseif ($type == Criminal::TYPE_COMMUNITY_WORK) { if ($this->getAmountCommunityWork() - $this->getAmountCommunityWorkSettled() < $amount) { throw new OutOfRangeException(); } $this->setAmountCommunityWorkSettled($this->getAmountCommunityWorkSettled() + $amount); } else { throw new OutOfRangeException(); } return $this; } }