Fixed the JSON serialization of the Repository class

This commit is contained in:
Cédric Belin
2018-11-22 20:13:18 +01:00
parent 1d5b9092e3
commit 45cb20e939

View File

@ -367,26 +367,26 @@ class Repository implements \JsonSerializable {
return (object) [ return (object) [
'clone_url' => ($url = $this->getCloneUrl()) ? (string) $url : null, 'clone_url' => ($url = $this->getCloneUrl()) ? (string) $url : null,
'created_at' => ($date = $this->getCreatedAt()) ? $date->format('c') : null, 'created_at' => ($date = $this->getCreatedAt()) ? $date->format('c') : null,
'default_branch' => 'defaultBranch', 'default_branch' => $this->getDefaultBranch(),
'description', 'description' => $this->getDescription(),
'empty' => 'isEmpty', 'empty' => $this->isEmpty(),
'fork' => 'isFork', 'fork' => $this->isFork(),
'forks_count' => 'forksCount', 'forks_count' => $this->getForksCount(),
'full_name' => 'fullName', 'full_name' => $this->getFullName(),
'html_url' => ($url = $this->getHtmlUrl()) ? (string) $url : null, 'html_url' => ($url = $this->getHtmlUrl()) ? (string) $url : null,
'id', 'id' => $this->getId(),
'mirror' => 'isMirror', 'mirror' => $this->isMirror(),
'name', 'name' => $this->getName(),
'open_issues_count' => 'openIssuesCount', 'open_issues_count' => $this->getOpenIssuesCount(),
'owner', 'owner' => ($user = $this->getOwner()) ? $user->jsonSerialize() : null,
'parent', 'parent' => ($repository = $this->getParent()) ? $repository->jsonSerialize() : null,
'permissions', 'permissions' => ($perms = $this->getPermissions()) ? $perms->jsonSerialize() : null,
'private' => 'isPrivate', 'private' => $this->isPrivate(),
'size', 'size' => $this->getSize(),
'ssh_url' => ($url = $this->getSshUrl()) ? (string) $url : null, 'ssh_url' => ($url = $this->getSshUrl()) ? (string) $url : null,
'stars_count' => 'starsCount', 'stars_count' => $this->getStarsCount(),
'updated_at' => ($date = $this->getUpdatedAt()) ? $date->format('c') : null, 'updated_at' => ($date = $this->getUpdatedAt()) ? $date->format('c') : null,
'watchers_count' => 'watchersCount', 'watchers_count' => $this->getWatchersCount(),
'website' => ($url = $this->getWebsite()) ? (string) $url : null, 'website' => ($url = $this->getWebsite()) ? (string) $url : null,
]; ];
} }