Skip to content

Commit ff65692

Browse files
committed
Another round of PHPCS adjustments
1 parent 75c56a8 commit ff65692

13 files changed

Lines changed: 68 additions & 72 deletions

File tree

src/AbstractPackage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function __get($name)
4848
{
4949
$class = '\\Joomla\\Github\\Package\\' . $this->package . '\\' . ucfirst($name);
5050

51-
if (false == class_exists($class))
51+
if (class_exists($class) == false)
5252
{
5353
throw new \InvalidArgumentException(
5454
sprintf(
@@ -58,7 +58,7 @@ public function __get($name)
5858
);
5959
}
6060

61-
if (false == isset($this->$name))
61+
if (isset($this->$name) == false)
6262
{
6363
$this->$name = new $class($this->options, $this->client);
6464
}

src/Github.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function __get($name)
9090

9191
if (class_exists($class))
9292
{
93-
if (false == isset($this->$name))
93+
if (isset($this->$name) == false)
9494
{
9595
$this->$name = new $class($this->options, $this->client);
9696
}

src/Package/Issues.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ public function get($user, $repo, $issueId)
200200
* @since 1.0
201201
* @throws \DomainException
202202
*/
203-
public function getList($filter = null, $state = null, $labels = null, $sort = null,
204-
$direction = null, \DateTime $since = null, $page = 0, $limit = 0
203+
public function getList($filter = null, $state = null, $labels = null, $sort = null, $direction = null, \DateTime $since = null, $page = 0,
204+
$limit = 0
205205
)
206206
{
207207
// Build the request path.

src/Package/Issues/Assignees.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function check($owner, $repo, $assignee)
6868
{
6969
$response = $this->client->get($this->fetchUrl($path));
7070

71-
if (204 == $response->code)
71+
if ($response->code == 204)
7272
{
7373
return true;
7474
}
@@ -77,7 +77,7 @@ public function check($owner, $repo, $assignee)
7777
}
7878
catch (\DomainException $e)
7979
{
80-
if (isset($response->code) && 404 == $response->code)
80+
if (isset($response->code) && $response->code == 404)
8181
{
8282
return false;
8383
}

src/Package/Issues/Comments.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function getRepositoryList($owner, $repo, $sort = 'created', $direction =
7474
// Build the request path.
7575
$path = '/repos/' . $owner . '/' . $repo . '/issues/comments';
7676

77-
if (false == \in_array($sort, array('created', 'updated')))
77+
if (\in_array($sort, array('created', 'updated')) == false)
7878
{
7979
throw new \UnexpectedValueException(
8080
sprintf(
@@ -83,7 +83,7 @@ public function getRepositoryList($owner, $repo, $sort = 'created', $direction =
8383
);
8484
}
8585

86-
if (false == \in_array($direction, array('asc', 'desc')))
86+
if (\in_array($direction, array('asc', 'desc')) == false)
8787
{
8888
throw new \UnexpectedValueException(
8989
sprintf(

src/Package/Orgs/Hooks.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function create($org, $url, $contentType = 'form', $secret = null, $insec
8585
// Build the request path.
8686
$path = "/orgs/$org/hooks";
8787

88-
if (false == \in_array($contentType, array('form', 'json')))
88+
if (\in_array($contentType, array('form', 'json')) == false)
8989
{
9090
throw new \UnexpectedValueException('Content type must be either "form" or "json".');
9191
}
@@ -157,7 +157,7 @@ public function edit($org, $url, $contentType = null, $secret = null, $insecureS
157157

158158
if ($contentType)
159159
{
160-
if (false == \in_array($contentType, array('form', 'json')))
160+
if (\in_array($contentType, array('form', 'json')) == false)
161161
{
162162
throw new \UnexpectedValueException('Content type must be either "form" or "json".');
163163
}

src/Package/Orgs/Teams.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function create($org, $name, array $repoNames = array(), $permission = ''
9494

9595
if ($permission)
9696
{
97-
if (false == \in_array($permission, array('pull', 'push', 'admin')))
97+
if (\in_array($permission, array('pull', 'push', 'admin')) == false)
9898
{
9999
throw new \UnexpectedValueException('Permissions must be either "pull", "push", or "admin".');
100100
}
@@ -136,7 +136,7 @@ public function edit($id, $name, $permission = '')
136136

137137
if ($permission)
138138
{
139-
if (false == \in_array($permission, array('pull', 'push', 'admin')))
139+
if (\in_array($permission, array('pull', 'push', 'admin')) == false)
140140
{
141141
throw new \UnexpectedValueException('Permissions must be either "pull", "push", or "admin".');
142142
}
@@ -337,7 +337,7 @@ public function addTeamMembership($id, $user, $role = 'member')
337337
// Build the request path.
338338
$path = "/teams/$id/memberships/$user";
339339

340-
if (false == \in_array($role, array('member', 'maintainer')))
340+
if (\in_array($role, array('member', 'maintainer')) == false)
341341
{
342342
throw new \UnexpectedValueException('Roles must be either "member" or "maintainer".');
343343
}

src/Package/Repositories.php

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,20 @@ class Repositories extends AbstractPackage
5252
*/
5353
public function getListOwn($type = 'all', $sort = 'full_name', $direction = '')
5454
{
55-
if (false == \in_array($type, array('all', 'owner', 'public', 'private', 'member')))
55+
if (\in_array($type, array('all', 'owner', 'public', 'private', 'member')) == false)
5656
{
5757
throw new \RuntimeException('Invalid type');
5858
}
5959

60-
if (false == \in_array($sort, array('created', 'updated', 'pushed', 'full_name')))
60+
if (\in_array($sort, array('created', 'updated', 'pushed', 'full_name')) == false)
6161
{
6262
throw new \RuntimeException('Invalid sort field');
6363
}
6464

6565
// Sort direction default: when using full_name: asc, otherwise desc.
66-
$direction = ($direction) ? : (('full_name' == $sort) ? 'asc' : 'desc');
66+
$direction = ($direction) ? : (($sort == 'full_name') ? 'asc' : 'desc');
6767

68-
if (false == \in_array($direction, array('asc', 'desc')))
68+
if (\in_array($direction, array('asc', 'desc')) == false)
6969
{
7070
throw new \RuntimeException('Invalid sort order');
7171
}
@@ -97,20 +97,20 @@ public function getListOwn($type = 'all', $sort = 'full_name', $direction = '')
9797
*/
9898
public function getListUser($user, $type = 'all', $sort = 'full_name', $direction = '')
9999
{
100-
if (false == \in_array($type, array('all', 'owner', 'member')))
100+
if (\in_array($type, array('all', 'owner', 'member')) == false)
101101
{
102102
throw new \RuntimeException('Invalid type');
103103
}
104104

105-
if (false == \in_array($sort, array('created', 'updated', 'pushed', 'full_name')))
105+
if (\in_array($sort, array('created', 'updated', 'pushed', 'full_name')) == false)
106106
{
107107
throw new \RuntimeException('Invalid sort field');
108108
}
109109

110110
// Sort direction default: when using full_name: asc, otherwise desc.
111-
$direction = ($direction) ? : (('full_name' == $sort) ? 'asc' : 'desc');
111+
$direction = $direction ?: ($sort == 'full_name' ? 'asc' : 'desc');
112112

113-
if (false == \in_array($direction, array('asc', 'desc')))
113+
if (\in_array($direction, array('asc', 'desc')) == false)
114114
{
115115
throw new \RuntimeException('Invalid sort order');
116116
}
@@ -140,7 +140,7 @@ public function getListUser($user, $type = 'all', $sort = 'full_name', $directio
140140
*/
141141
public function getListOrg($org, $type = 'all')
142142
{
143-
if (false == \in_array($type, array('all', 'public', 'private', 'forks', 'sources', 'member')))
143+
if (\in_array($type, array('all', 'public', 'private', 'forks', 'sources', 'member')) == false)
144144
{
145145
throw new \RuntimeException('Invalid type');
146146
}
@@ -188,24 +188,23 @@ public function getList($id = 0)
188188
* @param string $org The organization name (if needed).
189189
* @param string $description The repository description.
190190
* @param string $homepage The repository homepage.
191-
* @param boolean $private Set true to create a private repository, false to create a public one.
192-
* Creating private repositories requires a paid GitHub account.
191+
* @param boolean $private Set true to create a private repository, false to create a public one. Creating private repositories
192+
* requires a paid GitHub account.
193193
* @param boolean $hasIssues Set true to enable issues for this repository, false to disable them.
194194
* @param boolean $hasWiki Set true to enable the wiki for this repository, false to disable it.
195195
* @param boolean $hasDownloads Set true to enable downloads for this repository, false to disable them.
196-
* @param integer $teamId The id of the team that will be granted access to this repository.
197-
* This is only valid when creating a repo in an organization.
196+
* @param integer $teamId The id of the team that will be granted access to this repository. This is only valid when creating a
197+
* repo in an organization.
198198
* @param boolean $autoInit true to create an initial commit with empty README.
199-
* @param string $gitignoreTemplate Desired language or platform .gitignore template to apply.
200-
* Use the name of the template without the extension.
201-
* For example, “Haskell” Ignored if auto_init parameter is not provided.
199+
* @param string $gitignoreTemplate Desired language or platform .gitignore template to apply. Use the name of the template without the
200+
* extension. For example, “Haskell” Ignored if auto_init parameter is not provided.
202201
*
203202
* @return object
204203
*
205204
* @since 1.0
206205
*/
207-
public function create($name, $org = '', $description = '', $homepage = '', $private = false, $hasIssues = false,
208-
$hasWiki = false, $hasDownloads = false, $teamId = 0, $autoInit = false, $gitignoreTemplate = ''
206+
public function create($name, $org = '', $description = '', $homepage = '', $private = false, $hasIssues = false, $hasWiki = false,
207+
$hasDownloads = false, $teamId = 0, $autoInit = false, $gitignoreTemplate = ''
209208
)
210209
{
211210
$path = ($org)
@@ -263,8 +262,8 @@ public function get($owner, $repo)
263262
* @param string $name The repository name.
264263
* @param string $description The repository description.
265264
* @param string $homepage The repository homepage.
266-
* @param boolean $private Set true to create a private repository, false to create a public one.
267-
* Creating private repositories requires a paid GitHub account.
265+
* @param boolean $private Set true to create a private repository, false to create a public one. Creating private repositories
266+
* requires a paid GitHub account.
268267
* @param boolean $hasIssues Set true to enable issues for this repository, false to disable them.
269268
* @param boolean $hasWiki Set true to enable the wiki for this repository, false to disable it.
270269
* @param boolean $hasDownloads Set true to enable downloads for this repository, false to disable them.
@@ -274,8 +273,8 @@ public function get($owner, $repo)
274273
*
275274
* @since 1.0
276275
*/
277-
public function edit($owner, $repo, $name, $description = '', $homepage = '', $private = false, $hasIssues = false,
278-
$hasWiki = false, $hasDownloads = false, $defaultBranch = ''
276+
public function edit($owner, $repo, $name, $description = '', $homepage = '', $private = false, $hasIssues = false, $hasWiki = false,
277+
$hasDownloads = false, $defaultBranch = ''
279278
)
280279
{
281280
$path = '/repos/' . $owner . '/' . $repo;

src/Package/Repositories/Contents.php

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ class Contents extends AbstractPackage
3232
* @param string $repo The name of the GitHub repository.
3333
* @param string $ref The String name of the Commit/Branch/Tag. Defaults to master.
3434
*
35-
* @since 1.0
35+
* @return object
3636
*
37-
* @return object
37+
* @since 1.0
38+
* @throws \UnexpectedValueException
3839
*/
3940
public function getReadme($owner, $repo, $ref = '')
4041
{
@@ -62,9 +63,9 @@ public function getReadme($owner, $repo, $ref = '')
6263
* @param string $path The content path.
6364
* @param string $ref The String name of the Commit/Branch/Tag. Defaults to master.
6465
*
65-
* @since 1.0
66+
* @return object
6667
*
67-
* @return object
68+
* @since 1.0
6869
*/
6970
public function get($owner, $repo, $path, $ref = '')
7071
{
@@ -99,14 +100,14 @@ public function get($owner, $repo, $path, $ref = '')
99100
* @param string $archiveFormat Either tarball or zipball.
100101
* @param string $ref The String name of the Commit/Branch/Tag. Defaults to master.
101102
*
102-
* @throws \UnexpectedValueException
103-
* @since 1.0
103+
* @return object
104104
*
105-
* @return object
105+
* @since 1.0
106+
* @throws \UnexpectedValueException
106107
*/
107108
public function getArchiveLink($owner, $repo, $archiveFormat = 'zipball', $ref = '')
108109
{
109-
if (false == \in_array($archiveFormat, array('tarball', 'zipball')))
110+
if (\in_array($archiveFormat, array('tarball', 'zipball')) == false)
110111
{
111112
throw new \UnexpectedValueException('Archive format must be either "tarball" or "zipball".');
112113
}
@@ -141,19 +142,19 @@ public function getArchiveLink($owner, $repo, $archiveFormat = 'zipball', $ref =
141142
* @param string $path The content path.
142143
* @param string $message The commit message.
143144
* @param string $content The new file content, Base64 encoded.
144-
* @param string $branch The branch name. If not provided, uses the repository’s
145-
* default branch (usually master).
145+
* @param string $branch The branch name. If not provided, uses the repository’s default branch (usually master).
146146
* @param string $authorName The name of the author of the commit
147147
* @param string $authorEmail The email of the author of the commit
148148
* @param string $committerName The name of the committer of the commit
149149
* @param string $committerEmail The email of the committer of the commit
150150
*
151-
* @throws \UnexpectedValueException
151+
* @return object
152152
*
153-
* @return object
153+
* @since 1.0
154+
* @throws \UnexpectedValueException
154155
*/
155-
public function create($owner, $repo, $path, $message, $content, $branch = 'master',
156-
$authorName = '', $authorEmail = '', $committerName = '', $committerEmail = ''
156+
public function create($owner, $repo, $path, $message, $content, $branch = 'master', $authorName = '', $authorEmail = '', $committerName = '',
157+
$committerEmail = ''
157158
)
158159
{
159160
// Build the request path.
@@ -212,19 +213,19 @@ public function create($owner, $repo, $path, $message, $content, $branch = 'mast
212213
* @param string $message The commit message.
213214
* @param string $content The new file content, Base64 encoded.
214215
* @param string $sha The blob SHA of the file being replaced.
215-
* @param string $branch The branch name. If not provided, uses the repository’s
216-
* default branch (usually master).
216+
* @param string $branch The branch name. If not provided, uses the repository’s default branch (usually master).
217217
* @param string $authorName The name of the author of the commit
218218
* @param string $authorEmail The email of the author of the commit
219219
* @param string $committerName The name of the committer of the commit
220220
* @param string $committerEmail The email of the committer of the commit
221221
*
222-
* @throws \UnexpectedValueException
222+
* @return object
223223
*
224-
* @return object
224+
* @since 1.0
225+
* @throws \UnexpectedValueException
225226
*/
226-
public function update($owner, $repo, $path, $message, $content, $sha, $branch = 'master',
227-
$authorName = '', $authorEmail = '', $committerName = '', $committerEmail = ''
227+
public function update($owner, $repo, $path, $message, $content, $sha, $branch = 'master', $authorName = '', $authorEmail = '',
228+
$committerName = '', $committerEmail = ''
228229
)
229230
{
230231
// Build the request path.
@@ -276,19 +277,19 @@ public function update($owner, $repo, $path, $message, $content, $sha, $branch =
276277
* @param string $path The content path.
277278
* @param string $message The commit message.
278279
* @param string $sha The blob SHA of the file being replaced.
279-
* @param string $branch The branch name. If not provided, uses the repository’s
280-
* default branch (usually master).
280+
* @param string $branch The branch name. If not provided, uses the repository’s default branch (usually master).
281281
* @param string $authorName The name of the author of the commit
282282
* @param string $authorEmail The email of the author of the commit
283283
* @param string $committerName The name of the committer of the commit
284284
* @param string $committerEmail The email of the committer of the commit
285285
*
286-
* @throws \UnexpectedValueException
286+
* @return object
287287
*
288-
* @return object
288+
* @since 1.0
289+
* @throws \UnexpectedValueException
289290
*/
290-
public function delete($owner, $repo, $path, $message, $sha, $branch = 'master',
291-
$authorName = '', $authorEmail = '', $committerName = '', $committerEmail = ''
291+
public function delete($owner, $repo, $path, $message, $sha, $branch = 'master', $authorName = '', $authorEmail = '', $committerName = '',
292+
$committerEmail = ''
292293
)
293294
{
294295
// Build the request path.

src/Package/Repositories/Releases.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,8 @@ public function delete($owner, $repo, $releaseId)
8787
* @param integer $releaseId The release id.
8888
* @param string $tagName The name of the tag.
8989
* @param string $targetCommitish The commitish value that determines where the Git tag is created from.
90-
* @param string $name The branch (or git ref) you want your changes pulled into. This
91-
* should be an existing branch on the current repository. You cannot
92-
* submit a pull request to one repo that requests a merge to a base
93-
* of another repo.
90+
* @param string $name The branch (or git ref) you want your changes pulled into. This should be an existing branch on the current
91+
* repository. You cannot submit a pull request to one repo that requests a merge to a base of another repo.
9492
* @param boolean $body The body text for the new pull request.
9593
* @param boolean $draft The branch (or git ref) where your changes are implemented.
9694
* @param string $preRelease The branch (or git ref) where your changes are implemented.
@@ -101,9 +99,7 @@ public function delete($owner, $repo, $releaseId)
10199
* @since 1.1.0
102100
* @throws \DomainException
103101
*/
104-
public function edit($user, $repo, $releaseId, $tagName,
105-
$targetCommitish = null, $name = null, $body = null, $draft = null, $preRelease = null
106-
)
102+
public function edit($user, $repo, $releaseId, $tagName, $targetCommitish = null, $name = null, $body = null, $draft = null, $preRelease = null)
107103
{
108104
// Build the request path.
109105
$path = '/repos/' . $user . '/' . $repo . '/releases/' . (int) $releaseId;

0 commit comments

Comments
 (0)