Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit d841910

Browse files
author
Jamie Snape
committed
Fix failing style tests
1 parent 6d3a4b1 commit d841910

File tree

83 files changed

+385
-395
lines changed

Some content is hidden

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

83 files changed

+385
-395
lines changed

core/ApiController.php

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
/** Web Api Controller */
2222
class ApiController extends REST_Controller
2323
{
24-
2524
private $httpSuccessCode = array(
2625
'index' => 200, // 200 OK
2726
'get' => 200,
@@ -73,7 +72,7 @@ protected function _exceptionHandler(Exception $e)
7372
default:
7473
$httpCode = 400; // 400 Bad Request
7574
}
76-
return array($errorInfo, $httpCode);
75+
return array($errorInfo, $httpCode);
7776
}
7877

7978
/**
@@ -104,49 +103,49 @@ protected function _exceptionHandler(Exception $e)
104103
* for given url: {base_path}/rest/item/duplicate/2, Midas will call
105104
* 'itemDuplicate' in ApiComponent (in core module) to do the api;
106105
*/
107-
108106
protected function _genericAction($args, $resource, $restAction, $apiFunctions, $moduleName = null)
109107
{
110-
$ApiComponent = MidasLoader::loadComponent('Api'.$resource, $moduleName);
111-
$httpCode = $this->httpSuccessCode[strtolower($restAction)];
112-
$calledFunction = $apiFunctions['default'];
113-
$apiResults = array();
114-
try
108+
$ApiComponent = MidasLoader::loadComponent('Api'.$resource, $moduleName);
109+
$httpCode = $this->httpSuccessCode[strtolower($restAction)];
110+
$calledFunction = $apiFunctions['default'];
111+
$apiResults = array();
112+
try
113+
{
114+
$userDao = $this->_getUser($args);
115+
if(isset($args['method']))
115116
{
116-
$userDao = $this->_getUser($args);
117-
if(isset($args['method']))
117+
$method = strtolower($args['method']);
118+
if(array_key_exists($method, $apiFunctions))
118119
{
119-
$method = strtolower($args['method']);
120-
if(array_key_exists($method, $apiFunctions))
121-
{
122-
$calledFunction = $apiFunctions[$method];
123-
}
124-
else
125-
{
126-
throw new Exception('Server error. Operation ' . $args['method'] . ' is not supported.', -100);
127-
}
128-
}
129-
if(method_exists($ApiComponent, $calledFunction . 'Wrapper')) {
130-
$calledFunction = $calledFunction . 'Wrapper';
131-
}
132-
$resultsArray = $ApiComponent->$calledFunction($args, $userDao);
133-
if(isset($resultsArray))
134-
{
135-
$apiResults['data'] = $resultsArray;
120+
$calledFunction = $apiFunctions[$method];
136121
}
137-
else // if the api function doesn't provide an return value
122+
else
138123
{
139-
$apiResults['msg'] = "succeed!"; // there is no exception if code reaches here
124+
throw new Exception('Server error. Operation ' . $args['method'] . ' is not supported.', -100);
140125
}
141126
}
142-
catch(Exception $e)
127+
if(method_exists($ApiComponent, $calledFunction . 'Wrapper'))
143128
{
144-
list($apiResults['error'], $httpCode) = $this->_exceptionHandler($e);
129+
$calledFunction = $calledFunction . 'Wrapper';
145130
}
146-
$this->_response->setHttpResponseCode($httpCode);
147-
// only the data assigned to '$this->view->apiresults' will be serilized
148-
// in requested format (json, xml, etc) and filled in response body
149-
$this->view->apiresults = $apiResults;
131+
$resultsArray = $ApiComponent->$calledFunction($args, $userDao);
132+
if(isset($resultsArray))
133+
{
134+
$apiResults['data'] = $resultsArray;
135+
}
136+
else // if the api function doesn't provide an return value
137+
{
138+
$apiResults['msg'] = "succeed!"; // there is no exception if code reaches here
139+
}
140+
}
141+
catch(Exception $e)
142+
{
143+
list($apiResults['error'], $httpCode) = $this->_exceptionHandler($e);
144+
}
145+
$this->_response->setHttpResponseCode($httpCode);
146+
// only the data assigned to '$this->view->apiresults' will be serilized
147+
// in requested format (json, xml, etc) and filled in response body
148+
$this->view->apiresults = $apiResults;
150149
}
151150

152151
/**
@@ -215,4 +214,4 @@ public function optionsAction()
215214
{
216215
$this->_response->setHeader('Allow', 'OPTIONS');
217216
}
218-
} // end class
217+
}

library/KWUtils.php

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@
1313
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
1414
PURPOSE. See the above copyright notices for more information.
1515
=========================================================================*/
16-
?>
17-
<?php
16+
1817
/**
1918
* globally useful utility functions.
2019
*/
2120
class KWUtils
22-
{
23-
21+
{
2422
CONST DEFAULT_MKDIR_MODE = 0775;
2523

2624
/**
@@ -83,7 +81,6 @@ public static function isWindows()
8381
return (strtolower(substr(PHP_OS, 0, 3)) == "win");
8482
}
8583

86-
8784
/**
8885
* @method escapeCommand
8986
* will escape a command respecting the format of the current platform
@@ -130,7 +127,7 @@ public static function exec($command, &$output = null, $chdir = '', &$return_val
130127
{
131128
if(!getcwd())
132129
{
133-
throw new Exception ('getcwd failed');
130+
throw new Exception('getcwd failed');
134131
}
135132
$currCwd = getcwd();
136133

@@ -158,7 +155,6 @@ public static function exec($command, &$output = null, $chdir = '', &$return_val
158155
}
159156
}
160157

161-
162158
/**
163159
* @method isLinux()
164160
* @return True if the current platform is Linux
@@ -168,8 +164,6 @@ public static function isLinux()
168164
return (strtolower(substr(PHP_OS, 0, 5)) == "linux");
169165
}
170166

171-
172-
173167
/**
174168
* @method prepareExecCommand
175169
* will prepare an executable application and params for command line
@@ -199,7 +193,6 @@ public static function prepareExecCommand($app_name, $params = array())
199193
return escapeshellarg($app_name).' '.implode(' ', $escapedParams);
200194
}
201195

202-
203196
/**
204197
* @method isExecutable will return true if the app can be found and is
205198
* executable, can optionally look in the path.
@@ -239,7 +232,7 @@ public static function isExecutable($app_name, $check_in_path = false)
239232
* can't be found, or if $check_execution_flag is set and the app is not
240233
* executable.
241234
*/
242-
public static function findApp($app_name, $check_execution_flag )
235+
public static function findApp($app_name, $check_execution_flag)
243236
{
244237
$PHP_PATH_SEPARATOR = ":";
245238
// split path
@@ -274,9 +267,6 @@ public static function findApp($app_name, $check_execution_flag )
274267
return $path_to_app;
275268
}
276269

277-
278-
279-
280270
/**
281271
* @method formatAppName
282272
* Format the application name according to the platform.
@@ -290,7 +280,6 @@ public static function formatAppName($app_name)
290280
return $app_name;
291281
}
292282

293-
294283
/**
295284
* @method recursiveRemoveDirectory
296285
* Helper function to recursively delete a directory
@@ -345,5 +334,4 @@ public static function recursiveRemoveDirectory($directorypath)
345334
}
346335
return true;
347336
}
348-
349-
}
337+
}

modules/batchmake/AppController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
limitations under the License.
1919
=========================================================================*/
2020

21+
/** App controller for the batchmake module */
2122
class Batchmake_AppController extends MIDAS_GlobalModule
2223
{
23-
public $moduleName='batchmake';
24-
} // end class
24+
public $moduleName = 'batchmake';
25+
}

modules/batchmake/Notification.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,17 @@
1717
See the License for the specific language governing permissions and
1818
limitations under the License.
1919
=========================================================================*/
20+
2021
require_once BASE_PATH . '/modules/api/library/APIEnabledNotification.php';
2122

22-
/** notification manager*/
23+
/** Notification manager for the batchmake module */
2324
class Batchmake_Notification extends ApiEnabled_Notification
2425
{
2526
public $moduleName = 'batchmake';
2627
public $_components = array('Utility', 'Internationalization');
27-
public $_moduleComponents=array('KWBatchmake','Api');
28+
public $_moduleComponents = array('KWBatchmake', 'Api');
2829

29-
/** init notification process*/
30+
/** init notification process */
3031
public function init()
3132
{
3233
$this->enableWebAPI($this->moduleName);
@@ -36,10 +37,10 @@ public function init()
3637
}//end init
3738

3839
/**
39-
*@method getDashboard
40-
*will generate information about this module to display on the Dashboard
41-
*@return array with key being the module name, the value being an array
42-
of configuration correctness values (0 or 1).
40+
* @method getDashboard
41+
* will generate information about this module to display on the Dashboard
42+
* @return array with key being the module name, the value being an array
43+
* of configuration correctness values (0 or 1).
4344
*/
4445
public function getDashboard()
4546
{
@@ -48,9 +49,9 @@ public function getDashboard()
4849
}
4950

5051
/**
51-
*@method getLeftLink
52+
* @method getLeftLink
5253
* will generate a link for this module to be displayed in the main view.
53-
*@return ['batchmake' => [ link to batchmake module, module icon image path]]
54+
* @return ['batchmake' => [ link to batchmake module, module icon image path]]
5455
*/
5556
public function getLeftLink()
5657
{
@@ -59,4 +60,4 @@ public function getLeftLink()
5960
$moduleWebroot = $baseURL . '/' . MIDAS_BATCHMAKE_MODULE;
6061
return array(ucfirst(MIDAS_BATCHMAKE_MODULE) => array($moduleWebroot . '/index', $baseURL . '/modules/batchmake/public/images/cmake.png'));
6162
}
62-
} // end class
63+
}

modules/cleanup/AppController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
limitations under the License.
1919
=========================================================================*/
2020

21+
/** App controller for the cleanup module */
2122
class Cleanup_AppController extends MIDAS_GlobalModule
2223
{
2324
public $moduleName = 'cleanup';
24-
} // end class
25+
}

modules/comments/AppController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
limitations under the License.
1919
=========================================================================*/
2020

21+
/** App controller for the comments module */
2122
class Comments_AppController extends MIDAS_GlobalModule
2223
{
2324
public $moduleName = 'comments';
24-
} // end class
25+
}

modules/communityagreement/AppController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
*/
2727
class Communityagreement_AppController extends MIDAS_GlobalModule
2828
{
29-
public $moduleName='communityagreement';
29+
public $moduleName = 'communityagreement';
3030

3131
/**
3232
* Communityagreement_Agreement Model
3333
* @var Communityagreement_AgreementModelBase
3434
*/
3535
var $Communityagreement_Agreement;
36-
} // end class
36+
}

modules/communityagreement/models/AppDao.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@
2525
*/
2626
class Communityagreement_AppDao extends MIDAS_GlobalDao
2727
{
28-
public $moduleName='communityagreement';
29-
} // end class
28+
public $moduleName = 'communityagreement';
29+
}

modules/communityagreement/models/AppModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@
2626
*/
2727
class Communityagreement_AppModel extends MIDASModel
2828
{
29-
public $moduleName='communityagreement';
29+
public $moduleName = 'communityagreement';
3030
}

modules/dicomextractor/AppController.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
limitations under the License.
1919
=========================================================================*/
2020

21+
/** App controller for the dicomextractor module */
2122
class Dicomextractor_AppController extends MIDAS_GlobalModule
2223
{
23-
public $moduleName='dicomextractor';
24-
} // end class
24+
public $moduleName = 'dicomextractor';
25+
}

0 commit comments

Comments
 (0)