0])] protected $isRequestedPayment = false; #[ORM\Column(type: 'boolean', options: ['default' => 0])] protected $isPaid = false; public function getId(): ?int { return $this->id; } public function getUser(): ?User { return $this->user; } public function setUser(?User $user): self { $this->user = $user; return $this; } public function getMoves(): ?array { return $this->moves; } public function setMoves(array $moves): self { $this->moves = $moves; return $this; } public function getVariousPayments(): ?array { return $this->variousPayments; } public function setVariousPayments(array $variousPayments): self { $this->variousPayments = $variousPayments; return $this; } public function getIsPaid(): ?bool { return $this->isPaid; } public function setIsPaid(bool $isPaid): self { $this->isPaid = $isPaid; return $this; } public function getPaidAt(): ?\DateTimeInterface { return $this->paidAt; } public function setPaidAt(?\DateTimeInterface $paidAt): self { $this->paidAt = $paidAt; return $this; } public function getBills(): ?array { return $this->bills; } public function setBills(array $bills): self { $this->bills = $bills; return $this; } public function getDateFrom(): ?\DateTimeInterface { return $this->dateFrom; } public function setDateFrom(\DateTimeInterface $dateFrom): self { $this->dateFrom = $dateFrom; return $this; } public function getDateTo(): ?\DateTimeInterface { return $this->dateTo; } public function setDateTo(\DateTimeInterface $dateTo): self { $this->dateTo = $dateTo; return $this; } public function getScalePerKilometer(): ?float { return $this->scalePerKilometer; } public function setScalePerKilometer(float $scalePerKilometer): self { $this->scalePerKilometer = $scalePerKilometer; return $this; } public function getIsRequestedPayment(): ?bool { return $this->isRequestedPayment; } public function setIsRequestedPayment(bool $isRequestedPayment): self { $this->isRequestedPayment = $isRequestedPayment; return $this; } public function getTotalAmount(?string $of = null, array $data = []): float { $amount = 0; if ('moves' === $of) { foreach ($this->getMoves() as $data) { $amount += $this->getTotalAmount('move', $data); } } elseif ('various_payments' === $of) { foreach ($this->getVariousPayments() as $data) { $amount += $this->getTotalAmount('various_payment', $data); } } elseif ('move' === $of) { $amount += $data['highwayPay']; $amount += $data['parkingPay']; $amount += ($data['isRoundTrip'] ? 2 : 1) * $data['distance'] * $this->getScalePerKilometer(); } elseif ('various_payment' === $of) { $amount += $data['amount']; } else { $amount += $this->getTotalAmount('moves'); $amount += $this->getTotalAmount('various_payments'); } return $amount; } }