Skip to content

Commit 30b7f7c

Browse files
committed
php storm code cleaning
1 parent 3f37277 commit 30b7f7c

21 files changed

Lines changed: 76 additions & 116 deletions

blocks/repositories.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ function b_wggithub_repositories_show($options)
8383
if (\count($repositoriesAll) > 0) {
8484
foreach (\array_keys($repositoriesAll) as $i) {
8585
$block[$i]['id'] = $repositoriesAll[$i]->getVar('repo_id');
86-
$block[$i]['name'] = $myts->htmlSpecialChars($repositoriesAll[$i]->getVar('repo_name'));
86+
$repoName = $myts->htmlSpecialChars($repositoriesAll[$i]->getVar('repo_name'));
87+
if ($lenghtTitle > 0) {
88+
$repoName = \substr($repoName, 0, $lenghtTitle);
89+
}
90+
$block[$i]['name'] = $repoName;
8791
$block[$i]['htmlurl'] = $myts->htmlSpecialChars($repositoriesAll[$i]->getVar('repo_htmlurl'));
8892
}
8993
}

class/Common/XoopsConfirm.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,19 @@ public function __construct($hiddens, $action, $object, $title = '', $label = ''
6262
public function getFormXoopsConfirm()
6363
{
6464
//in order to be accessable from user and admin area this should be place in language common.php
65-
\define('CO__\WGGITHUB_DELETE_CONFIRM', 'Confirm delete');
66-
\define('CO__\WGGITHUB_DELETE_LABEL', 'Do you really want to delete:');
65+
\define('CO_WGGITHUB_DELETE_CONFIRM', 'Confirm delete');
66+
\define('CO_WGGITHUB_DELETE_LABEL', 'Do you really want to delete:');
6767

6868
// Get Theme Form
6969
if ('' === $this->action) {
7070
$this->action = \Xmf\Request::getString('REQUEST_URI', '', 'SERVER');
7171
}
7272
if ('' === $this->title) {
73-
$this->title = CO__\WGGITHUB_DELETE_CONFIRM;
73+
$this->title = CO_WGGITHUB_DELETE_CONFIRM;
7474
}
7575
if ('' === $this->label) {
7676

77-
$this->label = CO__\WGGITHUB_DELETE_LABEL;
77+
$this->label = CO_WGGITHUB_DELETE_LABEL;
7878
}
7979

8080
\xoops_load('XoopsFormLoader');
@@ -87,8 +87,8 @@ public function getFormXoopsConfirm()
8787
}
8888
$form->addElement(new \XoopsFormHidden('ok', 1));
8989
$buttonTray = new \XoopsFormElementTray('');
90-
$buttonTray->addElement(new \XoopsFormButton('', 'confirm_submit', _YES, 'submit'));
91-
$buttonBack = new \XoopsFormButton('', 'confirm_back', _NO, 'button');
90+
$buttonTray->addElement(new \XoopsFormButton('', 'confirm_submit', \_YES, 'submit'));
91+
$buttonBack = new \XoopsFormButton('', 'confirm_back', \_NO, 'button');
9292
$buttonBack->setExtra('onclick="history.go(-1);return true;"');
9393
$buttonTray->addElement($buttonBack);
9494
$form->addElement($buttonTray);

class/Github/Api.php

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public function __construct(Http\IClient $client = NULL)
3535

3636

3737
/**
38+
* @param OAuth\Token|null $token
3839
* @return self
3940
*/
4041
public function setToken(OAuth\Token $token = NULL)
@@ -98,9 +99,10 @@ public function getDefaultAccept()
9899
* @see request()
99100
*
100101
* @param string
102+
* @param array $parameters
103+
* @param array $headers
101104
* @return Http\Response
102105
*
103-
* @throws MissingParameterException
104106
*/
105107
public function delete($urlPath, array $parameters = [], array $headers = [])
106108
{
@@ -115,9 +117,10 @@ public function delete($urlPath, array $parameters = [], array $headers = [])
115117
* @see request()
116118
*
117119
* @param string
120+
* @param array $parameters
121+
* @param array $headers
118122
* @return Http\Response
119123
*
120-
* @throws MissingParameterException
121124
*/
122125
public function get($urlPath, array $parameters = [], array $headers = [])
123126
{
@@ -132,9 +135,10 @@ public function get($urlPath, array $parameters = [], array $headers = [])
132135
* @see request()
133136
*
134137
* @param string
138+
* @param array $parameters
139+
* @param array $headers
135140
* @return Http\Response
136141
*
137-
* @throws MissingParameterException
138142
*/
139143
public function head($urlPath, array $parameters = [], array $headers = [])
140144
{
@@ -148,12 +152,12 @@ public function head($urlPath, array $parameters = [], array $headers = [])
148152
* @see createRequest()
149153
* @see request()
150154
*
151-
* @param string
152-
* @param mixed
155+
* @param $urlPath
156+
* @param $content
157+
* @param array $parameters
158+
* @param array $headers
153159
* @return Http\Response
154160
*
155-
* @throws MissingParameterException
156-
* @throws JsonException
157161
*/
158162
public function patch($urlPath, $content, array $parameters = [], array $headers = [])
159163
{
@@ -167,12 +171,12 @@ public function patch($urlPath, $content, array $parameters = [], array $headers
167171
* @see createRequest()
168172
* @see request()
169173
*
170-
* @param string
171-
* @param mixed
174+
* @param $urlPath
175+
* @param $content
176+
* @param array $parameters
177+
* @param array $headers
172178
* @return Http\Response
173179
*
174-
* @throws MissingParameterException
175-
* @throws JsonException
176180
*/
177181
public function post($urlPath, $content, array $parameters = [], array $headers = [])
178182
{
@@ -186,12 +190,12 @@ public function post($urlPath, $content, array $parameters = [], array $headers
186190
* @see createRequest()
187191
* @see request()
188192
*
189-
* @param string
190-
* @param mixed
193+
* @param $urlPath
194+
* @param null $content
195+
* @param array $parameters
196+
* @param array $headers
191197
* @return Http\Response
192198
*
193-
* @throws MissingParameterException
194-
* @throws JsonException
195199
*/
196200
public function put($urlPath, $content = NULL, array $parameters = [], array $headers = [])
197201
{
@@ -202,9 +206,9 @@ public function put($urlPath, $content = NULL, array $parameters = [], array $he
202206

203207

204208
/**
209+
* @param Http\Request $request
205210
* @return Http\Response
206211
*
207-
* @throws Http\BadResponseException
208212
*/
209213
public function request(Http\Request $request)
210214
{
@@ -324,9 +328,10 @@ public function decode(Http\Response $response, array $okCodes = NULL)
324328
* @see get()
325329
*
326330
* @param string
331+
* @param array $parameters
332+
* @param array $headers
327333
* @return Paginator
328334
*
329-
* @throws MissingParameterException
330335
*/
331336
public function paginator($urlPath, array $parameters = [], array $headers = [])
332337
{
@@ -380,9 +385,10 @@ public function getUrl()
380385

381386
/**
382387
* @param string
388+
* @param array $parameters
389+
* @param array $defaultParameters
383390
* @return string
384391
*
385-
* @throws MissingParameterException
386392
*/
387393
protected function expandColonParameters($url, array $parameters, array $defaultParameters)
388394
{
@@ -414,6 +420,8 @@ protected function expandColonParameters($url, array $parameters, array $default
414420
* @todo Inject remaining default parameters into query string?
415421
*
416422
* @param string
423+
* @param array $parameters
424+
* @param array $defaultParameters
417425
* @return string
418426
*/
419427
protected function expandUriTemplate($url, array $parameters, array $defaultParameters)

class/Github/Github.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,6 @@ public function readOrgRepositories($org)
105105
*/
106106
private function getSetting($user = false)
107107
{
108-
109-
$this->user = 'ggoffy';
110-
$this->token = 'effca620d3b6a14813e53086c5477646743073aa';
111-
112-
return true;
113-
114-
115108
$helper = Helper::getInstance();
116109
$settingsHandler = $helper->getHandler('Settings');
117110
if ($user) {

class/Github/Helpers.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ public static function jsonEncode($value)
6161

6262

6363
/**
64-
* @param mixed
64+
* @param $json
65+
* @param bool $assoc
6566
* @return string
6667
*
67-
* @throws JsonException
6868
*/
6969
public static function jsonDecode($json, $assoc = false)
7070
{

class/Github/Http/AbstractClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ abstract class AbstractClient extends Github\Sanity implements IClient
3232
/**
3333
* @see https://developer.github.com/v3/#http-redirects
3434
*
35+
* @param Request $request
3536
* @return Response
3637
*
37-
* @throws BadResponseException
3838
*/
3939
public function request(Request $request)
4040
{
@@ -100,9 +100,9 @@ protected function setupRequest(Request $request)
100100

101101

102102
/**
103+
* @param Request $request
103104
* @return Response
104105
*
105-
* @throws BadResponseException
106106
*/
107107
abstract protected function process(Request $request);
108108

class/Github/Http/CachedClient.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class CachedClient extends Github\Sanity implements IClient
2727

2828

2929
/**
30-
* @param Storages\ICache
30+
* @param Storages\ICache $cache
3131
* @param IClient
3232
* @param bool forbid checking Github for new data; more or less development purpose only
3333
*/
@@ -49,9 +49,9 @@ public function getInnerClient()
4949

5050

5151
/**
52+
* @param Request $request
5253
* @return Response
5354
*
54-
* @throws BadResponseException
5555
*/
5656
public function request(Request $request)
5757
{
@@ -126,6 +126,7 @@ public function onResponse($callback)
126126

127127

128128
/**
129+
* @param Response $response
129130
* @return bool
130131
*/
131132
protected function isCacheable(Response $response)

class/Github/Http/CurlClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ protected function setupRequest(Request $request)
4242

4343

4444
/**
45+
* @param Request $request
4546
* @return Response
4647
*
47-
* @throws BadResponseException
4848
*/
4949
protected function process(Request $request)
5050
{

class/Github/Http/IClient.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
interface IClient
1212
{
1313
/**
14+
* @param Request $request
1415
* @return Response
1516
*/
1617
function request(Request $request);

class/Github/Http/Response.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ public function getPrevious()
7474

7575

7676
/**
77+
* @param Response|null $previous
7778
* @return self
7879
*
79-
* @throws Github\LogicException
8080
*/
8181
public function setPrevious(Response $previous = NULL)
8282
{

0 commit comments

Comments
 (0)