45 lines
1.6 KiB
PHP
45 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Objects\Gitlab;
|
|
|
|
class Schedule
|
|
{
|
|
/**
|
|
* https://docs.gitlab.com/ee/api/pipeline_schedules.html#create-a-new-pipeline-schedule
|
|
*
|
|
* @param string $cron The cron schedule, for example: 0 1 * * *. required.
|
|
* @param string $description The description of the pipeline schedule. required.
|
|
* @param string $ref The branch or tag name that is triggered. Both the short (e.g. main) and full
|
|
* (e.g. refs/heads/main or refs/tags/main) ref versions are accepted. If a short version is provided, it is
|
|
* automatically expanded to the full ref version but, if the ref is ambiguous, it will be rejected required.
|
|
* @param boolean $active The activation of pipeline schedule. If false is set, the pipeline schedule
|
|
* is initially deactivated (default: true).
|
|
* @param string $cron_timezone The time zone supported by ActiveSupport::TimeZone, for example:
|
|
* Pacific Time (US & Canada) (default: UTC).
|
|
* @return void
|
|
*/
|
|
public function __construct(
|
|
public string $cron,
|
|
public string $description,
|
|
public string $ref,
|
|
public bool $active,
|
|
public string $cron_timezone
|
|
) {
|
|
}
|
|
|
|
/**
|
|
* toArray method
|
|
*
|
|
* @return array{cron: string, description: string, ref: string, active: bool, cron_timezone: string}
|
|
*/
|
|
public function toArray()
|
|
{
|
|
return [
|
|
'cron' => $this->cron,
|
|
'description' => $this->description,
|
|
'ref' => $this->ref,
|
|
'active' => $this->active,
|
|
'cron_timezone' => $this->cron_timezone
|
|
];
|
|
}
|
|
}
|