Skip to content

Commit 13f9500

Browse files
committed
Renamed a variable for readability
1 parent 885857c commit 13f9500

File tree

1 file changed

+27
-29
lines changed

1 file changed

+27
-29
lines changed

Symfony/src/Codebender/CompilerBundle/Handler/CompilerHandler.php

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,9 @@ function main($request, $compiler_config)
5656
$start_time = microtime(true);
5757

5858
// Step 0: Reject the request if the input data is not valid.
59-
//TODO: Replace $tmp variable name
60-
$tmp = $this->requestValid($request);
61-
if($tmp["success"] === false)
62-
return $tmp;
59+
$tmpVar = $this->requestValid($request);
60+
if($tmpVar["success"] === false)
61+
return $tmpVar;
6362

6463
$this->set_variables($request, $format, $libraries, $version, $mcu, $f_cpu, $core, $variant, $vid, $pid, $compiler_config);
6564

@@ -71,10 +70,10 @@ function main($request, $compiler_config)
7170

7271
// Step 1(part 1): Extract the project files included in the request.
7372
$files = array();
74-
$tmp = $this->extractFiles($request["files"], $TEMP_DIR, $compiler_dir, $files["sketch_files"], "files");
73+
$tmpVar = $this->extractFiles($request["files"], $TEMP_DIR, $compiler_dir, $files["sketch_files"], "files");
7574

76-
if ($tmp["success"] === false)
77-
return $tmp;
75+
if ($tmpVar["success"] === false)
76+
return $tmpVar;
7877

7978
// Add the compiler temp directory to the compiler_config struct.
8079
$compiler_config["compiler_dir"] = $compiler_dir;
@@ -83,9 +82,9 @@ function main($request, $compiler_config)
8382
$files["libs"] = array();
8483
foreach($libraries as $library => $library_files){
8584

86-
$tmp = $this->extractFiles($library_files, $TEMP_DIR, $compiler_dir, $files["libs"][$library], "libraries/$library", true);
87-
if ($tmp["success"] === false)
88-
return $tmp;
85+
$tmpVar = $this->extractFiles($library_files, $TEMP_DIR, $compiler_dir, $files["libs"][$library], "libraries/$library", true);
86+
if ($tmpVar["success"] === false)
87+
return $tmpVar;
8988
}
9089

9190
if (!array_key_exists("archive", $request) || ($request["archive"] !== false && $request["archive"] !== true))
@@ -100,20 +99,19 @@ function main($request, $compiler_config)
10099
}
101100

102101
//Set logging to true if requested, and create the directory where logfiles are stored.
103-
//TODO: Replace $tmp variable name
104-
$tmp = $this->setLoggingParams($request, $compiler_config, $TEMP_DIR, $compiler_dir);
105-
if($tmp["success"] === false)
106-
return array_merge($tmp, ($ARCHIVE_OPTION ===true) ? array("archive" => $ARCHIVE_PATH) : array());
102+
$tmpVar = $this->setLoggingParams($request, $compiler_config, $TEMP_DIR, $compiler_dir);
103+
if($tmpVar["success"] === false)
104+
return array_merge($tmpVar, ($ARCHIVE_OPTION ===true) ? array("archive" => $ARCHIVE_PATH) : array());
107105

108106
// Step 2: Preprocess Arduino source files.
109-
$tmp = $this->preprocessIno($files["sketch_files"]);
110-
if ($tmp["success"] === false)
111-
return array_merge($tmp, ($ARCHIVE_OPTION ===true) ? array("archive" => $ARCHIVE_PATH) : array());
107+
$tmpVar = $this->preprocessIno($files["sketch_files"]);
108+
if ($tmpVar["success"] === false)
109+
return array_merge($tmpVar, ($ARCHIVE_OPTION ===true) ? array("archive" => $ARCHIVE_PATH) : array());
112110

113111
// Step 3: Preprocess Header includes and determine which core files directory(CORE_DIR) will be used.
114-
$tmp = $this->preprocessHeaders($libraries, $include_directories, $compiler_dir, $ARDUINO_CORES_DIR, $EXTERNAL_CORES_DIR, $CORE_DIR, $CORE_OVERRIDE_DIR, $version, $core, $variant);
115-
if ($tmp["success"] === false)
116-
return array_merge($tmp, ($ARCHIVE_OPTION ===true) ? array("archive" => $ARCHIVE_PATH) : array());
112+
$tmpVar = $this->preprocessHeaders($libraries, $include_directories, $compiler_dir, $ARDUINO_CORES_DIR, $EXTERNAL_CORES_DIR, $CORE_DIR, $CORE_OVERRIDE_DIR, $version, $core, $variant);
113+
if ($tmpVar["success"] === false)
114+
return array_merge($tmpVar, ($ARCHIVE_OPTION ===true) ? array("archive" => $ARCHIVE_PATH) : array());
117115

118116
// Log the names of the project files and the libraries used in it.
119117
if ($format != "autocomplete") {
@@ -252,10 +250,10 @@ function main($request, $compiler_config)
252250
flock($lock, LOCK_EX);
253251
if (!file_exists($core_library)){
254252
//makeCoresTmp scans the core files directory and return list including the urls of the files included there.
255-
$tmp = $this->makeCoresTmp($CORE_DIR, $CORE_OVERRIDE_DIR, $TEMP_DIR, $compiler_dir, $files);
253+
$tmpVar = $this->makeCoresTmp($CORE_DIR, $CORE_OVERRIDE_DIR, $TEMP_DIR, $compiler_dir, $files);
256254

257-
if(!$tmp["success"]){
258-
return array_merge($tmp,
255+
if(!$tmpVar["success"]){
256+
return array_merge($tmpVar,
259257
($ARCHIVE_OPTION ===true) ? array("archive" => $ret["archive"]) : array(),
260258
($compiler_config['logging'] === true) ? array("log" => $ret["log"]) : array());
261259
}
@@ -382,26 +380,26 @@ function main($request, $compiler_config)
382380

383381
// Step 8: Convert the output to the requested format and measure its
384382
// size.
385-
$tmp = $this->convertOutput("$compiler_dir/files", $format, $SIZE, $SIZE_FLAGS, $OBJCOPY, $OBJCOPY_FLAGS, $OUTPUT, $start_time, $compiler_config);
383+
$tmpVar = $this->convertOutput("$compiler_dir/files", $format, $SIZE, $SIZE_FLAGS, $OBJCOPY, $OBJCOPY_FLAGS, $OUTPUT, $start_time, $compiler_config);
386384

387385
if ($compiler_config['logging'] === true) {
388386
$log_content = @file_get_contents($compiler_config['logFileName']);
389387
if (!$log_content)
390-
$tmp["log"] = "Failed to access logfile.";
388+
$tmpVar["log"] = "Failed to access logfile.";
391389
else {
392390
file_put_contents($compiler_config["compiler_dir"] . "/log", $log_content);
393-
$tmp["log"] = $log_content;
391+
$tmpVar["log"] = $log_content;
394392
}
395393
}
396394

397395
if ($ARCHIVE_OPTION === true){
398396
$arch_ret = $this->createArchive($compiler_dir, $TEMP_DIR, $ARCHIVE_DIR, $ARCHIVE_PATH);
399397
if ($arch_ret["success"] === false)
400-
$tmp["archive"] = $arch_ret["message"];
398+
$tmpVar["archive"] = $arch_ret["message"];
401399
else
402-
$tmp["archive"] = $ARCHIVE_PATH;
400+
$tmpVar["archive"] = $ARCHIVE_PATH;
403401
}
404-
return $tmp;
402+
return $tmpVar;
405403
}
406404

407405
private function requestValid(&$request)

0 commit comments

Comments
 (0)