client/src/MobicoopBundle/Payment/Entity/PaymentPeriod.php
<?php
/**
* Copyright (c) 2020, MOBICOOP. All rights reserved.
* This project is dual licensed under AGPL and proprietary licence.
***************************
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <gnu.org/licenses>.
***************************
* Licence MOBICOOP described in the file
* LICENSE
**************************/
namespace Mobicoop\Bundle\MobicoopBundle\Payment\Entity;
use Mobicoop\Bundle\MobicoopBundle\Api\Entity\ResourceInterface;
/**
* Period containing payments (for regular carpools).
*
* @author Sylvain Briat <sylvain.briat@mobicoop.org>
*/
class PaymentPeriod implements ResourceInterface, \JsonSerializable
{
/**
* @var int The id of this payment period.
*/
private $id;
/**
* @var \DateTimeInterface|null The start date of the period.
*/
private $fromDate;
/**
* @var \DateTimeInterface|null The end date of the period.
*/
private $toDate;
/**
* @var array|null The week days where there are carpooling planned.
*/
private $days;
public function getId(): ?int
{
return $this->id;
}
public function setId(int $id): self
{
$this->id = $id;
return $this;
}
public function getFromDate(): ?\DateTimeInterface
{
return $this->fromDate;
}
public function setFromDate(\DateTimeInterface $fromDate): self
{
$this->fromDate = $fromDate;
return $this;
}
public function getToDate(): ?\DateTimeInterface
{
return $this->toDate;
}
public function setToDate(?\DateTimeInterface $toDate): self
{
$this->toDate = $toDate;
return $this;
}
public function getDays(): ?array
{
return $this->days;
}
public function setDays(array $days): self
{
$this->days = $days;
return $this;
}
public function jsonSerialize()
{
return
[
'id' => $this->getId(),
'fromDate' => $this->getFromDate(),
'toDate' => $this->getToDate(),
'days' => $this->getDays()
];
}
}