Skip to content

Commit 50dcf63

Browse files
committed
Cleaned up code - some files refactored
1 parent 5b41b0e commit 50dcf63

File tree

97 files changed

+361
-341
lines changed

Some content is hidden

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

97 files changed

+361
-341
lines changed

install/installUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ function _mysql_make_user($dbhandler, $db_host, $db_name, $login, $passwd)
485485

486486
$isMariaDB = false;
487487
$isMySQL = false;
488-
foreach ($vg as $vn => $vv) {
488+
foreach ($vg as $vv) {
489489
if (strripos($vv, 'MariaDB') !== false) {
490490
$isMariaDB = true;
491491
break;

install/sqlParser.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function process($filename)
9999
$sql_dodo = trim(trim($sql_do, "\r\n "));
100100

101101
if (strlen($sql_dodo) > 0) {
102-
$num = $num + 1;
102+
$num += 1;
103103
$status_ok = $this->db_conn->exec_query($sql_dodo);
104104
if (! $status_ok) {
105105
$this->sql_errors[] = array(

lib/ajax/getreqcoveragenodes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function display_children($dbHandler, $root_node, $parent, $filter_node,
106106
'target' => $ntypes['requirement'],
107107
'container' => $ntypes['requirement_spec']
108108
);
109-
foreach ($nodeSet as $key => $row) {
109+
foreach ($nodeSet as $row) {
110110
$path['text'] = htmlspecialchars($row['name']);
111111
$path['id'] = $row['id'];
112112

lib/ajax/getrequirementnodes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function display_children($dbHandler,$root_node,$parent,$filter_node,
106106
$treeMgr = new tree($dbHandler);
107107
$ntypes = $treeMgr->get_available_node_types();
108108
$peerTypes = array('target' => $ntypes['requirement'], 'container' => $ntypes['requirement_spec']);
109-
foreach($nodeSet as $key => $row)
109+
foreach($nodeSet as $row)
110110
{
111111
$path['text'] = htmlspecialchars($row['name']);
112112
$path['id'] = $row['id'];

lib/ajax/gettprojectnodes.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function display_children($dbHandler, $root_node, $parent, $filter_node,
125125
}
126126

127127
if (! is_null($nodeSet)) {
128-
foreach ($nodeSet as $key => $row) {
128+
foreach ($nodeSet as $row) {
129129
$path['text'] = htmlspecialchars($row['name']);
130130
$path['id'] = $row['id'];
131131

@@ -150,7 +150,7 @@ function display_children($dbHandler, $root_node, $parent, $filter_node,
150150
case 'testsuite':
151151
$items = array();
152152
getAllTCasesID($row['id'], $items);
153-
$tcase_qty = sizeof($items);
153+
$tcase_qty = count($items);
154154

155155
$path['href'] = "javascript:" .
156156
$js_function[$row['node_type']] . "({$path['id']})";
@@ -220,7 +220,7 @@ function getAllTCasesID($idList, &$tcIDs)
220220
$suiteIDs[] = $row['id'];
221221
}
222222
}
223-
if (sizeof($suiteIDs)) {
223+
if (count($suiteIDs)) {
224224
$suiteIDs = implode(",", $suiteIDs);
225225
getAllTCasesID($suiteIDs, $tcIDs);
226226
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function __construct()
125125

126126
// test route with anonymous function
127127
$this->app->get('/who',
128-
function () {
128+
function (): void {
129129
echo __CLASS__ . ' : Get Route /who';
130130
});
131131

@@ -317,7 +317,7 @@ public function getProjects($idCard = null, $opt = null)
317317
}
318318
} else {
319319
// Will consider id = name
320-
foreach ($zx as $key => $value) {
320+
foreach ($zx as $value) {
321321
if (strcmp($value['name'], $idCard) == 0) {
322322
$safeString = $this->db->prepare_string($idCard);
323323
$op['item'] = $this->tprojectMgr->get_by_name(
@@ -397,7 +397,7 @@ public function getProjectTestCases($idCard)
397397
$tcaseIDSet);
398398
if (! empty($tcaseIDSet)) {
399399
$op['items'] = array();
400-
foreach ($tcaseIDSet as $key => $tcaseID) {
400+
foreach ($tcaseIDSet as $tcaseID) {
401401
$item = $this->tcaseMgr->getLastVersionInfo($tcaseID);
402402
$item['keywords'] = $this->tcaseMgr->get_keywords_map(
403403
$tcaseID);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function __construct()
141141
// GET Routes
142142
// test route with anonymous function
143143
$this->app->get('/who',
144-
function () {
144+
function (): void {
145145
echo __CLASS__ . ' : You have called the Get Route /who';
146146
});
147147

@@ -516,7 +516,7 @@ public function getProjectTestCases($idCard)
516516

517517
if (! empty($tcaseIDSet)) {
518518
$op['items'] = array();
519-
foreach ($tcaseIDSet as $key => $tcaseID) {
519+
foreach ($tcaseIDSet as $tcaseID) {
520520
$item = $this->tcaseMgr->getLastVersionInfo($tcaseID);
521521
$item['keywords'] = $this->tcaseMgr->get_keywords_map(
522522
$tcaseID, $item['tcversion_id']);

lib/api/rest/v3/RestApi.class.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ public function getProjectTestCases(Response $response, $idCard)
349349

350350
if (! empty($tcaseIDSet)) {
351351
$op['items'] = array();
352-
foreach ($tcaseIDSet as $key => $tcaseID) {
352+
foreach ($tcaseIDSet as $tcaseID) {
353353
$item = $this->tcaseMgr->getLastVersionInfo($tcaseID);
354354
$item['keywords'] = $this->tcaseMgr->get_keywords_map(
355355
$tcaseID, $item['tcversion_id']);

lib/api/rest/v3/core/routes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use Psr\Http\Message\ServerRequestInterface as Request;
44
use Slim\App;
55

6-
return function (App $app) {
6+
return function (App $app): void {
77

88
// @20201124 - I do not understand this
99
// $app->get('/',World::class . ':hello');

lib/api/rest/v3/custom/routes/routesCustomExample.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Slim\App;
1010

1111

12-
return function (App $app) {
12+
return function (App $app): void {
1313
$app->get('/CustomExample/whoAmI',
1414
array($app->restApiCustomExample,'whoAmI'));
1515

0 commit comments

Comments
 (0)