1
0
mirror of https://framagit.org/tykayn/date-poll-api synced 2023-08-25 08:23:11 +02:00

cleanup src

This commit is contained in:
Tykayn 2021-04-27 12:51:21 +02:00 committed by tykayn
parent 94c02be927
commit 4bf2625908
8 changed files with 40 additions and 39 deletions

View File

@ -59,6 +59,10 @@ class Comment {
return $this;
}
public function getCreatedAt(): ?DateTimeInterface {
return $this->createdAt;
}
function display() {
return [
'id' => $this->getId(),
@ -92,10 +96,6 @@ class Comment {
return $this;
}
public function getCreatedAt(): ?DateTimeInterface {
return $this->createdAt;
}
public function getPoll(): ?Poll {
return $this->poll;
}

View File

@ -75,6 +75,10 @@ class Owner {
return $this;
}
public function getCreatedAt(): ?DateTimeInterface {
return $this->createdAt;
}
public function display() {
return [
'pseudo' => $this->getPseudo(),
@ -228,10 +232,6 @@ class Owner {
return $this;
}
public function getCreatedAt(): ?DateTimeInterface {
return $this->createdAt;
}
public function getRequestedPollsDate() {
return $this->requestedPollsDate;
}

View File

@ -216,6 +216,11 @@ class Poll {
$this->setAllowedAnswers( [ 'yes', 'maybe', 'no' ] );
}
public function setCreatedAt( DateTimeInterface $createdAt ): self {
$this->createdAt = $createdAt;
return $this;
}
public function displayForAdmin() {
$content = $this->display();
@ -227,6 +232,8 @@ class Poll {
return $content;
}
// counts each number of answer for this choice
public function display() {
$computedAnswers = $this->computeAnswers();
@ -269,7 +276,6 @@ class Poll {
];
}
// counts each number of answer for this choice
public function computeAnswers() {
$computedArray = [];
$maxScore = 0;
@ -334,6 +340,23 @@ class Poll {
];
}
/**
* @return Collection|Choice[]
*/
public function getChoices(): Collection {
return $this->choices;
}
public function getKind(): ?string {
return $this->kind;
}
public function setKind( string $kind ): self {
$this->kind = $kind;
return $this;
}
public function getStacksOfVotes() {
return $this->stacksOfVotes;
}
@ -344,13 +367,6 @@ class Poll {
return $this;
}
/**
* @return Collection|Choice[]
*/
public function getChoices(): Collection {
return $this->choices;
}
/**
* @return Collection|Comment[]
*/
@ -382,12 +398,6 @@ class Poll {
return $this->createdAt;
}
public function setCreatedAt( DateTimeInterface $createdAt ): self {
$this->createdAt = $createdAt;
return $this;
}
public function getExpiracyDate(): ?DateTimeInterface {
return $this->expiracyDate;
}
@ -418,16 +428,6 @@ class Poll {
return $this;
}
public function getKind(): ?string {
return $this->kind;
}
public function setKind( string $kind ): self {
$this->kind = $kind;
return $this;
}
public function getAllowedAnswers(): ?array {
return $this->allowedAnswers;
}

View File

@ -2,6 +2,7 @@
namespace App\Traits;
use DateInterval;
use DateTime;
use DateTimeInterface;
use Doctrine\ORM\Mapping as ORM;
@ -29,7 +30,7 @@ trait TimeStampableTrait {
public function addDaysToDate( DateTime $date, int $days ) {
return $date->add(new \DateInterval('P'.$days.'D'));
return $date->add( new DateInterval( 'P' . $days . 'D' ) );
}