Create everything required to login and register
This commit is contained in:
68
src/Service/LastRelease.php
Normal file
68
src/Service/LastRelease.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace App\Service;
|
||||
|
||||
use JetBrains\PhpStorm\ArrayShape;
|
||||
|
||||
class LastRelease
|
||||
{
|
||||
#[ArrayShape([
|
||||
"branch" => "string",
|
||||
"date" => "string",
|
||||
"commitHashShort" => "string",
|
||||
"commitHashLong" => "string",
|
||||
"commitDate" => "string",
|
||||
"branchUrl" => "string",
|
||||
"projectUrl" => "string",
|
||||
"commitUrl" => "string",
|
||||
])]
|
||||
private array $lastRelease = [];
|
||||
|
||||
public function __construct(string $jsonFile)
|
||||
{
|
||||
if (file_exists($jsonFile)) {
|
||||
$this->lastRelease = json_decode(file_get_contents($jsonFile), true);
|
||||
}
|
||||
}
|
||||
|
||||
public function getBranch(): string
|
||||
{
|
||||
return $this->lastRelease['branch'] ?? '-';
|
||||
}
|
||||
|
||||
public function getBranchUrl(): string
|
||||
{
|
||||
return $this->lastRelease['branchUrl'] ?? '#';
|
||||
}
|
||||
|
||||
public function getProjectUrl(): string
|
||||
{
|
||||
return $this->lastRelease['projectUrl'] ?? '#';
|
||||
}
|
||||
|
||||
public function getCommitUrl(): string
|
||||
{
|
||||
return $this->lastRelease['commitUrl'] ?? '#';
|
||||
}
|
||||
|
||||
public function getDate(): string
|
||||
{
|
||||
return $this->lastRelease['date'] ?? '-';
|
||||
}
|
||||
|
||||
public function getCommitHashShort(): string
|
||||
{
|
||||
return $this->lastRelease['commitHashShort'] ?? '-';
|
||||
}
|
||||
|
||||
public function getCommitHashLong(): string
|
||||
{
|
||||
return $this->lastRelease['commitHashLong'] ?? '-';
|
||||
}
|
||||
|
||||
public function getCommitDate(): string
|
||||
{
|
||||
return $this->lastRelease['commitDate'] ?? '-';
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user