type = $type; $this->key = $key; $this->description = $description; $this->assignee = $assignee; $this->estimate = $estimate ?? 0; $this->totalTime = $totalTime; $this->dateTakeInWork = $dateTakeInWork; $this->resolutionDate = $resolutionDate; $this->countReview = $countReview ?? 0; $this->countTest = $countTest ?? 0; $this->leadTime = DateHelper::countWorkingDays($dateTakeInWork, $resolutionDate); if ($this->leadTime == 0) { $this->leadTime = 1; } $this->recast = ($this->estimate == 0) ? 0: round($totalTime/$estimate,4)-1; // totalTime в секундах, leadTime в днях $this->efficiency = round(($totalTime/3600)/$this->leadTime*8, 2); } public function toCSV(): string { return implode(";", [ $this->type, $this->key, $this->description, $this->assignee, new DateTime($this->dateTakeInWork)->format('Y-m-d'), new DateTime($this->resolutionDate)->format('Y-m-d'), $this->leadTime, round($this->estimate/3600,2), // переводим в часы round($this->totalTime/3600, 2), // переводим в часы $this->recast, $this->efficiency, $this->countReview, $this->countTest, ]); } public function __toString(): string { return $this->toCSV()."\n"; } }