This commit is contained in:
Saeed Vaziry
2024-03-24 09:56:34 +01:00
committed by GitHub
parent 884f18db63
commit 4d051330d6
1055 changed files with 14493 additions and 20278 deletions

View File

@ -2,7 +2,6 @@
namespace App\SourceControlProviders;
use App\Contracts\SourceControlProvider;
use App\Exceptions\RepositoryNotFound;
use App\Exceptions\RepositoryPermissionDenied;
use App\Exceptions\SourceControlIsNotConnected;
@ -18,6 +17,35 @@ public function __construct(SourceControl $sourceControl)
$this->sourceControl = $sourceControl;
}
public function createRules(array $input): array
{
return [
'token' => 'required',
'url' => [
'nullable',
'url:http,https',
'ends_with:/',
],
];
}
public function createData(array $input): array
{
return [
'token' => $input['token'] ?? '',
];
}
public function data(): array
{
// support for older data
$token = $this->sourceControl->access_token ?? '';
return [
'token' => $this->sourceControl->provider_data['token'] ?? $token,
];
}
/**
* @throws SourceControlIsNotConnected
* @throws RepositoryNotFound