Skip to content

Commit c1b4154

Browse files
committed
Fixed all PSR-1 Method Naming warnings (hopefuly)
1 parent b52fc76 commit c1b4154

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

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

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function main($request, $compiler_config)
4747
{
4848
error_reporting(E_ALL & ~E_STRICT);
4949

50-
$this->set_values($compiler_config,
50+
$this->setValues($compiler_config,
5151
$BINUTILS, $CLANG, $CFLAGS, $CPPFLAGS, $ASFLAGS, $ARFLAGS, $LDFLAGS, $LDFLAGS_TAIL,
5252
$CLANG_FLAGS, $OBJCOPY_FLAGS, $SIZE_FLAGS, $OUTPUT, $ARDUINO_CORES_DIR, $EXTERNAL_CORES_DIR,
5353
$TEMP_DIR, $ARCHIVE_DIR, $AUTOCC_DIR, $PYTHON, $AUTOCOMPLETER);
@@ -59,9 +59,9 @@ function main($request, $compiler_config)
5959
if ($tmpVar["success"] === false)
6060
return $tmpVar;
6161

62-
$this->set_variables($request, $format, $libraries, $version, $mcu, $f_cpu, $core, $variant, $vid, $pid, $compiler_config);
62+
$this->setVariables($request, $format, $libraries, $version, $mcu, $f_cpu, $core, $variant, $vid, $pid, $compiler_config);
6363

64-
$this->set_avr($version, $ARDUINO_CORES_DIR, $BINUTILS, $CC, $CPP, $AS, $AR, $LD, $OBJCOPY, $SIZE);
64+
$this->setAVR($version, $ARDUINO_CORES_DIR, $BINUTILS, $CC, $CPP, $AS, $AR, $LD, $OBJCOPY, $SIZE);
6565

6666
$target_arch = "-mmcu=$mcu -DARDUINO=$version -DF_CPU=$f_cpu -DUSB_VID=$vid -DUSB_PID=$pid";
6767
$clang_target_arch = "-D".MCUHandler::$MCU[$mcu]." -DARDUINO=$version -DF_CPU=$f_cpu";
@@ -438,7 +438,7 @@ function main($request, $compiler_config)
438438

439439
private function requestValid(&$request)
440440
{
441-
$request = $this->preproc->validate_input($request);
441+
$request = $this->preproc->validateInput($request);
442442
if (!$request)
443443
return array(
444444
"success" => false,
@@ -499,7 +499,7 @@ private function extractFiles($request, $temp_dir, &$dir, &$files, $suffix, $lib
499499
"step" => 1,
500500
"message" => "Failed to create temporary directory.");
501501

502-
$response = $this->utility->extract_files("$dir/$suffix", $request, $lib_extraction);
502+
$response = $this->utility->extractFiles("$dir/$suffix", $request, $lib_extraction);
503503

504504
if ($response["success"] === false)
505505
return $response;
@@ -513,7 +513,7 @@ private function preprocessIno(&$files)
513513
foreach ($files["ino"] as $file)
514514
{
515515
$code = file_get_contents("$file.ino");
516-
$new_code = $this->preproc->ino_to_cpp($code, "$file.ino");
516+
$new_code = $this->preproc->convertInoToCpp($code, "$file.ino");
517517
$ret = file_put_contents("$file.cpp", $new_code);
518518

519519
if ($code === false || !$new_code || !$ret)
@@ -675,7 +675,7 @@ private function doCompile($compiler_config, &$files, $dir, $CC, $CFLAGS, $CPP,
675675
$file = escapeshellarg($file);
676676
$object_file = escapeshellarg($object_file);
677677

678-
//replace exec() calls with $this->utility->debug_exec() for debugging
678+
//replace exec() calls with $this->utility->execWithDebugging() for debugging
679679
if ($ext == "c")
680680
{
681681
exec("$CC $CFLAGS $core_includes $target_arch $include_directories -c -o $object_file.o $file.$ext 2>&1", $output, $ret_compile);
@@ -710,7 +710,7 @@ private function doCompile($compiler_config, &$files, $dir, $CC, $CFLAGS, $CPP,
710710
file_put_contents($compiler_config['logFileName'], "$CLANG $CLANG_FLAGS $core_includes $clang_target_arch $include_directories -c -o $object_file.o $file.$ext\n", FILE_APPEND);
711711
}
712712

713-
$output = $this->postproc->ansi_to_html(implode("\n", $output));
713+
$output = $this->postproc->convertANSItoHTML(implode("\n", $output));
714714

715715
$resp = array(
716716
"success" => false,
@@ -868,7 +868,7 @@ private function convertOutput($dir, $format, $SIZE, $SIZE_FLAGS, $OBJCOPY, $OBJ
868868

869869
}
870870

871-
private function set_avr($version, $ARDUINO_CORES_DIR, $BINUTILS, &$CC, &$CPP, &$AS, &$AR, &$LD, &$OBJCOPY, &$SIZE)
871+
private function setAVR($version, $ARDUINO_CORES_DIR, $BINUTILS, &$CC, &$CPP, &$AS, &$AR, &$LD, &$OBJCOPY, &$SIZE)
872872
{
873873
// External binaries.
874874
$binaries = array("cc" => "-gcc", "cpp" => "-g++", "as" => "-gcc", "ar" => "-ar", "ld" => "-gcc", "objcopy" => "-objcopy", "size" => "-size");
@@ -892,7 +892,7 @@ private function set_avr($version, $ARDUINO_CORES_DIR, $BINUTILS, &$CC, &$CPP, &
892892

893893
}
894894

895-
private function set_values($compiler_config,
895+
private function setValues($compiler_config,
896896
&$BINUTILS, &$CLANG, &$CFLAGS, &$CPPFLAGS,
897897
&$ASFLAGS, &$ARFLAGS, &$LDFLAGS, &$LDFLAGS_TAIL, &$CLANG_FLAGS, &$OBJCOPY_FLAGS, &$SIZE_FLAGS,
898898
&$OUTPUT, &$ARDUINO_CORES_DIR, &$EXTERNAL_CORES_DIR, &$TEMP_DIR, &$ARCHIVE_DIR, &$AUTOCC_DIR, &$PYTHON, &$AUTOCOMPLETER)
@@ -902,7 +902,7 @@ private function set_values($compiler_config,
902902
//ones included in the binutils parameter
903903
$BINUTILS = $compiler_config["binutils"];
904904
//Clang is used to return the output in case of an error, it's version independent, so its
905-
//value is set by set_values function.
905+
//value is set by setValues function.
906906

907907
$LDLIBRARYPATH = "LD_LIBRARY_PATH=".$compiler_config["arduino_cores_dir"]."/clang/v3_5/lib:\$LD_LIBRARY_PATH";
908908
$CLANG = $LDLIBRARYPATH." ".$compiler_config["clang"];
@@ -936,7 +936,7 @@ private function set_values($compiler_config,
936936
$EXTERNAL_CORES_DIR = $compiler_config["external_core_files"];
937937
}
938938

939-
private function set_variables($request, &$format, &$libraries, &$version, &$mcu, &$f_cpu, &$core, &$variant, &$vid, &$pid, &$compiler_config)
939+
private function setVariables($request, &$format, &$libraries, &$version, &$mcu, &$f_cpu, &$core, &$variant, &$vid, &$pid, &$compiler_config)
940940
{
941941
// Extract the request options for easier access.
942942
$format = $request["format"];

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class PostprocessingHandler
2727
* <b>[</b>, and ends with <b>m</b>. The color code is placed in between. Multiple
2828
* color codes can be included, separated by semicolon.
2929
*/
30-
function ansi_to_html($text)
30+
function convertANSItoHTML($text)
3131
{
3232
$FORMAT = array(
3333
0 => NULL, // reset modes to default

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

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class PreprocessingHandler
4747
* \return string A copy of the code with no comments, single- or double- quoted strings
4848
* or pre-processor directives
4949
*/
50-
function remove_comments_directives_quotes($code)
50+
function removeCommentsDirectivesQuotes($code)
5151
{
5252
// Use a copy of the code and strip comments, pre-processor directives, single- and double-quoted strings
5353

@@ -61,10 +61,10 @@ function remove_comments_directives_quotes($code)
6161
}
6262

6363
/**
64-
* \param string $code The code returned from remove_comments_directives_quotes function
64+
* \param string $code The code returned from removeCommentsDirectivesQuotes function
6565
* \return string The input code having all top level braces collapsed
6666
*/
67-
function empty_braces($code)
67+
function emptyBraces($code)
6868
{
6969
// For every line of the code remove all the contents of top level braces
7070

@@ -105,7 +105,7 @@ function empty_braces($code)
105105
* \param string $code The code returned from empty_braces function
106106
* \return array An array including any prototypes found in the original code
107107
*/
108-
function find_existing_prototypes(&$code)
108+
function findExistingPrototypes(&$code)
109109
{
110110
// In this case, the original code is used. Existing prototypes are matched, stored, and then removed from
111111
//the code, so that in the next step the compiler knows which prototypes should really be generated
@@ -124,10 +124,10 @@ function find_existing_prototypes(&$code)
124124

125125
/**
126126
* \param string $code The sketch code provided to the compiler
127-
* \param array $existing_prototypes Array of prototypes returned by find_existing_prototypes function
127+
* \param array $existing_prototypes Array of prototypes returned by findExistingPrototypes function
128128
* \return string The string including the function prototypes for the code
129129
*/
130-
function generate_prototypes($code, $existing_prototypes)
130+
function generatePrototypes($code, $existing_prototypes)
131131
{
132132
// This function uses a regular expression to match all function declarations, generate the
133133
// respective prototype and store all the prototypes in a string
@@ -171,7 +171,7 @@ function generate_prototypes($code, $existing_prototypes)
171171
* \param string $code The sketch code
172172
* \return int The position where function prototypes should be placed
173173
*/
174-
function insertion_position($code)
174+
function insertionPosition($code)
175175
{
176176
// Use the following regular expression to match whitespaces, single- and multiline comments and preprocessor directives
177177
$regex = "/(\s+|(\/\*[^*]*(?:\*(?!\/)[^*]*)*\*\/)|(\/\/.*?$)|(\#(?:\\\\\\n|.)*))/m";
@@ -205,15 +205,15 @@ function insertion_position($code)
205205

206206
/**
207207
* \param string $code The initial sketch code
208-
* \param $function_prototypes The function prototypes returned by generate_prototypes function
208+
* \param $function_prototypes The function prototypes returned by generatePrototypes function
209209
* \param int $position The position to place the prototypes returned by insertion_position function
210210
* \return string Valid c++ code
211211
*/
212-
function build_code($code, $function_prototypes, $position)
212+
function buildCode($code, $function_prototypes, $position)
213213
{
214214

215215
// To build the final code, the compiler starts adding every character of the original string, until the position
216-
// found by insertion_position is reached. Then, the function prototypes are added, as well as a preprocessor
216+
// found by insertionPosition is reached. Then, the function prototypes are added, as well as a preprocessor
217217
//directive to fix the line numbering.
218218
$line = 1;
219219
$return_code = "";
@@ -249,19 +249,19 @@ function build_code($code, $function_prototypes, $position)
249249
return $return_code;
250250
}
251251

252-
function ino_to_cpp($code, $filename = NULL)
252+
function convertInoToCpp($code, $filename = NULL)
253253
{
254254
// Remove comments, preprocessor directives, single- and double- quotes
255-
$no_comms_code = $this->remove_comments_directives_quotes($code);
255+
$no_comms_code = $this->removeCommentsDirectivesQuotes($code);
256256
// Remove any code between all top level braces
257-
$empty_braces_code = $this->empty_braces($no_comms_code);
257+
$empty_braces_code = $this->emptyBraces($no_comms_code);
258258
// Find already existing prototypes
259-
$existing_prototypes = $this->find_existing_prototypes($empty_braces_code);
259+
$existing_prototypes = $this->findExistingPrototypes($empty_braces_code);
260260
// Generate prototypes that do not already exist
261-
$function_prototypes = $this->generate_prototypes($empty_braces_code, $existing_prototypes);
261+
$function_prototypes = $this->generatePrototypes($empty_braces_code, $existing_prototypes);
262262
// Find the right place to insert the function prototypes (after any preprocessor directives, comments,
263263
// before any function declaration)
264-
$insertion_position = $this->insertion_position($code);
264+
$insertion_position = $this->insertionPosition($code);
265265

266266
$new_code = "";
267267
// Add a preprocessor directive for line numbering.
@@ -270,7 +270,7 @@ function ino_to_cpp($code, $filename = NULL)
270270
else
271271
$new_code .= "#line 1\n";
272272
// Build the new code for the cpp file that will eventually be compiled
273-
$new_code .= $this->build_code($code, $function_prototypes, $insertion_position);
273+
$new_code .= $this->buildCode($code, $function_prototypes, $insertion_position);
274274

275275
return $new_code;
276276

@@ -283,7 +283,7 @@ function ino_to_cpp($code, $filename = NULL)
283283
* \param string $request The JSON-encoded compile request.
284284
* \return The value encoded in JSON in appropriate PHP type or <b>NULL</b>.
285285
*/
286-
function validate_input($request)
286+
function validateInput($request)
287287
{
288288
$request = json_decode($request, true);
289289

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class UtilityHandler
3030
* In case of error, the return value is an array that has a key <b>success</b>
3131
* and contains the response to be sent back to the user.
3232
*/
33-
function extract_files($directory, $request_files, $lib_extraction)
33+
function extractFiles($directory, $request_files, $lib_extraction)
3434
{
3535
// File extensions used by Arduino projects. They are put in a string,
3636
// separated by "|" to be used in regular expressions. They are also
@@ -135,7 +135,7 @@ function get_files_by_extension($directory, $extensions)
135135
*
136136
* \warning It is not possible to redirect the standard error output to a file.
137137
*/
138-
function debug_exec($command, /** @noinspection PhpUnusedParameterInspection */
138+
function execWithDebugging($command, /** @noinspection PhpUnusedParameterInspection */
139139
&$output, /** @noinspection PhpUnusedParameterInspection */
140140
&$retval)
141141
{

0 commit comments

Comments
 (0)