Finalized the replacement of public properties by getters/setters

This commit is contained in:
Cédric Belin
2018-11-09 09:46:49 +01:00
parent 9a6599903d
commit e0c6a581d7

View File

@ -74,11 +74,11 @@ class PushEvent implements \JsonSerializable {
->setBefore(isset($map->before) && is_string($map->before) ? $map->before : '') ->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) ->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) : []) ->setCommits(isset($map->commits) && is_array($map->commits) ? array_map([PayloadCommit::class, 'fromJson'], $map->commits) : [])
// TODO: 'pusher' => isset($map->pusher) && is_object($map->pusher) ? User::fromJson($map->pusher) : null) ->setPusher(isset($map->pusher) && is_object($map->pusher) ? User::fromJson($map->pusher) : null)
->setRef(isset($map->ref) && is_string($map->ref) ? $map->ref : '') ->setRef(isset($map->ref) && is_string($map->ref) ? $map->ref : '')
// TODO: 'repository' => isset($map->repository) && is_object($map->repository) ? Repository::fromJson($map->repository) : null) ->setRepository(isset($map->repository) && is_object($map->repository) ? Repository::fromJson($map->repository) : null)
->setSecret(isset($map->secret) && is_string($map->secret) ? $map->secret : ''); ->setSecret(isset($map->secret) && is_string($map->secret) ? $map->secret : '')
// TODO: 'sender' => isset($map->sender) && is_object($map->sender) ? User::fromJson($map->sender) : null): ->setSender(isset($map->sender) && is_object($map->sender) ? User::fromJson($map->sender) : null);
} }
/** /**
@ -113,6 +113,14 @@ class PushEvent implements \JsonSerializable {
return $this->compareUrl; 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 Git reference. * Gets the Git reference.
* @return string The Git reference. * @return string The Git reference.
@ -121,6 +129,14 @@ class PushEvent implements \JsonSerializable {
return $this->ref; 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 secret used to validate this event. * Gets the secret used to validate this event.
* @return string The secret used to validate this event. * @return string The secret used to validate this event.
@ -129,6 +145,14 @@ class PushEvent implements \JsonSerializable {
return $this->secret; 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;
}
/** /**
* Converts this object to a map in JSON format. * Converts this object to a map in JSON format.
* @return \stdClass The map in JSON format corresponding to this object. * @return \stdClass The map in JSON format corresponding to this object.
@ -186,6 +210,16 @@ class PushEvent implements \JsonSerializable {
return $this; 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. * Sets the Git reference.
* @param string $value The new Git reference. * @param string $value The new Git reference.
@ -196,6 +230,16 @@ class PushEvent implements \JsonSerializable {
return $this; 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. * Sets the secret used to validate this event.
* @param string $value The new secret used to validate this event. * @param string $value The new secret used to validate this event.
@ -205,4 +249,14 @@ class PushEvent implements \JsonSerializable {
$this->secret = $value; $this->secret = $value;
return $this; 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;
}
} }