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

Commit c1d3c8c

Browse files
author
Michael Grauer
committed
BUG: Refs #212. Cleaned out trailing whitespace.
Fixed the files that were failing the new trailing whitespace style check test.
1 parent f2f974d commit c1d3c8c

File tree

7 files changed

+287
-287
lines changed

7 files changed

+287
-287
lines changed

library/KWUtils.php

Lines changed: 68 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
*/
2121
class KWUtils
2222
{
23-
24-
CONST DEFAULT_MKDIR_MODE = 0775;
25-
23+
24+
CONST DEFAULT_MKDIR_MODE = 0775;
25+
2626
/**
2727
* @method mkDir
2828
* @TODO what to do with errors in a way that is consistent with error reporting
@@ -43,48 +43,48 @@ public static function mkDir($dir, $mode = self::DEFAULT_MKDIR_MODE)
4343
{
4444
return false;
4545
}
46-
return true;
46+
return true;
4747
}
48-
49-
/**
48+
49+
/**
5050
* @method createSubDirectories recursively create subdirectories starting at
5151
* baseDirectory, sequentially creating each of the directories in the
5252
* subDirectories array, according to the passed in mode.
5353
* @param $baseDirectory the first directory to create
54-
* @param $subDirectories an array of directories that will be created in a
54+
* @param $subDirectories an array of directories that will be created in a
5555
* recursive fashion, each one appending to the last as a deeper subdirectory
5656
* of baseDirectory
5757
* @param the mode to create the new directories
58-
*/
58+
*/
5959
public static function createSubDirectories($baseDirectory, $subDirectories, $mode = self::DEFAULT_MKDIR_MODE)
6060
{
6161
if(!file_exists($baseDirectory) )
6262
{
6363
throw new Zend_Exception($baseDirectory . ' does not exist');
6464
}
65-
$relpath = '';
65+
$relpath = '';
6666
foreach($subDirectories as $directory)
6767
{
68-
$relpath .= $directory . "/";
69-
68+
$relpath .= $directory . "/";
69+
7070
if(!KwUtils::mkDir($baseDirectory . $relpath, $mode))
71-
{
71+
{
7272
throw new Zend_Exception($baseDirectory . $relpath . ' could not be created');
7373
}
7474
}
7575
return $baseDirectory . $relpath;
7676
}
7777

78-
/**
78+
/**
7979
* @method isWindows()
8080
* @return True if the current platform is windows
8181
*/
8282
public static function isWindows()
8383
{
84-
return (strtolower(substr(PHP_OS, 0, 3)) == "win");
84+
return (strtolower(substr(PHP_OS, 0, 3)) == "win");
8585
}
86-
87-
86+
87+
8888
/**
8989
* @method escapeCommand
9090
* will escape a command respecting the format of the current platform
@@ -100,11 +100,11 @@ public static function escapeCommand($command )
100100
{
101101
$command = '"'.$command.'"';
102102
}
103-
104-
return $command;
105-
}
106-
107-
/**
103+
104+
return $command;
105+
}
106+
107+
/**
108108
* @method appendStringIfNot will append the string $ext to
109109
* $subject if it is not already a suffix of $subject
110110
* @param $subject, the string to be appended to
@@ -115,9 +115,9 @@ public static function appendStringIfNot($subject, $ext)
115115
{
116116
if(!(substr($subject, strlen($subject) - strlen($ext)) === $ext) )
117117
{
118-
$subject .= $ext;
118+
$subject .= $ext;
119119
}
120-
return $subject;
120+
return $subject;
121121
}
122122

123123
/**
@@ -127,65 +127,65 @@ public static function appendStringIfNot($subject, $ext)
127127
* @param $output, a reference to put the output of the command
128128
* @param $chdir, the dir to change to for execution, if any
129129
* @param $return_val, a reference to put the return value of the command
130-
* the temporary work dir
130+
* the temporary work dir
131131
*/
132132
public static function exec($command, &$output = null, $chdir = "", &$return_val = null)
133133
{
134134
if(!empty($chdir) && is_dir($chdir))
135-
{
135+
{
136136
if(!chdir($chdir))
137137
{
138138
throw new Zend_Exception("Failed to change directory: [".$chdir."]");
139139
}
140140
}
141141
// on Linux need to add redirection to handle stderr
142-
$redirect_error = KWUtils::isLinux() ? " 2>&1" : "";
142+
$redirect_error = KWUtils::isLinux() ? " 2>&1" : "";
143143
exec(KWUtils::escapeCommand($command) . $redirect_error, $output, $return_val);
144-
}
145-
146-
147-
/**
144+
}
145+
146+
147+
/**
148148
* @method isLinux()
149149
* @return True if the current platform is Linux
150150
*/
151151
public static function isLinux()
152152
{
153-
return (strtolower(substr(PHP_OS, 0, 5)) == "linux");
154-
}
155-
156-
157-
153+
return (strtolower(substr(PHP_OS, 0, 5)) == "linux");
154+
}
155+
156+
157+
158158
/**
159159
* @method prepareExecCommand
160-
* will prepare an executable application and params for command line
160+
* will prepare an executable application and params for command line
161161
* execution, including escaping and quoting arguments.
162162
* @param $app_name, the application to be executed
163163
* @param $params, an array of arguments to the application
164-
* @return the full command line command, escaped and quoted, will throw a
164+
* @return the full command line command, escaped and quoted, will throw a
165165
* Zend_Exception if the app is not in the path and not executable
166166
*/
167167
public static function prepareExecCommand($app_name, $params = array())
168168
{
169169
// Check if application is executable, if not, see if you can find it
170170
// in the path
171-
if(!KWUtils::isExecutable($app_name, false))
171+
if(!KWUtils::isExecutable($app_name, false))
172172
{
173173
$app_name = KWUtils::findApp($app_name, true);
174174
}
175-
175+
176176
// escape parameters
177177
$escapedParams = array();
178178
foreach($params as $param)
179179
{
180180
$escapedParams[] = escapeshellarg($param);
181181
}
182-
182+
183183
// glue together app_name and params using spaces
184184
return escapeshellarg($app_name)." ".implode(" ", $escapedParams);
185-
}
186-
187-
188-
/**
185+
}
186+
187+
188+
/**
189189
* @method isExecutable will return true if the app can be found and is
190190
* executable, can optionally look in the path.
191191
* @param string $app_name, the app to check
@@ -198,7 +198,7 @@ public static function isExecutable($app_name, $check_in_path = false)
198198
{
199199
if($check_in_path)
200200
{
201-
try
201+
try
202202
{
203203
if(KWUtils::findApp($app_name, true))
204204
{
@@ -212,11 +212,11 @@ public static function isExecutable($app_name, $check_in_path = false)
212212
}
213213
return false;
214214
}
215-
return true;
216-
}
217-
215+
return true;
216+
}
217+
218218
/**
219-
* @method findApp will return the absolute path of an application
219+
* @method findApp will return the absolute path of an application
220220
* @param $app_name, the name of the application
221221
* @param $check_execution_flag, whether to include in the check that the
222222
* application is executable
@@ -226,11 +226,11 @@ public static function isExecutable($app_name, $check_in_path = false)
226226
*/
227227
public static function findApp($app_name, $check_execution_flag )
228228
{
229-
$PHP_PATH_SEPARATOR = ":";
229+
$PHP_PATH_SEPARATOR = ":";
230230
// split path
231-
$path_list = explode($PHP_PATH_SEPARATOR, getenv("PATH"));
232-
233-
// loop through paths
231+
$path_list = explode($PHP_PATH_SEPARATOR, getenv("PATH"));
232+
233+
// loop through paths
234234
foreach($path_list as $path)
235235
{
236236
$status = false;
@@ -239,41 +239,41 @@ public static function findApp($app_name, $check_execution_flag )
239239
{
240240
if(is_executable($path_to_app))
241241
{
242-
$status = true;
243-
break;
244-
}
242+
$status = true;
243+
break;
244+
}
245245
}
246246
else
247247
{
248248
if(file_exists($path_to_app))
249249
{
250250
$status = true;
251-
break;
251+
break;
252252
}
253253
}
254254
}
255255
if(!$status)
256256
{
257257
throw new Zend_Exception("Failed to locate the application: [".$app_name."] [check_execution_flag:".$check_execution_flag."]");
258258
}
259-
return $path_to_app;
260-
}
261-
262-
259+
return $path_to_app;
260+
}
261+
262+
263263

264264

265-
/**
265+
/**
266266
* @method formatAppName
267267
* Format the application name according to the platform.
268268
*/
269269
public static function formatAppName($app_name)
270270
{
271271
if(substr(PHP_OS, 0, 3) == "WIN")
272-
{
273-
$app_name = KWUtils::appendStringIfNot($app_name, ".exe");
272+
{
273+
$app_name = KWUtils::appendStringIfNot($app_name, ".exe");
274274
}
275-
return $app_name;
276-
}
277-
278-
275+
return $app_name;
276+
}
277+
278+
279279
}

modules/batchmake/controllers/ConfigController.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ public function indexAction()
6262
$applicationConfig = $this->ModuleComponent->KWBatchmake->loadConfigProperties();
6363
$configPropertiesRequirements = $this->ModuleComponent->KWBatchmake->getConfigPropertiesRequirements();
6464
$configForm = $this->ModuleForm->Config->createConfigForm($configPropertiesRequirements);
65-
$formArray = $this->getFormAsArray($configForm);
65+
$formArray = $this->getFormAsArray($configForm);
6666
foreach($configPropertiesRequirements as $configProperty => $configPropertyRequirement)
6767
{
6868
$formArray[$configProperty]->setValue($applicationConfig[$configProperty]);
69-
}
69+
}
7070
$this->view->configForm = $formArray;
71-
71+
7272
if($this->_request->isPost())
7373
{
7474
$this->_helper->layout->disableLayout();
@@ -83,20 +83,20 @@ public function indexAction()
8383
foreach($configPropertiesRequirements as $configProperty => $configPropertyRequirement)
8484
{
8585
$newsaver[MIDAS_BATCHMAKE_GLOBAL_CONFIG_NAME][$this->moduleName.'.'.$configProperty] = $this->_getParam($configProperty);
86-
}
86+
}
8787
$this->Component->Utility->createInitFile(MIDAS_BATCHMAKE_MODULE_LOCAL_CONFIG, $newsaver);
8888
$msg = $this->t(MIDAS_BATCHMAKE_CHANGES_SAVED_STRING);
8989
echo JsonComponent::encode(array(true, $msg));
9090
}
9191
}
9292

93-
}
93+
}
9494

9595

9696

9797
/**
98-
* @method testconfigAction()
99-
* ajax function which tests config setup, performing
98+
* @method testconfigAction()
99+
* ajax function which tests config setup, performing
100100
* validation on the current configuration set through the UI
101101
*/
102102
public function testconfigAction()
@@ -109,18 +109,18 @@ public function testconfigAction()
109109
$this->_helper->layout->disableLayout();
110110
$this->_helper->viewRenderer->setNoRender();
111111

112-
112+
113113
$configPropertiesParamVals = array();
114114
$configPropertiesRequirements = $this->ModuleComponent->KWBatchmake->getConfigPropertiesRequirements();
115115
foreach($configPropertiesRequirements as $configProperty => $configPropertyRequirement)
116116
{
117117
$configPropertiesParamVals[$configProperty] = $this->_getParam($configProperty);
118118
}
119-
119+
120120
$config_status = $this->ModuleComponent->KWBatchmake->testconfig($configPropertiesParamVals);
121121
$jsonout = JsonComponent::encode($config_status);
122122
echo $jsonout;
123123
}//end testconfigAction
124-
124+
125125

126126
}//end class

0 commit comments

Comments
 (0)