Skip to content

Commit c259398

Browse files
committed
Code revised with reactor
Applied rules: * CompleteMissingIfElseBracketRector * CompleteDynamicPropertiesRector
1 parent 7ba5ab3 commit c259398

43 files changed

Lines changed: 370 additions & 189 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

lib/api/rest/v1/tlRestApi.class.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
class tlRestApi
4242
{
4343

44+
public $app;
45+
4446
public static $version = "1.0";
4547

4648
/**

lib/api/rest/v2/tlRestApi.class.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
class tlRestApi
4141
{
4242

43+
public $app;
44+
4345
public static $version = "2.1.1";
4446

4547
/**

lib/api/xmlrpc/v1/sample_extended_server/extended_server.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
class SampleXMLRPCServer extends TestlinkXMLRPCServer
1818
{
1919

20+
public $tsuiteMgr;
21+
2022
public function __construct()
2123
{
2224
openlog("testlink", LOG_ODELAY, LOG_LOCAL1);

lib/api/xmlrpc/v1/xmlrpc.class.php

Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
class TestlinkXMLRPCServer extends IXR_Server
5151
{
5252

53+
public $methods;
54+
5355
public static $version = "1.1";
5456

5557
const OFF = false;
@@ -429,8 +431,8 @@ protected function _setBuildID($buildID)
429431
if (GENERAL_ERROR_CODE != $buildID) {
430432
$this->args[self::$buildIDParamName] = $buildID;
431433
return true;
432-
}
433-
$this->errors[] = new IXR_Error(INVALID_BUILDID, INVALID_BUILDID_STR);
434+
}
435+
$this->errors[] = new IXR_Error(INVALID_BUILDID, INVALID_BUILDID_STR);
434436
return false;
435437
}
436438

@@ -507,7 +509,7 @@ protected function authenticate($messagePrefix = '')
507509
$messagePrefix . NO_DEV_KEY_STR);
508510
$this->authenticated = false;
509511
return false;
510-
}
512+
}
511513
$this->devKey = $this->args[self::$devKeyParamName];
512514

513515
// make sure the key we have is valid
@@ -516,11 +518,11 @@ protected function authenticate($messagePrefix = '')
516518
$messagePrefix . INVALID_AUTH_STR);
517519
$this->authenticated = false;
518520
return false;
519-
}
520-
// Load User
521-
$this->user = tlUser::getByID($this->dbObj, $this->userID);
522-
$this->authenticated = true;
523-
$this->tlLogger->startTransaction('DEFAULT', null, $this->userID);
521+
}
522+
// Load User
523+
$this->user = tlUser::getByID($this->dbObj, $this->userID);
524+
$this->authenticated = true;
525+
$this->tlLogger->startTransaction('DEFAULT', null, $this->userID);
524526
return true;
525527
}
526528

@@ -575,8 +577,8 @@ protected function userHasRight($rightToCheck,
575577
$tprojectid = intval(
576578
isset($context[self::$testProjectIDParamName]) ? $context[self::$testProjectIDParamName] : 0);
577579

578-
if ($tprojectid == 0 &&
579-
isset($this->args[self::$testProjectIDParamName])) {
580+
if ($tprojectid == 0 && isset(
581+
$this->args[self::$testProjectIDParamName])) {
580582
$tprojectid = $this->args[self::$testProjectIDParamName];
581583
}
582584

@@ -604,8 +606,8 @@ protected function userHasRight($rightToCheck,
604606
// Try using TestSuiteID to get TestProjectID
605607
$tsuiteid = intval(
606608
isset($context[self::$testSuiteIDParamName]) ? $context[self::$testSuiteIDParamName] : 0);
607-
if ($tsuiteid == 0 &&
608-
isset($this->args[self::$testSuiteIDParamName])) {
609+
if ($tsuiteid == 0 && isset(
610+
$this->args[self::$testSuiteIDParamName])) {
609611
$tsuiteid = intval($this->args[self::$testSuiteIDParamName]);
610612
}
611613
if ($tsuiteid > 0) {
@@ -1536,11 +1538,11 @@ protected function _isDevKeyValid($devKey)
15361538
{
15371539
if (null == $devKey || "" == $devKey) {
15381540
return false;
1539-
}
1540-
$this->userID = null;
1541-
$this->devKey = $this->dbObj->prepare_string($devKey);
1542-
$query = "SELECT id FROM {$this->tables['users']} WHERE script_key='{$this->devKey}'";
1543-
$this->userID = $this->dbObj->fetchFirstRowSingleColumn($query, "id");
1541+
}
1542+
$this->userID = null;
1543+
$this->devKey = $this->dbObj->prepare_string($devKey);
1544+
$query = "SELECT id FROM {$this->tables['users']} WHERE script_key='{$this->devKey}'";
1545+
$this->userID = $this->dbObj->fetchFirstRowSingleColumn($query, "id");
15441546
return null == $this->userID;
15451547
}
15461548

@@ -2258,7 +2260,7 @@ public function createBuild($args)
22582260
$resultInfo[0]["id"] = $insertID;
22592261
$resultInfo[0]["message"] = $returnMessage;
22602262
return $resultInfo;
2261-
}
2263+
}
22622264
return $this->errors;
22632265
}
22642266

@@ -2278,7 +2280,7 @@ public function getProjects($args)
22782280
array(
22792281
'output' => 'array_of_map'
22802282
));
2281-
}
2283+
}
22822284
return $this->errors;
22832285
}
22842286

@@ -2312,7 +2314,7 @@ public function getProjectTestPlans($args)
23122314
$info = array_values($info);
23132315
}
23142316
return $info;
2315-
}
2317+
}
23162318
return $this->errors;
23172319
}
23182320

@@ -2376,7 +2378,7 @@ public function getTestSuitesForTestPlan($args)
23762378
if ($status_ok) {
23772379
$testPlanID = $this->args[self::$testPlanIDParamName];
23782380
return $this->tplanMgr->get_testsuites($testPlanID);
2379-
}
2381+
}
23802382
return $this->errors;
23812383
}
23822384

@@ -2615,7 +2617,7 @@ public function getTestCasesForTestSuite($args)
26152617
}
26162618

26172619
return $tsuiteMgr->$pfn($testSuiteID, $details, $opt);
2618-
}
2620+
}
26192621
return $this->errors;
26202622
}
26212623

@@ -3125,7 +3127,7 @@ public function reportTCResult($args)
31253127
}
31263128

31273129
return $resultInfo;
3128-
}
3130+
}
31293131
return $this->errors;
31303132
}
31313133

@@ -3145,9 +3147,9 @@ public function setTestMode($args)
31453147
if (! $this->_isTestModePresent()) {
31463148
$this->errors[] = new IXR_ERROR(NO_TEST_MODE, NO_TEST_MODE_STR);
31473149
return false;
3148-
}
3149-
// TODO: should probably validate that this is a bool or t/f string
3150-
$this->testMode = $this->args[self::$testModeParamName];
3150+
}
3151+
// TODO: should probably validate that this is a bool or t/f string
3152+
$this->testMode = $this->args[self::$testModeParamName];
31513153
return true;
31523154
}
31533155

@@ -3556,7 +3558,7 @@ public function getTestCaseCustomFieldDesignValue($args)
35563558
break;
35573559
}
35583560
return $retval;
3559-
}
3561+
}
35603562
return $this->errors;
35613563
}
35623564

@@ -4038,9 +4040,9 @@ public function addTestCaseToTestPlan($args)
40384040
// Other version than requested done is already linked
40394041
$doLink = false;
40404042
if ($this->_isParamPresent(self::$overwriteParamName) &&
4041-
$this->args[self::$overwriteParamName]) {
4042-
$doLink = true;
4043-
$doDeleteLinks = true;
4043+
$this->args[self::$overwriteParamName]) {
4044+
$doLink = true;
4045+
$doDeleteLinks = true;
40444046
}
40454047

40464048
reset($rs);
@@ -4661,8 +4663,8 @@ public function getTestCaseAttachments($args)
46614663
return $this->errors;
46624664
}
46634665

4664-
if ($status_ok &&
4665-
! $this->_isParamPresent(self::$versionNumberParamName)) {
4666+
if ($status_ok && ! $this->_isParamPresent(
4667+
self::$versionNumberParamName)) {
46664668
try {
46674669
$tc = $this->getTestCase($args, self::THROW_ON_ERROR);
46684670
$this->args[self::$versionNumberParamName] = $tc[0][self::$versionNumberParamName];
@@ -5059,7 +5061,7 @@ public function getTestCase($args, $throwOnError = false)
50595061
$this->errors[] = new IXR_ERROR(NO_TESTCASE_FOUND,
50605062
$msg_prefix . NO_TESTCASE_FOUND_STR);
50615063
return $this->errors;
5062-
}
5064+
}
50635065
if (isset($this->args[self::$testCaseExternalIDParamName])) {
50645066
$result[0]['full_tc_external_id'] = $this->args[self::$testCaseExternalIDParamName];
50655067
} else {
@@ -5082,10 +5084,10 @@ public function getTestCase($args, $throwOnError = false)
50825084

50835085
if ($status_ok) {
50845086
return $result;
5085-
}
5087+
}
50865088
if ($throwOnError) {
50875089
throw new Exception("Test Case Does Not Exist", 1);
5088-
}
5090+
}
50895091
return $this->errors;
50905092
}
50915093

@@ -5628,7 +5630,7 @@ public function getTestSuiteByID($args)
56285630
$testSuiteID = $this->args[self::$testSuiteIDParamName];
56295631
$tsuiteMgr = new testsuite($this->dbObj);
56305632
return $tsuiteMgr->get_by_id($testSuiteID);
5631-
}
5633+
}
56325634
return $this->errors;
56335635
}
56345636

@@ -6625,7 +6627,7 @@ protected function getCustomFieldValue($args, $msg_prefix = '')
66256627
break;
66266628
}
66276629
return $cfieldSpec[$cfield['id']];
6628-
}
6630+
}
66296631
return $this->errors;
66306632
}
66316633

@@ -7225,8 +7227,8 @@ public function setTestCaseExecutionType($args)
72257227
'checkTestCaseVersionNumber'
72267228
);
72277229
$status_ok = $this->_runChecks($checkFunctions, $msg_prefix);
7228-
if ($status_ok && ! $this->_isParamPresent(
7229-
self::$executionTypeParamName)) {
7230+
if ($status_ok &&
7231+
! $this->_isParamPresent(self::$executionTypeParamName)) {
72307232
$status_ok = false;
72317233
$msg = sprintf(MISSING_REQUIRED_PARAMETER_STR,
72327234
self::$customFieldsParamName);
@@ -7245,7 +7247,7 @@ public function setTestCaseExecutionType($args)
72457247
$this->args,
72467248
$dbg
72477249
);
7248-
}
7250+
}
72497251
return $this->errors;
72507252
}
72517253

@@ -7288,7 +7290,7 @@ public function getExecCountersByBuild($args)
72887290
'raw' => $metrics,
72897291
'table' => $out
72907292
);
7291-
}
7293+
}
72927294
return $this->errors;
72937295
}
72947296

@@ -7404,7 +7406,7 @@ public function getProjectPlatforms($args)
74047406
);
74057407

74067408
return $this->platformMgr->getAllAsMap($optPlat);
7407-
}
7409+
}
74087410
return $this->errors;
74097411
}
74107412

@@ -8171,8 +8173,8 @@ public function getTestCaseBugs($args)
81718173
" WHERE parent_id = {$this->args[self::$testCaseIDParamName]})";
81728174

81738175
if (! is_null($execContext['build_id'])) {
8174-
$sql .= " AND build_id = " .
8175-
intval($execContext['build_id']);
8176+
$sql .= " AND build_id = " . intval(
8177+
$execContext['build_id']);
81768178
}
81778179

81788180
if (! is_null($execContext['platform_id'])) {
@@ -8422,7 +8424,7 @@ public function getProjectKeywords($args)
84228424
return $this->getValidKeywordSet(
84238425
intval($this->args[self::$testProjectIDParamName]), '', true,
84248426
'getProjectKeywords');
8425-
}
8427+
}
84268428
return $this->errors;
84278429
}
84288430

@@ -8491,7 +8493,7 @@ public function getTestCaseKeywords($args)
84918493
$safeTCID, $tcversion_id);
84928494
}
84938495
return $kwSet;
8494-
}
8496+
}
84958497
return $this->errors;
84968498
}
84978499

@@ -9089,7 +9091,7 @@ public function updateBuildCustomFieldsValues($args)
90899091
}
90909092
// Return the result after all of the fields have been processed
90919093
return $ret;
9092-
}
9094+
}
90939095
return $this->errors;
90949096
}
90959097

@@ -9365,15 +9367,15 @@ public function getRequirement($args)
93659367
if ($this->_isParamPresent(self::$requirementVersionIDParamName)) {
93669368
if (! $this->checkReqVersionID($msg_prefix)) {
93679369
return false;
9368-
}
9369-
$reqVersionID = $this->args[self::$requirementVersionIDParamName];
9370+
}
9371+
$reqVersionID = $this->args[self::$requirementVersionIDParamName];
93709372
$latest = false;
93719373
} elseif ($this->_isParamPresent(self::$versionNumberParamName)) {
93729374
if (! $this->checkVersionNumber()) {
93739375
return false;
9374-
}
9375-
$reqVersionNumber = $this->args[self::$versionNumberParamName];
9376-
$latest = false;
9376+
}
9377+
$reqVersionNumber = $this->args[self::$versionNumberParamName];
9378+
$latest = false;
93779379
$version = true;
93789380
}
93799381

lib/functions/APIKey.class.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
class APIKey extends tlObjectWithDB
1919
{
2020

21+
public $dbID;
22+
2123
private $object_table = "";
2224

2325
public function __construct()

lib/functions/bareBonesRestAPI.class.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
class bareBonesRestAPI
1717
{
1818

19+
public $api;
20+
21+
public $url;
22+
1923
/**
2024
*
2125
* @var string Some systems i.e. trello need both

0 commit comments

Comments
 (0)