mirror of
				https://github.com/sitelease/sugar-cube-client.git
				synced 2025-10-31 12:02:30 +01:00 
			
		
		
		
	Corrected namespaces + Chnaged tab size to 4
+ Went through all the Model classes and updated their namespaces to match their parent folder name + Changed tab sizes to 4 spaces instead of 2 (in all php files)
This commit is contained in:
		| @ -5,7 +5,7 @@ namespace Gitea\Api; | ||||
| use GuzzleHttp\Psr7\Response; | ||||
|  | ||||
| use Gitea\Client; | ||||
| use Gitea\Models\Organization; | ||||
| use Gitea\Model\Organization; | ||||
|  | ||||
| use Gitea\Api\Abstracts\AbstractApi; | ||||
|  | ||||
|  | ||||
| @ -6,7 +6,7 @@ use GuzzleHttp\Exception\ServerException; | ||||
|  | ||||
| use Gitea\Client; | ||||
| use Gitea\Collections\ApiItemCollection; | ||||
| use Gitea\Models\Repository; | ||||
| use Gitea\Model\Repository; | ||||
|  | ||||
| use Gitea\Api\Abstracts\AbstractAllApi; | ||||
|  | ||||
|  | ||||
| @ -1,6 +1,6 @@ | ||||
| <?php | ||||
|  | ||||
| namespace Gitea\Models; | ||||
| namespace Gitea\Model; | ||||
|  | ||||
| use GuzzleHttp\Psr7\Uri; | ||||
| use Psr\Http\Message\UriInterface; | ||||
| @ -10,140 +10,140 @@ use \JsonSerializable; | ||||
| /** Represents a Gitea organization. */ | ||||
| class Organization implements JsonSerializable { | ||||
|  | ||||
|   /** @var UriInterface|null A URL pointing to the organization's avatar. */ | ||||
|   private $avatarURL = ''; | ||||
|     /** @var UriInterface|null A URL pointing to the organization's avatar. */ | ||||
|     private $avatarURL = ''; | ||||
|  | ||||
|   /** @var string The organization description. */ | ||||
|   private $description = ''; | ||||
|     /** @var string The organization description. */ | ||||
|     private $description = ''; | ||||
|  | ||||
|   /** @var string The organization's full name. */ | ||||
|   private $fullName = ''; | ||||
|     /** @var string The organization's full name. */ | ||||
|     private $fullName = ''; | ||||
|  | ||||
|   /** @var int The organization identifier. */ | ||||
|   private $id = -1; | ||||
|     /** @var int The organization identifier. */ | ||||
|     private $id = -1; | ||||
|  | ||||
|   /** @var string The organization location. */ | ||||
|   private $location; | ||||
|     /** @var string The organization location. */ | ||||
|     private $location; | ||||
|  | ||||
|   /** @var string The username of the organization */ | ||||
|   private $username; | ||||
|     /** @var string The username of the organization */ | ||||
|     private $username; | ||||
|  | ||||
|   /** @var string The visibility of the organization */ | ||||
|   private $visibility; | ||||
|     /** @var string The visibility of the organization */ | ||||
|     private $visibility; | ||||
|  | ||||
|   /** @var UriInterface|null The website URL of the organization */ | ||||
|   private $website = null; | ||||
|     /** @var UriInterface|null The website URL of the organization */ | ||||
|     private $website = null; | ||||
|  | ||||
|   /** | ||||
|    * Creates a new organization. | ||||
|    * @param string $username The organization name. | ||||
|    * @param string $visibility The organization visibility. | ||||
|    */ | ||||
|   function __construct(string $username, string $visibility = "private") { | ||||
|     $this->setUserName($username); | ||||
|     $this->setVisibility($visibility); | ||||
|   } | ||||
|     /** | ||||
|      * Creates a new organization. | ||||
|      * @param string $username The organization name. | ||||
|      * @param string $visibility The organization visibility. | ||||
|      */ | ||||
|     function __construct(string $username, string $visibility = "private") { | ||||
|         $this->setUserName($username); | ||||
|         $this->setVisibility($visibility); | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Creates a new organization from the specified JSON map. | ||||
|    * @param object $map A JSON map representing an organization. | ||||
|    * @return static The instance corresponding to the specified JSON map. | ||||
|    */ | ||||
|   static function fromJson(object $map): self { | ||||
|     return (new static(isset($map->username) && is_string($map->username) ? $map->username : '', isset($map->visibility) && is_string($map->visibility) ? $map->visibility : 'private')) | ||||
|       ->setAvatarURL(isset($map->avatar_url) && is_string($map->avatar_url) ? new Uri($map->avatar_url) : null) | ||||
|       ->setDescription(isset($map->description) && is_string($map->description) ? $map->description : '') | ||||
|       ->setFullName(isset($map->full_name) && is_string($map->full_name) ? $map->full_name : '') | ||||
|       ->setLocation(isset($map->location) && is_string($map->location) ? $map->location : '') | ||||
|       ->setWebsite(isset($map->website) && is_string($map->website) ? new Uri($map->website) : null); | ||||
|   } | ||||
|     /** | ||||
|      * Creates a new organization from the specified JSON map. | ||||
|      * @param object $map A JSON map representing an organization. | ||||
|      * @return static The instance corresponding to the specified JSON map. | ||||
|      */ | ||||
|     static function fromJson(object $map): self { | ||||
|         return (new static(isset($map->username) && is_string($map->username) ? $map->username : '', isset($map->visibility) && is_string($map->visibility) ? $map->visibility : 'private')) | ||||
|             ->setAvatarURL(isset($map->avatar_url) && is_string($map->avatar_url) ? new Uri($map->avatar_url) : null) | ||||
|             ->setDescription(isset($map->description) && is_string($map->description) ? $map->description : '') | ||||
|             ->setFullName(isset($map->full_name) && is_string($map->full_name) ? $map->full_name : '') | ||||
|             ->setLocation(isset($map->location) && is_string($map->location) ? $map->location : '') | ||||
|             ->setWebsite(isset($map->website) && is_string($map->website) ? new Uri($map->website) : null); | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Converts this object to a map in JSON format. | ||||
|    * @return \stdClass The map in JSON format corresponding to this object. | ||||
|    */ | ||||
|   function jsonSerialize(): \stdClass { | ||||
|     return (object) [ | ||||
|       'avatar_url' => ($url = $this->getAvatarURL()) ? (string) $url : null, | ||||
|       'description' => $this->getDescription(), | ||||
|       'full_name' => $this->getFullName(), | ||||
|       'id' => $this->getId(), | ||||
|       'location' => $this->getLocation(), | ||||
|       'username' => $this->getUsername(), | ||||
|       'visibility' => $this->getVisibility(), | ||||
|       'website' => ($url = $this->getWebsite()) ? (string) $url : null | ||||
|     ]; | ||||
|   } | ||||
|     /** | ||||
|      * Converts this object to a map in JSON format. | ||||
|      * @return \stdClass The map in JSON format corresponding to this object. | ||||
|      */ | ||||
|     function jsonSerialize(): \stdClass { | ||||
|         return (object) [ | ||||
|             'avatar_url' => ($url = $this->getAvatarURL()) ? (string) $url : null, | ||||
|             'description' => $this->getDescription(), | ||||
|             'full_name' => $this->getFullName(), | ||||
|             'id' => $this->getId(), | ||||
|             'location' => $this->getLocation(), | ||||
|             'username' => $this->getUsername(), | ||||
|             'visibility' => $this->getVisibility(), | ||||
|             'website' => ($url = $this->getWebsite()) ? (string) $url : null | ||||
|         ]; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the organization identifier. | ||||
|    * @return int The organization identifier. | ||||
|    */ | ||||
|   function getId(): int { | ||||
|     return $this->id; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the organization identifier. | ||||
|      * @return int The organization identifier. | ||||
|      */ | ||||
|     function getId(): int { | ||||
|         return $this->id; | ||||
|     } | ||||
|  | ||||
|   public function getAvatarURL(): ?UriInterface { | ||||
|     return $this->avatarURL; | ||||
|   } | ||||
|     public function getAvatarURL(): ?UriInterface { | ||||
|         return $this->avatarURL; | ||||
|     } | ||||
|  | ||||
|   public function setAvatarURL(?UriInterface $value): self { | ||||
|     $this->avatarURL = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     public function setAvatarURL(?UriInterface $value): self { | ||||
|         $this->avatarURL = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   public function getDescription() { | ||||
|     return $this->description; | ||||
|   } | ||||
|     public function getDescription() { | ||||
|         return $this->description; | ||||
|     } | ||||
|  | ||||
|   public function setDescription(string $value): self { | ||||
|     $this->description = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     public function setDescription(string $value): self { | ||||
|         $this->description = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   public function getFullName() { | ||||
|     return $this->fullName; | ||||
|   } | ||||
|     public function getFullName() { | ||||
|         return $this->fullName; | ||||
|     } | ||||
|  | ||||
|   public function setFullName(string $value): self { | ||||
|     $this->fullName = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     public function setFullName(string $value): self { | ||||
|         $this->fullName = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   public function getLocation() { | ||||
|     return $this->location; | ||||
|   } | ||||
|     public function getLocation() { | ||||
|         return $this->location; | ||||
|     } | ||||
|  | ||||
|   public function setLocation(string $value): self { | ||||
|     $this->location = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     public function setLocation(string $value): self { | ||||
|         $this->location = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   public function getUsername() { | ||||
|     return $this->username; | ||||
|   } | ||||
|     public function getUsername() { | ||||
|         return $this->username; | ||||
|     } | ||||
|  | ||||
|   public function setUsername(string $value): self { | ||||
|     $this->username = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     public function setUsername(string $value): self { | ||||
|         $this->username = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   public function getVisibility() { | ||||
|     return $this->visibility; | ||||
|   } | ||||
|     public function getVisibility() { | ||||
|         return $this->visibility; | ||||
|     } | ||||
|  | ||||
|   public function setVisibility(string $value): self { | ||||
|     $this->visibility = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     public function setVisibility(string $value): self { | ||||
|         $this->visibility = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   public function getWebsite(): ?UriInterface { | ||||
|     return $this->website; | ||||
|   } | ||||
|     public function getWebsite(): ?UriInterface { | ||||
|         return $this->website; | ||||
|     } | ||||
|  | ||||
|   public function setWebsite(?UriInterface $value): self { | ||||
|     $this->website = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     public function setWebsite(?UriInterface $value): self { | ||||
|         $this->website = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
| } | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| <?php declare(strict_types=1); | ||||
| namespace Gitea\Models; | ||||
| namespace Gitea\Model; | ||||
|  | ||||
| use GuzzleHttp\Psr7\{Uri}; | ||||
| use Psr\Http\Message\{UriInterface}; | ||||
| @ -7,180 +7,180 @@ use Psr\Http\Message\{UriInterface}; | ||||
| /** Represents a commit. */ | ||||
| class PayloadCommit implements \JsonSerializable { | ||||
|  | ||||
|   /** @var PayloadUser|null The person who authored the commit. */ | ||||
|   private $author; | ||||
|     /** @var PayloadUser|null The person who authored the commit. */ | ||||
|     private $author; | ||||
|  | ||||
|   /** @var PayloadUser|null The person who committed the code. */ | ||||
|   private $committer; | ||||
|     /** @var PayloadUser|null The person who committed the code. */ | ||||
|     private $committer; | ||||
|  | ||||
|   /** @var string The commit hash. */ | ||||
|   private $id; | ||||
|     /** @var string The commit hash. */ | ||||
|     private $id; | ||||
|  | ||||
|   /** @var string The commit message. */ | ||||
|   private $message; | ||||
|     /** @var string The commit message. */ | ||||
|     private $message; | ||||
|  | ||||
|   /** @var \DateTime|null The commit date. */ | ||||
|   private $timestamp; | ||||
|     /** @var \DateTime|null The commit date. */ | ||||
|     private $timestamp; | ||||
|  | ||||
|   /** @var UriInterface|null The URL to the commit's history. */ | ||||
|   private $url; | ||||
|     /** @var UriInterface|null The URL to the commit's history. */ | ||||
|     private $url; | ||||
|  | ||||
|   /** @var PayloadCommitVerification|null The GPG verification of this commit. */ | ||||
|   private $verification; | ||||
|     /** @var PayloadCommitVerification|null The GPG verification of this commit. */ | ||||
|     private $verification; | ||||
|  | ||||
|   /** | ||||
|    * Creates a new payload commit. | ||||
|    * @param string $id The commit hash. | ||||
|    * @param string $message The commit message. | ||||
|    */ | ||||
|   function __construct(string $id, string $message) { | ||||
|     $this->id = $id; | ||||
|     $this->setMessage($message); | ||||
|   } | ||||
|     /** | ||||
|      * Creates a new payload commit. | ||||
|      * @param string $id The commit hash. | ||||
|      * @param string $message The commit message. | ||||
|      */ | ||||
|     function __construct(string $id, string $message) { | ||||
|         $this->id = $id; | ||||
|         $this->setMessage($message); | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Creates a new commit from the specified JSON map. | ||||
|    * @param object $map A JSON map representing a commit. | ||||
|    * @return static The instance corresponding to the specified JSON map. | ||||
|    */ | ||||
|   static function fromJson(object $map): self { | ||||
|     return (new static(isset($map->id) && is_string($map->id) ? $map->id : '', isset($map->message) && is_string($map->message) ? $map->message : '')) | ||||
|       ->setAuthor(isset($map->author) && is_object($map->author) ? PayloadUser::fromJson($map->author) : null) | ||||
|       ->setCommitter(isset($map->committer) && is_object($map->committer) ? PayloadUser::fromJson($map->committer) : null) | ||||
|       ->setTimestamp(isset($map->timestamp) && is_string($map->timestamp) ? new \DateTime($map->timestamp) : null) | ||||
|       ->setUrl(isset($map->url) && is_string($map->url) ? new Uri($map->url) : null) | ||||
|       ->setVerification(isset($map->verification) && is_object($map->verification) ? PayloadCommitVerification::fromJson($map->verification) : null); | ||||
|   } | ||||
|     /** | ||||
|      * Creates a new commit from the specified JSON map. | ||||
|      * @param object $map A JSON map representing a commit. | ||||
|      * @return static The instance corresponding to the specified JSON map. | ||||
|      */ | ||||
|     static function fromJson(object $map): self { | ||||
|         return (new static(isset($map->id) && is_string($map->id) ? $map->id : '', isset($map->message) && is_string($map->message) ? $map->message : '')) | ||||
|             ->setAuthor(isset($map->author) && is_object($map->author) ? PayloadUser::fromJson($map->author) : null) | ||||
|             ->setCommitter(isset($map->committer) && is_object($map->committer) ? PayloadUser::fromJson($map->committer) : null) | ||||
|             ->setTimestamp(isset($map->timestamp) && is_string($map->timestamp) ? new \DateTime($map->timestamp) : null) | ||||
|             ->setUrl(isset($map->url) && is_string($map->url) ? new Uri($map->url) : null) | ||||
|             ->setVerification(isset($map->verification) && is_object($map->verification) ? PayloadCommitVerification::fromJson($map->verification) : null); | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the person who authored the commit. | ||||
|    * @return PayloadUser|null The person who authored the commit. | ||||
|    */ | ||||
|   function getAuthor(): ?PayloadUser { | ||||
|     return $this->author; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the person who authored the commit. | ||||
|      * @return PayloadUser|null The person who authored the commit. | ||||
|      */ | ||||
|     function getAuthor(): ?PayloadUser { | ||||
|         return $this->author; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the person who committed the code. | ||||
|    * @return PayloadUser|null The person who committed the code. | ||||
|    */ | ||||
|   function getCommitter(): ?PayloadUser { | ||||
|     return $this->committer; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the person who committed the code. | ||||
|      * @return PayloadUser|null The person who committed the code. | ||||
|      */ | ||||
|     function getCommitter(): ?PayloadUser { | ||||
|         return $this->committer; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the commit hash. | ||||
|    * @return string The commit hash. | ||||
|    */ | ||||
|   function getId(): string { | ||||
|     return $this->id; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the commit hash. | ||||
|      * @return string The commit hash. | ||||
|      */ | ||||
|     function getId(): string { | ||||
|         return $this->id; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the commit message. | ||||
|    * @return string The commit message. | ||||
|    */ | ||||
|   function getMessage(): string { | ||||
|     return $this->message; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the commit message. | ||||
|      * @return string The commit message. | ||||
|      */ | ||||
|     function getMessage(): string { | ||||
|         return $this->message; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the commit date. | ||||
|    * @return \DateTime|null The commit date. | ||||
|    */ | ||||
|   function getTimestamp(): ?\DateTime { | ||||
|     return $this->timestamp; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the commit date. | ||||
|      * @return \DateTime|null The commit date. | ||||
|      */ | ||||
|     function getTimestamp(): ?\DateTime { | ||||
|         return $this->timestamp; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the URL to the commit's history. | ||||
|    * @return UriInterface|null The URL to the commit's history. | ||||
|    */ | ||||
|   function getUrl(): ?UriInterface { | ||||
|     return $this->url; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the URL to the commit's history. | ||||
|      * @return UriInterface|null The URL to the commit's history. | ||||
|      */ | ||||
|     function getUrl(): ?UriInterface { | ||||
|         return $this->url; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the GPG verification of this commit. | ||||
|    * @return PayloadCommitVerification|null The GPG verification of this commit. | ||||
|    */ | ||||
|   function getVerification(): ?PayloadCommitVerification { | ||||
|     return $this->verification; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the GPG verification of this commit. | ||||
|      * @return PayloadCommitVerification|null The GPG verification of this commit. | ||||
|      */ | ||||
|     function getVerification(): ?PayloadCommitVerification { | ||||
|         return $this->verification; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Converts this object to a map in JSON format. | ||||
|    * @return \stdClass The map in JSON format corresponding to this object. | ||||
|    */ | ||||
|   function jsonSerialize(): \stdClass { | ||||
|     return (object) [ | ||||
|       'author' => ($author = $this->getAuthor()) ? $author->jsonSerialize() : null, | ||||
|       'committer' => ($committer = $this->getCommitter()) ? $committer->jsonSerialize() : null, | ||||
|       'id' => $this->getId(), | ||||
|       'message' => $this->getMessage(), | ||||
|       'timestamp' => ($date = $this->getTimestamp()) ? $date->format('c') : null, | ||||
|       'url' => ($url = $this->getUrl()) ? (string) $url : null, | ||||
|       'verification' => ($verification = $this->getVerification()) ? $verification->jsonSerialize() : null | ||||
|     ]; | ||||
|   } | ||||
|     /** | ||||
|      * Converts this object to a map in JSON format. | ||||
|      * @return \stdClass The map in JSON format corresponding to this object. | ||||
|      */ | ||||
|     function jsonSerialize(): \stdClass { | ||||
|         return (object) [ | ||||
|             'author' => ($author = $this->getAuthor()) ? $author->jsonSerialize() : null, | ||||
|             'committer' => ($committer = $this->getCommitter()) ? $committer->jsonSerialize() : null, | ||||
|             'id' => $this->getId(), | ||||
|             'message' => $this->getMessage(), | ||||
|             'timestamp' => ($date = $this->getTimestamp()) ? $date->format('c') : null, | ||||
|             'url' => ($url = $this->getUrl()) ? (string) $url : null, | ||||
|             'verification' => ($verification = $this->getVerification()) ? $verification->jsonSerialize() : null | ||||
|         ]; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the person who authored the commit. | ||||
|    * @param PayloadUser|null $value The new author. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setAuthor(?PayloadUser $value): self { | ||||
|     $this->author = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the person who authored the commit. | ||||
|      * @param PayloadUser|null $value The new author. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setAuthor(?PayloadUser $value): self { | ||||
|         $this->author = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the person who committed the code. | ||||
|    * @param PayloadUser|null $value The new committer. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setCommitter(?PayloadUser $value): self { | ||||
|     $this->committer = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the person who committed the code. | ||||
|      * @param PayloadUser|null $value The new committer. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setCommitter(?PayloadUser $value): self { | ||||
|         $this->committer = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the commit message. | ||||
|    * @param string $value The new message. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setMessage(string $value): self { | ||||
|     $this->message = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the commit message. | ||||
|      * @param string $value The new message. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setMessage(string $value): self { | ||||
|         $this->message = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the commit date. | ||||
|    * @param \DateTime|null $value The new commit date. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setTimestamp(?\DateTime $value): self { | ||||
|     $this->timestamp = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the commit date. | ||||
|      * @param \DateTime|null $value The new commit date. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setTimestamp(?\DateTime $value): self { | ||||
|         $this->timestamp = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the URL to the commit's history. | ||||
|    * @param UriInterface|null $value The new commit URL. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setUrl(?UriInterface $value): self { | ||||
|     $this->url = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the URL to the commit's history. | ||||
|      * @param UriInterface|null $value The new commit URL. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setUrl(?UriInterface $value): self { | ||||
|         $this->url = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the commit message. | ||||
|    * @param PayloadCommitVerification|null $value The new message. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setVerification(?PayloadCommitVerification $value): self { | ||||
|     $this->verification = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the commit message. | ||||
|      * @param PayloadCommitVerification|null $value The new message. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setVerification(?PayloadCommitVerification $value): self { | ||||
|         $this->verification = $value; | ||||
|         return $this; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -1,123 +1,123 @@ | ||||
| <?php declare(strict_types=1); | ||||
| namespace Gitea\Models; | ||||
| namespace Gitea\Model; | ||||
|  | ||||
| /** Represents the GPG verification of a commit. */ | ||||
| class PayloadCommitVerification implements \JsonSerializable { | ||||
|  | ||||
|   /** @var bool Value indicating whether the verification has succeeded. */ | ||||
|   private $isVerified; | ||||
|     /** @var bool Value indicating whether the verification has succeeded. */ | ||||
|     private $isVerified; | ||||
|  | ||||
|   /** @var string A custom message sent with the verification request. */ | ||||
|   private $payload = ''; | ||||
|     /** @var string A custom message sent with the verification request. */ | ||||
|     private $payload = ''; | ||||
|  | ||||
|   /** @var string A message providing details about the verification. */ | ||||
|   private $reason = ''; | ||||
|     /** @var string A message providing details about the verification. */ | ||||
|     private $reason = ''; | ||||
|  | ||||
|   /** @var string The signing key used for the verification. */ | ||||
|   private $signature = ''; | ||||
|     /** @var string The signing key used for the verification. */ | ||||
|     private $signature = ''; | ||||
|  | ||||
|   /** | ||||
|    * Creates a new verification of a payload commit. | ||||
|    * @param bool $isVerified Value indicating whether the verification has succeeded. | ||||
|    */ | ||||
|   function __construct(bool $isVerified = false) { | ||||
|     $this->setVerified($isVerified); | ||||
|   } | ||||
|     /** | ||||
|      * Creates a new verification of a payload commit. | ||||
|      * @param bool $isVerified Value indicating whether the verification has succeeded. | ||||
|      */ | ||||
|     function __construct(bool $isVerified = false) { | ||||
|         $this->setVerified($isVerified); | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Creates a new commit from the specified JSON map. | ||||
|    * @param object $map A JSON map representing a commit. | ||||
|    * @return static The instance corresponding to the specified JSON map. | ||||
|    */ | ||||
|   static function fromJson(object $map): self { | ||||
|     return (new static(isset($map->verified) && is_bool($map->verified) ? $map->verified : false)) | ||||
|       ->setPayload(isset($map->payload) && is_string($map->payload) ? $map->payload : '') | ||||
|       ->setReason(isset($map->reason) && is_string($map->reason) ? $map->reason : '') | ||||
|       ->setSignature(isset($map->signature) && is_string($map->signature) ? $map->signature : ''); | ||||
|   } | ||||
|     /** | ||||
|      * Creates a new commit from the specified JSON map. | ||||
|      * @param object $map A JSON map representing a commit. | ||||
|      * @return static The instance corresponding to the specified JSON map. | ||||
|      */ | ||||
|     static function fromJson(object $map): self { | ||||
|         return (new static(isset($map->verified) && is_bool($map->verified) ? $map->verified : false)) | ||||
|             ->setPayload(isset($map->payload) && is_string($map->payload) ? $map->payload : '') | ||||
|             ->setReason(isset($map->reason) && is_string($map->reason) ? $map->reason : '') | ||||
|             ->setSignature(isset($map->signature) && is_string($map->signature) ? $map->signature : ''); | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the custom message sent with the verification request. | ||||
|    * @return string The custom message sent with the verification request. | ||||
|    */ | ||||
|   function getPayload(): string { | ||||
|     return $this->payload; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the custom message sent with the verification request. | ||||
|      * @return string The custom message sent with the verification request. | ||||
|      */ | ||||
|     function getPayload(): string { | ||||
|         return $this->payload; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the message providing details about the verification. | ||||
|    * @return string The message providing details about the verification. | ||||
|    */ | ||||
|   function getReason(): string { | ||||
|     return $this->reason; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the message providing details about the verification. | ||||
|      * @return string The message providing details about the verification. | ||||
|      */ | ||||
|     function getReason(): string { | ||||
|         return $this->reason; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the signing key used for the verification. | ||||
|    * @return string The signing key used for the verification. | ||||
|    */ | ||||
|   function getSignature(): string { | ||||
|     return $this->signature; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the signing key used for the verification. | ||||
|      * @return string The signing key used for the verification. | ||||
|      */ | ||||
|     function getSignature(): string { | ||||
|         return $this->signature; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets a value indicating whether the verification has succeeded. | ||||
|    * @return bool `true` if the verification has succeeded, otherwise `false`. | ||||
|    */ | ||||
|   function isVerified(): bool { | ||||
|     return $this->isVerified; | ||||
|   } | ||||
|     /** | ||||
|      * Gets a value indicating whether the verification has succeeded. | ||||
|      * @return bool `true` if the verification has succeeded, otherwise `false`. | ||||
|      */ | ||||
|     function isVerified(): bool { | ||||
|         return $this->isVerified; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Converts this object to a map in JSON format. | ||||
|    * @return \stdClass The map in JSON format corresponding to this object. | ||||
|    */ | ||||
|   function jsonSerialize(): \stdClass { | ||||
|     return (object) [ | ||||
|       'payload' => $this->getPayload(), | ||||
|       'reason' => $this->getReason(), | ||||
|       'signature' => $this->getSignature(), | ||||
|       'verified' => $this->isVerified() | ||||
|     ]; | ||||
|   } | ||||
|     /** | ||||
|      * Converts this object to a map in JSON format. | ||||
|      * @return \stdClass The map in JSON format corresponding to this object. | ||||
|      */ | ||||
|     function jsonSerialize(): \stdClass { | ||||
|         return (object) [ | ||||
|             'payload' => $this->getPayload(), | ||||
|             'reason' => $this->getReason(), | ||||
|             'signature' => $this->getSignature(), | ||||
|             'verified' => $this->isVerified() | ||||
|         ]; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the custom message sent with the verification request. | ||||
|    * @param string $value A new custom message. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setPayload(string $value): self { | ||||
|     $this->payload = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the custom message sent with the verification request. | ||||
|      * @param string $value A new custom message. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setPayload(string $value): self { | ||||
|         $this->payload = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the message providing details about the verification. | ||||
|    * @param string $value A new message providing details about the verification. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setReason(string $value): self { | ||||
|     $this->reason = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the message providing details about the verification. | ||||
|      * @param string $value A new message providing details about the verification. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setReason(string $value): self { | ||||
|         $this->reason = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the signing key used for the verification. | ||||
|    * @param string $value The new signing key. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setSignature(string $value): self { | ||||
|     $this->signature = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the signing key used for the verification. | ||||
|      * @param string $value The new signing key. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setSignature(string $value): self { | ||||
|         $this->signature = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets a value indicating whether the verification has succeeded. | ||||
|    * @param bool $value `true` if the verification has succeeded, otherwise `false`. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setVerified(bool $value): self { | ||||
|     $this->isVerified = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets a value indicating whether the verification has succeeded. | ||||
|      * @param bool $value `true` if the verification has succeeded, otherwise `false`. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setVerified(bool $value): self { | ||||
|         $this->isVerified = $value; | ||||
|         return $this; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -1,90 +1,90 @@ | ||||
| <?php declare(strict_types=1); | ||||
| namespace Gitea\Models; | ||||
| namespace Gitea\Model; | ||||
|  | ||||
| /** Represents the author or committer of a commit. */ | ||||
| class PayloadUser implements \JsonSerializable { | ||||
|  | ||||
|   /** @var string The mail address. */ | ||||
|   private $email = ''; | ||||
|     /** @var string The mail address. */ | ||||
|     private $email = ''; | ||||
|  | ||||
|   /** @var string The full name. */ | ||||
|   private $name = ''; | ||||
|     /** @var string The full name. */ | ||||
|     private $name = ''; | ||||
|  | ||||
|   /** @var string The name of the Gitea account. */ | ||||
|   private $username; | ||||
|     /** @var string The name of the Gitea account. */ | ||||
|     private $username; | ||||
|  | ||||
|   /** | ||||
|    * Creates a new payload user. | ||||
|    * @param string $username The name of the Gitea account. | ||||
|    */ | ||||
|   function __construct(string $username) { | ||||
|     $this->username = $username; | ||||
|   } | ||||
|     /** | ||||
|      * Creates a new payload user. | ||||
|      * @param string $username The name of the Gitea account. | ||||
|      */ | ||||
|     function __construct(string $username) { | ||||
|         $this->username = $username; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Creates a new user from the specified JSON map. | ||||
|    * @param object $map A JSON map representing a user. | ||||
|    * @return static The instance corresponding to the specified JSON map. | ||||
|    */ | ||||
|   static function fromJson(object $map): self { | ||||
|     return (new static(isset($map->username) && is_string($map->username) ? $map->username : '')) | ||||
|       ->setEmail(isset($map->email) && is_string($map->email) ? mb_strtolower($map->email) : '') | ||||
|       ->setName(isset($map->name) && is_string($map->name) ? $map->name : ''); | ||||
|   } | ||||
|     /** | ||||
|      * Creates a new user from the specified JSON map. | ||||
|      * @param object $map A JSON map representing a user. | ||||
|      * @return static The instance corresponding to the specified JSON map. | ||||
|      */ | ||||
|     static function fromJson(object $map): self { | ||||
|         return (new static(isset($map->username) && is_string($map->username) ? $map->username : '')) | ||||
|             ->setEmail(isset($map->email) && is_string($map->email) ? mb_strtolower($map->email) : '') | ||||
|             ->setName(isset($map->name) && is_string($map->name) ? $map->name : ''); | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the mail address. | ||||
|    * @return string The mail address. | ||||
|    */ | ||||
|   function getEmail(): string { | ||||
|     return $this->email; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the mail address. | ||||
|      * @return string The mail address. | ||||
|      */ | ||||
|     function getEmail(): string { | ||||
|         return $this->email; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the full name. | ||||
|    * @return string The full name. | ||||
|    */ | ||||
|   function getName(): string { | ||||
|     return $this->name; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the full name. | ||||
|      * @return string The full name. | ||||
|      */ | ||||
|     function getName(): string { | ||||
|         return $this->name; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the name of the Gitea account. | ||||
|    * @return string The name of the Gitea account. | ||||
|    */ | ||||
|   function getUsername(): string { | ||||
|     return $this->username; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the name of the Gitea account. | ||||
|      * @return string The name of the Gitea account. | ||||
|      */ | ||||
|     function getUsername(): string { | ||||
|         return $this->username; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Converts this object to a map in JSON format. | ||||
|    * @return \stdClass The map in JSON format corresponding to this object. | ||||
|    */ | ||||
|   function jsonSerialize(): \stdClass { | ||||
|     return (object) [ | ||||
|       'email' => $this->getEmail(), | ||||
|       'name' => $this->getName(), | ||||
|       'username' => $this->getUsername() | ||||
|     ]; | ||||
|   } | ||||
|     /** | ||||
|      * Converts this object to a map in JSON format. | ||||
|      * @return \stdClass The map in JSON format corresponding to this object. | ||||
|      */ | ||||
|     function jsonSerialize(): \stdClass { | ||||
|         return (object) [ | ||||
|             'email' => $this->getEmail(), | ||||
|             'name' => $this->getName(), | ||||
|             'username' => $this->getUsername() | ||||
|         ]; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the mail address. | ||||
|    * @param string $value The new mail address. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setEmail(string $value): self { | ||||
|     $this->email = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the mail address. | ||||
|      * @param string $value The new mail address. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setEmail(string $value): self { | ||||
|         $this->email = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the full name. | ||||
|    * @param string $value The new full name. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setName(string $value): self { | ||||
|     $this->name = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the full name. | ||||
|      * @param string $value The new full name. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setName(string $value): self { | ||||
|         $this->name = $value; | ||||
|         return $this; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -1,104 +1,104 @@ | ||||
| <?php declare(strict_types=1); | ||||
| namespace Gitea\Models; | ||||
| namespace Gitea\Model; | ||||
|  | ||||
| /** Represents a set of permissions. */ | ||||
| class Permission implements \JsonSerializable { | ||||
|  | ||||
|   /** @var bool Value indicating whether administrator access is allowed. */ | ||||
|   private $admin; | ||||
|     /** @var bool Value indicating whether administrator access is allowed. */ | ||||
|     private $admin; | ||||
|  | ||||
|   /** @var bool Value indicating whether pull is allowed. */ | ||||
|   private $pull; | ||||
|     /** @var bool Value indicating whether pull is allowed. */ | ||||
|     private $pull; | ||||
|  | ||||
|   /** @var bool Value indicating whether push is allowed. */ | ||||
|   private $push; | ||||
|     /** @var bool Value indicating whether push is allowed. */ | ||||
|     private $push; | ||||
|  | ||||
|   /** | ||||
|    * Creates a new permission. | ||||
|    * @param bool $admin Value indicating whether administrator access is allowed. | ||||
|    * @param bool $pull Value indicating whether pull is allowed. | ||||
|    * @param bool $push Value indicating whether push is allowed. | ||||
|    */ | ||||
|   function __construct(bool $admin = false, bool $pull = false, bool $push = false) { | ||||
|     $this->setAdmin($admin)->setPull($pull)->setPush($push); | ||||
|   } | ||||
|     /** | ||||
|      * Creates a new permission. | ||||
|      * @param bool $admin Value indicating whether administrator access is allowed. | ||||
|      * @param bool $pull Value indicating whether pull is allowed. | ||||
|      * @param bool $push Value indicating whether push is allowed. | ||||
|      */ | ||||
|     function __construct(bool $admin = false, bool $pull = false, bool $push = false) { | ||||
|         $this->setAdmin($admin)->setPull($pull)->setPush($push); | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Creates a new user from the specified JSON map. | ||||
|    * @param object $map A JSON map representing a user. | ||||
|    * @return static The instance corresponding to the specified JSON map. | ||||
|    */ | ||||
|   static function fromJson(object $map): self { | ||||
|     return new static( | ||||
|       isset($map->admin) && is_bool($map->admin) ? $map->admin : false, | ||||
|       isset($map->pull) && is_bool($map->pull) ? $map->pull : false, | ||||
|       isset($map->push) && is_bool($map->push) ? $map->push : false | ||||
|     ); | ||||
|   } | ||||
|     /** | ||||
|      * Creates a new user from the specified JSON map. | ||||
|      * @param object $map A JSON map representing a user. | ||||
|      * @return static The instance corresponding to the specified JSON map. | ||||
|      */ | ||||
|     static function fromJson(object $map): self { | ||||
|         return new static( | ||||
|             isset($map->admin) && is_bool($map->admin) ? $map->admin : false, | ||||
|             isset($map->pull) && is_bool($map->pull) ? $map->pull : false, | ||||
|             isset($map->push) && is_bool($map->push) ? $map->push : false | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets a value indicating whether administrator access is allowed. | ||||
|    * @return bool `true` if administrator access is allowed, otherwise `false`. | ||||
|    */ | ||||
|   function getAdmin(): bool { | ||||
|     return $this->admin; | ||||
|   } | ||||
|     /** | ||||
|      * Gets a value indicating whether administrator access is allowed. | ||||
|      * @return bool `true` if administrator access is allowed, otherwise `false`. | ||||
|      */ | ||||
|     function getAdmin(): bool { | ||||
|         return $this->admin; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets a value indicating whether pull is allowed. | ||||
|    * @return bool `true` if pull is allowed, otherwise `false`. | ||||
|    */ | ||||
|   function getPull(): bool { | ||||
|     return $this->pull; | ||||
|   } | ||||
|     /** | ||||
|      * Gets a value indicating whether pull is allowed. | ||||
|      * @return bool `true` if pull is allowed, otherwise `false`. | ||||
|      */ | ||||
|     function getPull(): bool { | ||||
|         return $this->pull; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets a value indicating whether push is allowed. | ||||
|    * @return bool `true` if push is allowed, otherwise `false`. | ||||
|    */ | ||||
|   function getPush(): bool { | ||||
|     return $this->push; | ||||
|   } | ||||
|     /** | ||||
|      * Gets a value indicating whether push is allowed. | ||||
|      * @return bool `true` if push is allowed, otherwise `false`. | ||||
|      */ | ||||
|     function getPush(): bool { | ||||
|         return $this->push; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Converts this object to a map in JSON format. | ||||
|    * @return \stdClass The map in JSON format corresponding to this object. | ||||
|    */ | ||||
|   function jsonSerialize(): \stdClass { | ||||
|     return (object) [ | ||||
|       'admin' => $this->getAdmin(), | ||||
|       'pull' => $this->getPull(), | ||||
|       'push' => $this->getPush() | ||||
|     ]; | ||||
|   } | ||||
|     /** | ||||
|      * Converts this object to a map in JSON format. | ||||
|      * @return \stdClass The map in JSON format corresponding to this object. | ||||
|      */ | ||||
|     function jsonSerialize(): \stdClass { | ||||
|         return (object) [ | ||||
|             'admin' => $this->getAdmin(), | ||||
|             'pull' => $this->getPull(), | ||||
|             'push' => $this->getPush() | ||||
|         ]; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets a value indicating whether administrator access is allowed. | ||||
|    * @param bool $value `true` to allow administrator access, otherwise `false`. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setAdmin(bool $value): self { | ||||
|     $this->admin = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets a value indicating whether administrator access is allowed. | ||||
|      * @param bool $value `true` to allow administrator access, otherwise `false`. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setAdmin(bool $value): self { | ||||
|         $this->admin = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets a value indicating whether pull is allowed. | ||||
|    * @param bool $value `true` to allow pull, otherwise `false`. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setPull(bool $value): self { | ||||
|     $this->pull = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets a value indicating whether pull is allowed. | ||||
|      * @param bool $value `true` to allow pull, otherwise `false`. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setPull(bool $value): self { | ||||
|         $this->pull = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets a value indicating whether push is allowed. | ||||
|    * @param bool $value `true` to allow push, otherwise `false`. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setPush(bool $value): self { | ||||
|     $this->push = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets a value indicating whether push is allowed. | ||||
|      * @param bool $value `true` to allow push, otherwise `false`. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setPush(bool $value): self { | ||||
|         $this->push = $value; | ||||
|         return $this; | ||||
|     } | ||||
| } | ||||
|  | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -1,42 +1,42 @@ | ||||
| <?php declare(strict_types=1); | ||||
| namespace Gitea\Models; | ||||
| namespace Gitea\Model; | ||||
|  | ||||
| /** Wraps the version of the Gitea server. */ | ||||
| class ServerVersion implements \JsonSerializable { | ||||
|  | ||||
|   /** @var string The version number. */ | ||||
|   private $version; | ||||
|     /** @var string The version number. */ | ||||
|     private $version; | ||||
|  | ||||
|   /** | ||||
|    * Creates a new server version. | ||||
|    * @param string $version The version number. | ||||
|    */ | ||||
|   function __construct(string $version) { | ||||
|     $this->version = $version; | ||||
|   } | ||||
|     /** | ||||
|      * Creates a new server version. | ||||
|      * @param string $version The version number. | ||||
|      */ | ||||
|     function __construct(string $version) { | ||||
|         $this->version = $version; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Creates a new server version from the specified JSON map. | ||||
|    * @param object $map A JSON map representing a server version. | ||||
|    * @return static The instance corresponding to the specified JSON map. | ||||
|    */ | ||||
|   static function fromJson(object $map): self { | ||||
|     return new static(isset($map->version) && is_string($map->version) ? $map->version : ''); | ||||
|   } | ||||
|     /** | ||||
|      * Creates a new server version from the specified JSON map. | ||||
|      * @param object $map A JSON map representing a server version. | ||||
|      * @return static The instance corresponding to the specified JSON map. | ||||
|      */ | ||||
|     static function fromJson(object $map): self { | ||||
|         return new static(isset($map->version) && is_string($map->version) ? $map->version : ''); | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the version number. | ||||
|    * @return string The version number. | ||||
|    */ | ||||
|   function getVersion(): string { | ||||
|     return $this->version; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the version number. | ||||
|      * @return string The version number. | ||||
|      */ | ||||
|     function getVersion(): string { | ||||
|         return $this->version; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Converts this object to a map in JSON format. | ||||
|    * @return \stdClass The map in JSON format corresponding to this object. | ||||
|    */ | ||||
|   function jsonSerialize(): \stdClass { | ||||
|     return (object) ['version' => $this->getVersion()]; | ||||
|   } | ||||
|     /** | ||||
|      * Converts this object to a map in JSON format. | ||||
|      * @return \stdClass The map in JSON format corresponding to this object. | ||||
|      */ | ||||
|     function jsonSerialize(): \stdClass { | ||||
|         return (object) ['version' => $this->getVersion()]; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -1,24 +1,24 @@ | ||||
| <?php declare(strict_types=1); | ||||
| namespace Gitea\Models; | ||||
| namespace Gitea\Model; | ||||
|  | ||||
| use Enum\{EnumTrait}; | ||||
|  | ||||
| /** Defines the state of a Gitea status. */ | ||||
| final class StatusState { | ||||
|   use EnumTrait; | ||||
|     use EnumTrait; | ||||
|  | ||||
|   /** @var string The status is an error. */ | ||||
|   const error = 'error'; | ||||
|     /** @var string The status is an error. */ | ||||
|     const error = 'error'; | ||||
|  | ||||
|   /** @var string The status is a failure. */ | ||||
|   const failure = 'failure'; | ||||
|     /** @var string The status is a failure. */ | ||||
|     const failure = 'failure'; | ||||
|  | ||||
|   /** @var string The status is pending. */ | ||||
|   const pending = 'pending'; | ||||
|     /** @var string The status is pending. */ | ||||
|     const pending = 'pending'; | ||||
|  | ||||
|   /** @var string The status is a success. */ | ||||
|   const success = 'success'; | ||||
|     /** @var string The status is a success. */ | ||||
|     const success = 'success'; | ||||
|  | ||||
|   /** @var string The status is a warning. */ | ||||
|   const warning = 'warning'; | ||||
|     /** @var string The status is a warning. */ | ||||
|     const warning = 'warning'; | ||||
| } | ||||
|  | ||||
| @ -1,114 +1,114 @@ | ||||
| <?php declare(strict_types=1); | ||||
| namespace Gitea\Models; | ||||
| namespace Gitea\Model; | ||||
|  | ||||
| /** Represents a team in an organization. */ | ||||
| class Team implements \JsonSerializable { | ||||
|  | ||||
|   /** @var string The team description. */ | ||||
|   private $description = ''; | ||||
|     /** @var string The team description. */ | ||||
|     private $description = ''; | ||||
|  | ||||
|   /** @var int The team identifier. */ | ||||
|   private $id; | ||||
|     /** @var int The team identifier. */ | ||||
|     private $id; | ||||
|  | ||||
|   /** @var string The team name. */ | ||||
|   private $name; | ||||
|     /** @var string The team name. */ | ||||
|     private $name; | ||||
|  | ||||
|   /** @var string The team permission. */ | ||||
|   private $permission = TeamPermission::none; | ||||
|     /** @var string The team permission. */ | ||||
|     private $permission = TeamPermission::none; | ||||
|  | ||||
|   /** | ||||
|    * Creates a new team. | ||||
|    * @param int $id The team identifier. | ||||
|    * @param string $name The team name. | ||||
|    */ | ||||
|   function __construct(int $id, string $name) { | ||||
|     $this->id = $id; | ||||
|     $this->setName($name); | ||||
|   } | ||||
|     /** | ||||
|      * Creates a new team. | ||||
|      * @param int $id The team identifier. | ||||
|      * @param string $name The team name. | ||||
|      */ | ||||
|     function __construct(int $id, string $name) { | ||||
|         $this->id = $id; | ||||
|         $this->setName($name); | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Creates a new user from the specified JSON map. | ||||
|    * @param object $map A JSON map representing a user. | ||||
|    * @return static The instance corresponding to the specified JSON map. | ||||
|    */ | ||||
|   static function fromJson(object $map): self { | ||||
|     return (new static(isset($map->id) && is_int($map->id) ? $map->id : -1, isset($map->name) && is_string($map->name) ? $map->name : '')) | ||||
|       ->setDescription(isset($map->description) && is_string($map->description) ? $map->description : '') | ||||
|       ->setPermission(isset($map->permission) && is_string($map->permission) ? $map->permission : TeamPermission::none); | ||||
|   } | ||||
|     /** | ||||
|      * Creates a new user from the specified JSON map. | ||||
|      * @param object $map A JSON map representing a user. | ||||
|      * @return static The instance corresponding to the specified JSON map. | ||||
|      */ | ||||
|     static function fromJson(object $map): self { | ||||
|         return (new static(isset($map->id) && is_int($map->id) ? $map->id : -1, isset($map->name) && is_string($map->name) ? $map->name : '')) | ||||
|             ->setDescription(isset($map->description) && is_string($map->description) ? $map->description : '') | ||||
|             ->setPermission(isset($map->permission) && is_string($map->permission) ? $map->permission : TeamPermission::none); | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the team description. | ||||
|    * @return string The team description. | ||||
|    */ | ||||
|   function getDescription(): string { | ||||
|     return $this->description; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the team description. | ||||
|      * @return string The team description. | ||||
|      */ | ||||
|     function getDescription(): string { | ||||
|         return $this->description; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the team identifier. | ||||
|    * @return int The team identifier. | ||||
|    */ | ||||
|   function getId(): int { | ||||
|     return $this->id; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the team identifier. | ||||
|      * @return int The team identifier. | ||||
|      */ | ||||
|     function getId(): int { | ||||
|         return $this->id; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the team name. | ||||
|    * @return string The team name. | ||||
|    */ | ||||
|   function getName(): string { | ||||
|     return $this->name; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the team name. | ||||
|      * @return string The team name. | ||||
|      */ | ||||
|     function getName(): string { | ||||
|         return $this->name; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the team permission. | ||||
|    * @return string The team permission. | ||||
|    */ | ||||
|   function getPermission(): string { | ||||
|     return $this->permission; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the team permission. | ||||
|      * @return string The team permission. | ||||
|      */ | ||||
|     function getPermission(): string { | ||||
|         return $this->permission; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Converts this object to a map in JSON format. | ||||
|    * @return \stdClass The map in JSON format corresponding to this object. | ||||
|    */ | ||||
|   function jsonSerialize(): \stdClass { | ||||
|     return (object) [ | ||||
|       'description' => $this->getDescription(), | ||||
|       'id' => $this->getId(), | ||||
|       'name' => $this->getName(), | ||||
|       'permission' => $this->getPermission() | ||||
|     ]; | ||||
|   } | ||||
|     /** | ||||
|      * Converts this object to a map in JSON format. | ||||
|      * @return \stdClass The map in JSON format corresponding to this object. | ||||
|      */ | ||||
|     function jsonSerialize(): \stdClass { | ||||
|         return (object) [ | ||||
|             'description' => $this->getDescription(), | ||||
|             'id' => $this->getId(), | ||||
|             'name' => $this->getName(), | ||||
|             'permission' => $this->getPermission() | ||||
|         ]; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the team description. | ||||
|    * @param string $value The new description. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setDescription(string $value): self { | ||||
|     $this->description = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the team description. | ||||
|      * @param string $value The new description. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setDescription(string $value): self { | ||||
|         $this->description = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the team name. | ||||
|    * @param string $value The new name. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setName(string $value): self { | ||||
|     $this->name = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the team name. | ||||
|      * @param string $value The new name. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setName(string $value): self { | ||||
|         $this->name = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the team permission. | ||||
|    * @param string $value The new permission. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setPermission(string $value): self { | ||||
|     $this->permission = TeamPermission::coerce($value, TeamPermission::none); | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the team permission. | ||||
|      * @param string $value The new permission. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setPermission(string $value): self { | ||||
|         $this->permission = TeamPermission::coerce($value, TeamPermission::none); | ||||
|         return $this; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -1,24 +1,24 @@ | ||||
| <?php declare(strict_types=1); | ||||
| namespace Gitea\Models; | ||||
| namespace Gitea\Model; | ||||
|  | ||||
| use Enum\{EnumTrait}; | ||||
|  | ||||
| /** Defines the permission of a team. */ | ||||
| final class TeamPermission { | ||||
|   use EnumTrait; | ||||
|     use EnumTrait; | ||||
|  | ||||
|   /** @var string The team has the administrator permission. */ | ||||
|   const admin = 'admin'; | ||||
|     /** @var string The team has the administrator permission. */ | ||||
|     const admin = 'admin'; | ||||
|  | ||||
|   /** @var string The team doesn't have any permission. */ | ||||
|   const none = 'none'; | ||||
|     /** @var string The team doesn't have any permission. */ | ||||
|     const none = 'none'; | ||||
|  | ||||
|   /** @var string The team has the owner permission. */ | ||||
|   const owner = 'owner'; | ||||
|     /** @var string The team has the owner permission. */ | ||||
|     const owner = 'owner'; | ||||
|  | ||||
|   /** @var string The team has the read permission. */ | ||||
|   const read = 'read'; | ||||
|     /** @var string The team has the read permission. */ | ||||
|     const read = 'read'; | ||||
|  | ||||
|   /** @var string The team has the write permission. */ | ||||
|   const write = 'write'; | ||||
|     /** @var string The team has the write permission. */ | ||||
|     const write = 'write'; | ||||
| } | ||||
|  | ||||
| @ -1,137 +1,137 @@ | ||||
| <?php declare(strict_types=1); | ||||
| namespace Gitea\Models; | ||||
| namespace Gitea\Model; | ||||
|  | ||||
| /** Represents the worked time for an issue or pull request. */ | ||||
| class TrackedTime implements \JsonSerializable { | ||||
|  | ||||
|   /** @var \DateTime|null The date the entry was created. */ | ||||
|   private $createdAt; | ||||
|     /** @var \DateTime|null The date the entry was created. */ | ||||
|     private $createdAt; | ||||
|  | ||||
|   /** @var int The entry identifier. */ | ||||
|   private $id; | ||||
|     /** @var int The entry identifier. */ | ||||
|     private $id; | ||||
|  | ||||
|   /** @var int The identifier of the associated issue or pull request. */ | ||||
|   private $issueId = -1; | ||||
|     /** @var int The identifier of the associated issue or pull request. */ | ||||
|     private $issueId = -1; | ||||
|  | ||||
|   /** @var int The elapsed time, in seconds. */ | ||||
|   private $time; | ||||
|     /** @var int The elapsed time, in seconds. */ | ||||
|     private $time; | ||||
|  | ||||
|   /** @var int The identifier of the initiating user. */ | ||||
|   private $userId = -1; | ||||
|     /** @var int The identifier of the initiating user. */ | ||||
|     private $userId = -1; | ||||
|  | ||||
|   /** | ||||
|    * Creates a new entry. | ||||
|    * @param int $id The entry identifier. | ||||
|    * @param int $time The elapsed time, in seconds. | ||||
|    */ | ||||
|   function __construct(int $id, int $time) { | ||||
|     $this->id = $id; | ||||
|     $this->setTime($time); | ||||
|   } | ||||
|     /** | ||||
|      * Creates a new entry. | ||||
|      * @param int $id The entry identifier. | ||||
|      * @param int $time The elapsed time, in seconds. | ||||
|      */ | ||||
|     function __construct(int $id, int $time) { | ||||
|         $this->id = $id; | ||||
|         $this->setTime($time); | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Creates a new entry from the specified JSON map. | ||||
|    * @param object $map A JSON map representing an entry. | ||||
|    * @return static The instance corresponding to the specified JSON map. | ||||
|    */ | ||||
|   static function fromJson(object $map): self { | ||||
|     return (new static(isset($map->id) && is_int($map->id) ? $map->id : -1, isset($map->time) && is_int($map->time) ? $map->time : 0)) | ||||
|       ->setCreatedAt(isset($map->created) && is_string($map->created) ? new \DateTime($map->created) : null) | ||||
|       ->setIssueId(isset($map->issue_id) && is_int($map->issue_id) ? $map->issue_id : -1) | ||||
|       ->setUserId(isset($map->user_id) && is_int($map->user_id) ? $map->user_id : -1); | ||||
|   } | ||||
|     /** | ||||
|      * Creates a new entry from the specified JSON map. | ||||
|      * @param object $map A JSON map representing an entry. | ||||
|      * @return static The instance corresponding to the specified JSON map. | ||||
|      */ | ||||
|     static function fromJson(object $map): self { | ||||
|         return (new static(isset($map->id) && is_int($map->id) ? $map->id : -1, isset($map->time) && is_int($map->time) ? $map->time : 0)) | ||||
|             ->setCreatedAt(isset($map->created) && is_string($map->created) ? new \DateTime($map->created) : null) | ||||
|             ->setIssueId(isset($map->issue_id) && is_int($map->issue_id) ? $map->issue_id : -1) | ||||
|             ->setUserId(isset($map->user_id) && is_int($map->user_id) ? $map->user_id : -1); | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the date the entry was created. | ||||
|    * @return \DateTime|null The date the entry was created. | ||||
|    */ | ||||
|   function getCreatedAt(): ?\DateTime { | ||||
|     return $this->createdAt; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the date the entry was created. | ||||
|      * @return \DateTime|null The date the entry was created. | ||||
|      */ | ||||
|     function getCreatedAt(): ?\DateTime { | ||||
|         return $this->createdAt; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the entry identifier. | ||||
|    * @return int The entry identifier. | ||||
|    */ | ||||
|   function getId(): int { | ||||
|     return $this->id; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the entry identifier. | ||||
|      * @return int The entry identifier. | ||||
|      */ | ||||
|     function getId(): int { | ||||
|         return $this->id; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the identifier of the associated issue or pull request. | ||||
|    * @return int The identifier of the associated issue or pull request. | ||||
|    */ | ||||
|   function getIssueId(): int { | ||||
|     return $this->issueId; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the identifier of the associated issue or pull request. | ||||
|      * @return int The identifier of the associated issue or pull request. | ||||
|      */ | ||||
|     function getIssueId(): int { | ||||
|         return $this->issueId; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the elapsed time, in seconds. | ||||
|    * @return int The elapsed time, in seconds. | ||||
|    */ | ||||
|   function getTime(): int { | ||||
|     return $this->time; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the elapsed time, in seconds. | ||||
|      * @return int The elapsed time, in seconds. | ||||
|      */ | ||||
|     function getTime(): int { | ||||
|         return $this->time; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the identifier of the initiating user. | ||||
|    * @return int The identifier of the initiating user. | ||||
|    */ | ||||
|   function getUserId(): int { | ||||
|     return $this->userId; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the identifier of the initiating user. | ||||
|      * @return int The identifier of the initiating user. | ||||
|      */ | ||||
|     function getUserId(): int { | ||||
|         return $this->userId; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Converts this object to a map in JSON format. | ||||
|    * @return \stdClass The map in JSON format corresponding to this object. | ||||
|    */ | ||||
|   function jsonSerialize(): \stdClass { | ||||
|     return (object) [ | ||||
|       'created' => ($date = $this->getCreatedAt()) ? $date->format('c') : null, | ||||
|       'id' => $this->getId(), | ||||
|       'issue_id' => $this->getIssueId(), | ||||
|       'time' => $this->getTime(), | ||||
|       'user_id' => $this->getUserId() | ||||
|     ]; | ||||
|   } | ||||
|     /** | ||||
|      * Converts this object to a map in JSON format. | ||||
|      * @return \stdClass The map in JSON format corresponding to this object. | ||||
|      */ | ||||
|     function jsonSerialize(): \stdClass { | ||||
|         return (object) [ | ||||
|             'created' => ($date = $this->getCreatedAt()) ? $date->format('c') : null, | ||||
|             'id' => $this->getId(), | ||||
|             'issue_id' => $this->getIssueId(), | ||||
|             'time' => $this->getTime(), | ||||
|             'user_id' => $this->getUserId() | ||||
|         ]; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the date the entry was created. | ||||
|    * @param \DateTime|null $value The new date of creation. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setCreatedAt(?\DateTime $value): self { | ||||
|     $this->createdAt = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the date the entry was created. | ||||
|      * @param \DateTime|null $value The new date of creation. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setCreatedAt(?\DateTime $value): self { | ||||
|         $this->createdAt = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the identifier of the associated issue or pull request. | ||||
|    * @param int $value The new issue identifier. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setIssueId(int $value): self { | ||||
|     $this->issueId = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the identifier of the associated issue or pull request. | ||||
|      * @param int $value The new issue identifier. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setIssueId(int $value): self { | ||||
|         $this->issueId = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the elapsed time, in seconds. | ||||
|    * @param int $value The new elapsed time, in seconds. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setTime(int $value): self { | ||||
|     $this->time = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the elapsed time, in seconds. | ||||
|      * @param int $value The new elapsed time, in seconds. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setTime(int $value): self { | ||||
|         $this->time = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the identifier of the initiating user. | ||||
|    * @param int $value The new user identifier. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setUserId(int $value): self { | ||||
|     $this->userId = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the identifier of the initiating user. | ||||
|      * @param int $value The new user identifier. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setUserId(int $value): self { | ||||
|         $this->userId = $value; | ||||
|         return $this; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| <?php declare(strict_types=1); | ||||
| namespace Gitea\Models; | ||||
| namespace Gitea\Model; | ||||
|  | ||||
| use GuzzleHttp\Psr7\{Uri}; | ||||
| use Psr\Http\Message\{UriInterface}; | ||||
| @ -7,157 +7,157 @@ use Psr\Http\Message\{UriInterface}; | ||||
| /** Represents a Gitea user. */ | ||||
| class User implements \JsonSerializable { | ||||
|  | ||||
|   /** @var UriInterface|null The URL to the user's avatar. */ | ||||
|   private $avatarUrl; | ||||
|     /** @var UriInterface|null The URL to the user's avatar. */ | ||||
|     private $avatarUrl; | ||||
|  | ||||
|   /** @var string The mail address. */ | ||||
|   private $email = ''; | ||||
|     /** @var string The mail address. */ | ||||
|     private $email = ''; | ||||
|  | ||||
|   /** @var string The full name. */ | ||||
|   private $fullName = ''; | ||||
|     /** @var string The full name. */ | ||||
|     private $fullName = ''; | ||||
|  | ||||
|   /** @var int The user identifier. */ | ||||
|   private $id; | ||||
|     /** @var int The user identifier. */ | ||||
|     private $id; | ||||
|  | ||||
|   /** @var string The user locale. */ | ||||
|   private $language = ''; | ||||
|     /** @var string The user locale. */ | ||||
|     private $language = ''; | ||||
|  | ||||
|   /** @var string The name of the Gitea account. */ | ||||
|   private $login; | ||||
|     /** @var string The name of the Gitea account. */ | ||||
|     private $login; | ||||
|  | ||||
|   /** | ||||
|    * Creates a new user. | ||||
|    * @param int $id The user identifier. | ||||
|    * @param string $login The name of the Gitea account. | ||||
|    */ | ||||
|   function __construct(int $id, string $login) { | ||||
|     $this->id = $id; | ||||
|     $this->setLogin($login); | ||||
|   } | ||||
|     /** | ||||
|      * Creates a new user. | ||||
|      * @param int $id The user identifier. | ||||
|      * @param string $login The name of the Gitea account. | ||||
|      */ | ||||
|     function __construct(int $id, string $login) { | ||||
|         $this->id = $id; | ||||
|         $this->setLogin($login); | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Creates a new user from the specified JSON map. | ||||
|    * @param object $map A JSON map representing a user. | ||||
|    * @return static The instance corresponding to the specified JSON map. | ||||
|    */ | ||||
|   static function fromJson(object $map): self { | ||||
|     return (new static(isset($map->id) && is_int($map->id) ? $map->id : -1, isset($map->login) && is_string($map->login) ? $map->login : '')) | ||||
|       ->setAvatarUrl(isset($map->avatar_url) && is_string($map->avatar_url) ? new Uri($map->avatar_url) : null) | ||||
|       ->setEmail(isset($map->email) && is_string($map->email) ? mb_strtolower($map->email) : '') | ||||
|       ->setFullName(isset($map->full_name) && is_string($map->full_name) ? $map->full_name : '') | ||||
|       ->setLanguage(isset($map->language) && is_string($map->language) ? $map->language : ''); | ||||
|   } | ||||
|     /** | ||||
|      * Creates a new user from the specified JSON map. | ||||
|      * @param object $map A JSON map representing a user. | ||||
|      * @return static The instance corresponding to the specified JSON map. | ||||
|      */ | ||||
|     static function fromJson(object $map): self { | ||||
|         return (new static(isset($map->id) && is_int($map->id) ? $map->id : -1, isset($map->login) && is_string($map->login) ? $map->login : '')) | ||||
|             ->setAvatarUrl(isset($map->avatar_url) && is_string($map->avatar_url) ? new Uri($map->avatar_url) : null) | ||||
|             ->setEmail(isset($map->email) && is_string($map->email) ? mb_strtolower($map->email) : '') | ||||
|             ->setFullName(isset($map->full_name) && is_string($map->full_name) ? $map->full_name : '') | ||||
|             ->setLanguage(isset($map->language) && is_string($map->language) ? $map->language : ''); | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the URL of the avatar image. | ||||
|    * @return UriInterface|null The URL of the avatar image. | ||||
|    */ | ||||
|   function getAvatarUrl(): ?UriInterface { | ||||
|     return $this->avatarUrl; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the URL of the avatar image. | ||||
|      * @return UriInterface|null The URL of the avatar image. | ||||
|      */ | ||||
|     function getAvatarUrl(): ?UriInterface { | ||||
|         return $this->avatarUrl; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the mail address. | ||||
|    * @return string The mail address. | ||||
|    */ | ||||
|   function getEmail(): string { | ||||
|     return $this->email; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the mail address. | ||||
|      * @return string The mail address. | ||||
|      */ | ||||
|     function getEmail(): string { | ||||
|         return $this->email; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the full name. | ||||
|    * @return string The full name. | ||||
|    */ | ||||
|   function getFullName(): string { | ||||
|     return $this->fullName; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the full name. | ||||
|      * @return string The full name. | ||||
|      */ | ||||
|     function getFullName(): string { | ||||
|         return $this->fullName; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the user identifier. | ||||
|    * @return int The user identifier. | ||||
|    */ | ||||
|   function getId(): int { | ||||
|     return $this->id; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the user identifier. | ||||
|      * @return int The user identifier. | ||||
|      */ | ||||
|     function getId(): int { | ||||
|         return $this->id; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the user locale. | ||||
|    * @return string The user locale. | ||||
|    */ | ||||
|   function getLanguage(): string { | ||||
|     return $this->language; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the user locale. | ||||
|      * @return string The user locale. | ||||
|      */ | ||||
|     function getLanguage(): string { | ||||
|         return $this->language; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the name of the Gitea account. | ||||
|    * @return string The name of the Gitea account. | ||||
|    */ | ||||
|   function getLogin(): string { | ||||
|     return $this->login; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the name of the Gitea account. | ||||
|      * @return string The name of the Gitea account. | ||||
|      */ | ||||
|     function getLogin(): string { | ||||
|         return $this->login; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Converts this object to a map in JSON format. | ||||
|    * @return \stdClass The map in JSON format corresponding to this object. | ||||
|    */ | ||||
|   function jsonSerialize(): \stdClass { | ||||
|     return (object) [ | ||||
|       'avatar_url' => ($url = $this->getAvatarUrl()) ? (string) $url : null, | ||||
|       'email' => $this->getEmail(), | ||||
|       'full_name' => $this->getFullName(), | ||||
|       'id' => $this->getId(), | ||||
|       'language' => $this->getLanguage(), | ||||
|       'login' => $this->getLogin() | ||||
|     ]; | ||||
|   } | ||||
|     /** | ||||
|      * Converts this object to a map in JSON format. | ||||
|      * @return \stdClass The map in JSON format corresponding to this object. | ||||
|      */ | ||||
|     function jsonSerialize(): \stdClass { | ||||
|         return (object) [ | ||||
|             'avatar_url' => ($url = $this->getAvatarUrl()) ? (string) $url : null, | ||||
|             'email' => $this->getEmail(), | ||||
|             'full_name' => $this->getFullName(), | ||||
|             'id' => $this->getId(), | ||||
|             'language' => $this->getLanguage(), | ||||
|             'login' => $this->getLogin() | ||||
|         ]; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the URL of the avatar image. | ||||
|    * @param UriInterface|null $value The new avatar URL. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setAvatarUrl(?UriInterface $value): self { | ||||
|     $this->avatarUrl = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the URL of the avatar image. | ||||
|      * @param UriInterface|null $value The new avatar URL. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setAvatarUrl(?UriInterface $value): self { | ||||
|         $this->avatarUrl = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the mail address. | ||||
|    * @param string $value The new mail address. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setEmail(string $value): self { | ||||
|     $this->email = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the mail address. | ||||
|      * @param string $value The new mail address. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setEmail(string $value): self { | ||||
|         $this->email = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the full name. | ||||
|    * @param string $value The new full name. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setFullName(string $value): self { | ||||
|     $this->fullName = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the full name. | ||||
|      * @param string $value The new full name. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setFullName(string $value): self { | ||||
|         $this->fullName = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the user locale. | ||||
|    * @param string $value The new user locale. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setLanguage(string $value): self { | ||||
|     $this->language = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the user locale. | ||||
|      * @param string $value The new user locale. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setLanguage(string $value): self { | ||||
|         $this->language = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the name of the Gitea account. | ||||
|    * @param string $value The new Gitea account. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setLogin(string $value): self { | ||||
|     $this->login = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the name of the Gitea account. | ||||
|      * @param string $value The new Gitea account. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setLogin(string $value): self { | ||||
|         $this->login = $value; | ||||
|         return $this; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -8,232 +8,232 @@ use Psr\Http\Message\{UriInterface}; | ||||
| /** Represents a Gitea push event. */ | ||||
| class PushEvent implements \JsonSerializable { | ||||
|  | ||||
|   /** @var string The hash of the new Git revision. */ | ||||
|   private $after = ''; | ||||
|     /** @var string The hash of the new Git revision. */ | ||||
|     private $after = ''; | ||||
|  | ||||
|   /** @var string The hash of the previous Git revision. */ | ||||
|   private $before = ''; | ||||
|     /** @var string The hash of the previous Git revision. */ | ||||
|     private $before = ''; | ||||
|  | ||||
|   /** @var \ArrayObject The revision commits. */ | ||||
|   private $commits; | ||||
|     /** @var \ArrayObject The revision commits. */ | ||||
|     private $commits; | ||||
|  | ||||
|   /** @var UriInterface|null The URL for comparing the revisions. */ | ||||
|   private $compareUrl; | ||||
|     /** @var UriInterface|null The URL for comparing the revisions. */ | ||||
|     private $compareUrl; | ||||
|  | ||||
|   /** @var User|null The user who pushed the commits. */ | ||||
|   private $pusher; | ||||
|     /** @var User|null The user who pushed the commits. */ | ||||
|     private $pusher; | ||||
|  | ||||
|   /** @var string The Git reference. */ | ||||
|   private $ref = ''; | ||||
|     /** @var string The Git reference. */ | ||||
|     private $ref = ''; | ||||
|  | ||||
|   /** @var Repository|null The repository where the commits were pushed. */ | ||||
|   private $repository; | ||||
|     /** @var Repository|null The repository where the commits were pushed. */ | ||||
|     private $repository; | ||||
|  | ||||
|   /** @var string The secret used to validate this event. */ | ||||
|   private $secret = ''; | ||||
|     /** @var string The secret used to validate this event. */ | ||||
|     private $secret = ''; | ||||
|  | ||||
|   /** @var User|null The user who sent this event. */ | ||||
|   private $sender; | ||||
|     /** @var User|null The user who sent this event. */ | ||||
|     private $sender; | ||||
|  | ||||
|   /** Creates a new event. */ | ||||
|   function __construct() { | ||||
|     $this->commits = new \ArrayObject; | ||||
|   } | ||||
|     /** Creates a new event. */ | ||||
|     function __construct() { | ||||
|         $this->commits = new \ArrayObject; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Creates a new event from the specified JSON map. | ||||
|    * @param object $map A JSON map representing an event. | ||||
|    * @return static The instance corresponding to the specified JSON map. | ||||
|    */ | ||||
|   static function fromJson(object $map): self { | ||||
|     return (new static) | ||||
|       ->setAfter(isset($map->after) && is_string($map->after) ? $map->after : '') | ||||
|       ->setBefore(isset($map->before) && is_string($map->before) ? $map->before : '') | ||||
|       ->setCompareUrl(isset($map->compare_url) && is_string($map->compare_url) ? new Uri($map->compare_url) : null) | ||||
|       ->setCommits(isset($map->commits) && is_array($map->commits) ? array_map([PayloadCommit::class, 'fromJson'], $map->commits) : []) | ||||
|       ->setPusher(isset($map->pusher) && is_object($map->pusher) ? User::fromJson($map->pusher) : null) | ||||
|       ->setRef(isset($map->ref) && is_string($map->ref) ? $map->ref : '') | ||||
|       ->setRepository(isset($map->repository) && is_object($map->repository) ? Repository::fromJson($map->repository) : null) | ||||
|       ->setSecret(isset($map->secret) && is_string($map->secret) ? $map->secret : '') | ||||
|       ->setSender(isset($map->sender) && is_object($map->sender) ? User::fromJson($map->sender) : null); | ||||
|   } | ||||
|     /** | ||||
|      * Creates a new event from the specified JSON map. | ||||
|      * @param object $map A JSON map representing an event. | ||||
|      * @return static The instance corresponding to the specified JSON map. | ||||
|      */ | ||||
|     static function fromJson(object $map): self { | ||||
|         return (new static) | ||||
|             ->setAfter(isset($map->after) && is_string($map->after) ? $map->after : '') | ||||
|             ->setBefore(isset($map->before) && is_string($map->before) ? $map->before : '') | ||||
|             ->setCompareUrl(isset($map->compare_url) && is_string($map->compare_url) ? new Uri($map->compare_url) : null) | ||||
|             ->setCommits(isset($map->commits) && is_array($map->commits) ? array_map([PayloadCommit::class, 'fromJson'], $map->commits) : []) | ||||
|             ->setPusher(isset($map->pusher) && is_object($map->pusher) ? User::fromJson($map->pusher) : null) | ||||
|             ->setRef(isset($map->ref) && is_string($map->ref) ? $map->ref : '') | ||||
|             ->setRepository(isset($map->repository) && is_object($map->repository) ? Repository::fromJson($map->repository) : null) | ||||
|             ->setSecret(isset($map->secret) && is_string($map->secret) ? $map->secret : '') | ||||
|             ->setSender(isset($map->sender) && is_object($map->sender) ? User::fromJson($map->sender) : null); | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the hash of the new Git revision. | ||||
|    * @return string The hash of the new Git revision. | ||||
|    */ | ||||
|   function getAfter(): string { | ||||
|     return $this->after; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the hash of the new Git revision. | ||||
|      * @return string The hash of the new Git revision. | ||||
|      */ | ||||
|     function getAfter(): string { | ||||
|         return $this->after; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the hash of the new previous revision. | ||||
|    * @return string The hash of the previous Git revision. | ||||
|    */ | ||||
|   function getBefore(): string { | ||||
|     return $this->before; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the hash of the new previous revision. | ||||
|      * @return string The hash of the previous Git revision. | ||||
|      */ | ||||
|     function getBefore(): string { | ||||
|         return $this->before; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the revision commits. | ||||
|    * @return \ArrayObject The revision commits. | ||||
|    */ | ||||
|   function getCommits(): \ArrayObject { | ||||
|     return $this->commits; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the revision commits. | ||||
|      * @return \ArrayObject The revision commits. | ||||
|      */ | ||||
|     function getCommits(): \ArrayObject { | ||||
|         return $this->commits; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the URL for comparing the revisions. | ||||
|    * @return UriInterface|null The URL for comparing the revisions. | ||||
|    */ | ||||
|   function getCompareUrl(): ?UriInterface { | ||||
|     return $this->compareUrl; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the URL for comparing the revisions. | ||||
|      * @return UriInterface|null The URL for comparing the revisions. | ||||
|      */ | ||||
|     function getCompareUrl(): ?UriInterface { | ||||
|         return $this->compareUrl; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the user who pushed the commits. | ||||
|    * @return User|null The user who pushed the commits. | ||||
|    */ | ||||
|   function getPusher(): ?User { | ||||
|     return $this->pusher; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the user who pushed the commits. | ||||
|      * @return User|null The user who pushed the commits. | ||||
|      */ | ||||
|     function getPusher(): ?User { | ||||
|         return $this->pusher; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the Git reference. | ||||
|    * @return string The Git reference. | ||||
|    */ | ||||
|   function getRef(): string { | ||||
|     return $this->ref; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the Git reference. | ||||
|      * @return string The Git reference. | ||||
|      */ | ||||
|     function getRef(): string { | ||||
|         return $this->ref; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the repository where the commits were pushed. | ||||
|    * @return Repository|null The repository where the commits were pushed. | ||||
|    */ | ||||
|   function getRepository(): ?Repository { | ||||
|     return $this->repository; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the repository where the commits were pushed. | ||||
|      * @return Repository|null The repository where the commits were pushed. | ||||
|      */ | ||||
|     function getRepository(): ?Repository { | ||||
|         return $this->repository; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the secret used to validate this event. | ||||
|    * @return string The secret used to validate this event. | ||||
|    */ | ||||
|   function getSecret(): string { | ||||
|     return $this->secret; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the secret used to validate this event. | ||||
|      * @return string The secret used to validate this event. | ||||
|      */ | ||||
|     function getSecret(): string { | ||||
|         return $this->secret; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Gets the user who sent this event. | ||||
|    * @return User|null The user who sent this event. | ||||
|    */ | ||||
|   function getSender(): ?User { | ||||
|     return $this->sender; | ||||
|   } | ||||
|     /** | ||||
|      * Gets the user who sent this event. | ||||
|      * @return User|null The user who sent this event. | ||||
|      */ | ||||
|     function getSender(): ?User { | ||||
|         return $this->sender; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Converts this object to a map in JSON format. | ||||
|    * @return \stdClass The map in JSON format corresponding to this object. | ||||
|    */ | ||||
|   function jsonSerialize(): \stdClass { | ||||
|     return (object) [ | ||||
|       'after' => $this->getAfter(), | ||||
|       'before' => $this->getBefore(), | ||||
|       'compare_url' => ($url = $this->getCompareUrl()) ? (string) $url : null, | ||||
|       'commits' => array_map(function(PayloadCommit $commit) { return $commit->jsonSerialize(); }, $this->getCommits()->getArrayCopy()), | ||||
|       'pusher' => ($user = $this->getPusher()) ? $user->jsonSerialize() : null, | ||||
|       'ref' => $this->getRef(), | ||||
|       'repository' => ($repository = $this->getRepository()) ? $repository->jsonSerialize() : null, | ||||
|       'sender' => ($user = $this->getSender()) ? $user->jsonSerialize() : null | ||||
|     ]; | ||||
|   } | ||||
|     /** | ||||
|      * Converts this object to a map in JSON format. | ||||
|      * @return \stdClass The map in JSON format corresponding to this object. | ||||
|      */ | ||||
|     function jsonSerialize(): \stdClass { | ||||
|         return (object) [ | ||||
|             'after' => $this->getAfter(), | ||||
|             'before' => $this->getBefore(), | ||||
|             'compare_url' => ($url = $this->getCompareUrl()) ? (string) $url : null, | ||||
|             'commits' => array_map(function(PayloadCommit $commit) { return $commit->jsonSerialize(); }, $this->getCommits()->getArrayCopy()), | ||||
|             'pusher' => ($user = $this->getPusher()) ? $user->jsonSerialize() : null, | ||||
|             'ref' => $this->getRef(), | ||||
|             'repository' => ($repository = $this->getRepository()) ? $repository->jsonSerialize() : null, | ||||
|             'sender' => ($user = $this->getSender()) ? $user->jsonSerialize() : null | ||||
|         ]; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the hash of the new Git revision. | ||||
|    * @param string $value The hash of the new Git revision. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setAfter(string $value): self { | ||||
|     $this->after = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the hash of the new Git revision. | ||||
|      * @param string $value The hash of the new Git revision. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setAfter(string $value): self { | ||||
|         $this->after = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the hash of the new previous revision. | ||||
|    * @param string $value The hash of the new previous revision. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setBefore(string $value): self { | ||||
|     $this->before = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the hash of the new previous revision. | ||||
|      * @param string $value The hash of the new previous revision. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setBefore(string $value): self { | ||||
|         $this->before = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the revision commits. | ||||
|    * @param PayloadCommit[] $values The revision commits. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setCommits(array $values): self { | ||||
|     $this->getCommits()->exchangeArray($values); | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the revision commits. | ||||
|      * @param PayloadCommit[] $values The revision commits. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setCommits(array $values): self { | ||||
|         $this->getCommits()->exchangeArray($values); | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the URL for comparing the revisions. | ||||
|    * @param UriInterface|null $value The URL for comparing the revisions. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setCompareUrl(?UriInterface $value): self { | ||||
|     $this->compareUrl = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the URL for comparing the revisions. | ||||
|      * @param UriInterface|null $value The URL for comparing the revisions. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setCompareUrl(?UriInterface $value): self { | ||||
|         $this->compareUrl = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the user who pushed the commits. | ||||
|    * @param User|null $value The new pusher. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setPusher(?User $value): self { | ||||
|     $this->pusher = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the user who pushed the commits. | ||||
|      * @param User|null $value The new pusher. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setPusher(?User $value): self { | ||||
|         $this->pusher = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the Git reference. | ||||
|    * @param string $value The new Git reference. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setRef(string $value): self { | ||||
|     $this->ref = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the Git reference. | ||||
|      * @param string $value The new Git reference. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setRef(string $value): self { | ||||
|         $this->ref = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the repository where the commits were pushed. | ||||
|    * @param Repository|null $value The new repository. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setRepository(?Repository $value): self { | ||||
|     $this->repository = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the repository where the commits were pushed. | ||||
|      * @param Repository|null $value The new repository. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setRepository(?Repository $value): self { | ||||
|         $this->repository = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the secret used to validate this event. | ||||
|    * @param string $value The new secret used to validate this event. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setSecret(string $value): self { | ||||
|     $this->secret = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the secret used to validate this event. | ||||
|      * @param string $value The new secret used to validate this event. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setSecret(string $value): self { | ||||
|         $this->secret = $value; | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
|   /** | ||||
|    * Sets the user who sent this event. | ||||
|    * @param User|null $value The new sender. | ||||
|    * @return $this This instance. | ||||
|    */ | ||||
|   function setSender(?User $value): self { | ||||
|     $this->sender = $value; | ||||
|     return $this; | ||||
|   } | ||||
|     /** | ||||
|      * Sets the user who sent this event. | ||||
|      * @param User|null $value The new sender. | ||||
|      * @return $this This instance. | ||||
|      */ | ||||
|     function setSender(?User $value): self { | ||||
|         $this->sender = $value; | ||||
|         return $this; | ||||
|     } | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user