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