<?php

namespace App\Service;

use App\Entity\Task;

// Génère la source de changeset
class SourceGenerator
{
    public function generate(Task $task): string
    {
        $parts = [];

        $project = $task->getProject();

        $parts[] = $project->getName();
        $parts[] = $task->getName();

        foreach (explode(' ', $project->getHashtags()) as $hashtag) {
            $parts[] = '#'.$hashtag;
        }

        $source = implode(' ', $parts);

        return $source;
    }
}
