Skip to content

Commit 47675b8

Browse files
committed
Merge branch 'master' of github.com:joomla-framework/github-api into 2.0-dev
2 parents 38ca315 + ff65692 commit 47675b8

39 files changed

Lines changed: 162 additions & 188 deletions

src/AbstractGithubObject.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
use Joomla\Http\Http;
1313
use Joomla\Http\HttpFactory;
1414
use Joomla\Http\Response;
15-
use Joomla\Uri\Uri;
1615
use Joomla\Registry\Registry;
16+
use Joomla\Uri\Uri;
1717

1818
/**
1919
* GitHub API object class for the Joomla Framework.
@@ -84,7 +84,7 @@ abstract class AbstractGithubObject
8484
public function __construct(Registry $options = null, Http $client = null)
8585
{
8686
$this->options = $options ?: new Registry;
87-
$this->client = $client ?: (new HttpFactory)->getHttp($this->options);
87+
$this->client = $client ?: (new HttpFactory)->getHttp($this->options);
8888

8989
$this->package = \get_class($this);
9090
$this->package = substr($this->package, strrpos($this->package, '\\') + 1);
@@ -159,8 +159,9 @@ protected function processResponse(Response $response, $expectedCode = 200)
159159
if ($response->code != $expectedCode)
160160
{
161161
// Decode the error response and throw an exception.
162-
$error = json_decode($response->body);
162+
$error = json_decode($response->body);
163163
$message = isset($error->message) ? $error->message : 'Invalid response received from GitHub.';
164+
164165
throw new UnexpectedResponseException($response, $message, $response->code);
165166
}
166167

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
@@ -91,7 +91,7 @@ public function __get($name)
9191

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

src/Package/Activity/Notifications.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function markRead($unread = true, $read = true, \DateTimeInterface $lastR
132132

133133
$data = array(
134134
'unread' => $unread,
135-
'read' => $read
135+
'read' => $read,
136136
);
137137

138138
if ($lastReadAt)
@@ -169,7 +169,7 @@ public function markReadRepository($owner, $repo, $unread, $read, \DateTimeInter
169169

170170
$data = array(
171171
'unread' => $unread,
172-
'read' => $read
172+
'read' => $read,
173173
);
174174

175175
if ($lastReadAt)
@@ -220,7 +220,7 @@ public function markReadThread($id, $unread = true, $read = true)
220220

221221
$data = array(
222222
'unread' => $unread,
223-
'read' => $read
223+
'read' => $read,
224224
);
225225

226226
return $this->processResponse(
@@ -273,7 +273,7 @@ public function setThreadSubscription($id, $subscribed, $ignored)
273273

274274
$data = array(
275275
'subscribed' => $subscribed,
276-
'ignored' => $ignored
276+
'ignored' => $ignored,
277277
);
278278

279279
return $this->processResponse(

src/Package/Activity/Starring.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,10 @@ public function check($owner, $repo)
116116
case '204' :
117117
// This repository is watched by you.
118118
return true;
119-
break;
120119

121120
case '404' :
122121
// This repository is not watched by you.
123122
return false;
124-
break;
125123
}
126124

127125
throw new \UnexpectedValueException('Unexpected response code: ' . $response->code);

src/Package/Activity/Watching.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function setSubscription($owner, $repo, $subscribed, $ignored)
101101

102102
$data = array(
103103
'subscribed' => $subscribed,
104-
'ignored' => $ignored
104+
'ignored' => $ignored,
105105
);
106106

107107
return $this->processResponse(
@@ -155,12 +155,10 @@ public function check($owner, $repo)
155155
case '204' :
156156
// This repository is watched by you.
157157
return true;
158-
break;
159158

160159
case '404' :
161160
// This repository is not watched by you.
162161
return false;
163-
break;
164162
}
165163

166164
throw new \UnexpectedValueException('Unexpected response code: ' . $response->code);

src/Package/Authorization.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public function edit($id, array $scopes = array(), array $addScopes = array(), a
145145
array(
146146
$scope => $scopeData,
147147
'note' => $note,
148-
'note_url' => $url
148+
'note_url' => $url,
149149
)
150150
);
151151

@@ -255,6 +255,7 @@ public function getRateLimit()
255255

256256
// Decode the error response and throw an exception.
257257
$error = json_decode($response->body);
258+
258259
throw new UnexpectedResponseException($response, $error->message, $response->code);
259260
}
260261

@@ -318,7 +319,7 @@ public function requestToken($clientId, $clientSecret, $code, $redirectUri = '',
318319
$data = array(
319320
'client_id' => $clientId,
320321
'client_secret' => $clientSecret,
321-
'code' => $code
322+
'code' => $code,
322323
);
323324

324325
if ($redirectUri)
@@ -332,15 +333,20 @@ public function requestToken($clientId, $clientSecret, $code, $redirectUri = '',
332333
{
333334
case 'json' :
334335
$headers['Accept'] = 'application/json';
336+
335337
break;
338+
336339
case 'xml' :
337340
$headers['Accept'] = 'application/xml';
341+
338342
break;
343+
339344
default :
340345
if ($format)
341346
{
342347
throw new \UnexpectedValueException('Invalid format');
343348
}
349+
344350
break;
345351
}
346352

src/Package/Data/Blobs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function create($owner, $repo, $content, $encoding = 'utf-8')
6363

6464
$data = array(
6565
'content' => $content,
66-
'encoding' => $encoding
66+
'encoding' => $encoding,
6767
);
6868

6969
return $this->processResponse(

src/Package/Data/Refs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function create($user, $repo, $ref, $sha)
9090
$data = json_encode(
9191
array(
9292
'ref' => $ref,
93-
'sha' => $sha
93+
'sha' => $sha,
9494
)
9595
);
9696

src/Package/Data/Tags.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ public function create($owner, $repo, $tag, $message, $object, $type, $taggerNam
7777
'tagger' => array(
7878
'name' => $taggerName,
7979
'email' => $taggerEmail,
80-
'date' => $taggerDate
81-
)
80+
'date' => $taggerDate,
81+
),
8282
);
8383

8484
return $this->processResponse(

0 commit comments

Comments
 (0)