Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/treetrek.git
<?php
require_once __DIR__ . '/render/TagRenderer.php';

class Tag {
  private string $name;
  private string $sha;
  private string $targetSha;
  private int $timestamp;
  private string $message;
  private string $author;

  public function __construct(
    string $name,
    string $sha,
    string $targetSha,
    int $timestamp,
    string $message,
    string $author
  ) {
    $this->name = $name;
    $this->sha = $sha;
    $this->targetSha = $targetSha;
    $this->timestamp = $timestamp;
    $this->message = $message;
    $this->author = $author;
  }

  public function compare( Tag $other ): int {
    return $other->timestamp <=> $this->timestamp;
  }

  public function render( TagRenderer $renderer ): void {
    $renderer->renderTagItem(
      $this->name,
      $this->sha,
      $this->targetSha,
      $this->timestamp,
      $this->message,
      $this->author
    );
  }
}