Skip to content

Commit 0ee4557

Browse files
committed
Auto-Formated UtilityHandler
1 parent 29eab63 commit 0ee4557

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

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

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@
1313
class UtilityHandler
1414
{
1515
/**
16-
\brief Extracts the files included in a compile request.
17-
18-
\param string $directory The directory to extract the files to.
19-
\param array $request_files The files structure, as taken from the JSON request.
20-
\return A list of files or a reply message in case of error.
21-
22-
Takes the files structure from a compile request and creates each file in a
23-
specified directory. If requested, it may create additional directories and
24-
have the files placed inside them accordingly.
25-
26-
Also creates a new structure where each key is the file extension and the
27-
associated value is an array containing the absolute paths of the file, minus
28-
the extension.
29-
30-
In case of error, the return value is an array that has a key <b>success</b>
31-
and contains the response to be sent back to the user.
16+
* \brief Extracts the files included in a compile request.
17+
*
18+
* \param string $directory The directory to extract the files to.
19+
* \param array $request_files The files structure, as taken from the JSON request.
20+
* \return A list of files or a reply message in case of error.
21+
*
22+
* Takes the files structure from a compile request and creates each file in a
23+
* specified directory. If requested, it may create additional directories and
24+
* have the files placed inside them accordingly.
25+
*
26+
* Also creates a new structure where each key is the file extension and the
27+
* associated value is an array containing the absolute paths of the file, minus
28+
* the extension.
29+
*
30+
* In case of error, the return value is an array that has a key <b>success</b>
31+
* and contains the response to be sent back to the user.
3232
*/
3333
function extract_files($directory, $request_files, $lib_extraction)
3434
{
@@ -48,14 +48,14 @@ function extract_files($directory, $request_files, $lib_extraction)
4848
// Examples: foo.c bar.cpp
4949
$REGEX = "/(.*)\.($EXTENSIONS)$/";
5050

51-
if(!file_exists($directory))
52-
mkdir($directory, 0777, true);
51+
if (!file_exists($directory))
52+
mkdir($directory, 0777, true);
5353

5454
foreach ($request_files as $file)
5555
{
5656
$filename = $file["filename"];
5757
$content = $file["content"];
58-
$ignore = false;
58+
$ignore = false;
5959

6060
$failure_response = array(
6161
"success" => false,
@@ -72,22 +72,22 @@ function extract_files($directory, $request_files, $lib_extraction)
7272
{
7373
$new_directory = pathinfo($filename, PATHINFO_DIRNAME);
7474

75-
if (($lib_extraction === true) && ($new_directory !== "utility"))
76-
$ignore = true;
77-
if (!file_exists("$directory/$new_directory"))
78-
mkdir("$directory/$new_directory", 0777, true);
79-
// There is no reason to check whether mkdir()
80-
// succeeded, given that the call to
81-
// file_put_contents() that follows would fail
82-
// as well.
75+
if (($lib_extraction === true) && ($new_directory !== "utility"))
76+
$ignore = true;
77+
if (!file_exists("$directory/$new_directory"))
78+
mkdir("$directory/$new_directory", 0777, true);
79+
// There is no reason to check whether mkdir()
80+
// succeeded, given that the call to
81+
// file_put_contents() that follows would fail
82+
// as well.
8383

8484
}
8585

8686
if (file_put_contents("$directory/$filename", $content) === false)
8787
return $failure_response;
8888

89-
if ($ignore)
90-
continue;
89+
if ($ignore)
90+
continue;
9191

9292
if (preg_match($REGEX, $filename, $matches))
9393
$files[$matches[2]][] = "$directory/$matches[1]";
@@ -100,11 +100,11 @@ function extract_files($directory, $request_files, $lib_extraction)
100100
}
101101

102102
/**
103-
\brief Searches for files with specific extensions in a directory.
104-
105-
\param string $directory The directory to search for files.
106-
\param mixed $extensions An array of strings, the extensions to look for.
107-
\return A list of files that have the appropriate extension.
103+
* \brief Searches for files with specific extensions in a directory.
104+
*
105+
* \param string $directory The directory to search for files.
106+
* \param mixed $extensions An array of strings, the extensions to look for.
107+
* \return A list of files that have the appropriate extension.
108108
*/
109109
function get_files_by_extension($directory, $extensions)
110110
{
@@ -120,20 +120,20 @@ function get_files_by_extension($directory, $extensions)
120120
}
121121

122122
/**
123-
\brief Executes a command and displays the command itself and its output.
124-
125-
\param string $command The command to be executed.
126-
127-
Simplifies the creation and debugging of pages that rely on multiple external
128-
programs by "emulating" the execution of the requested command in a terminal
129-
emulator. Can be useful during early stages of development. Replace with
130-
<b>exec()</b> afterwards.
131-
132-
To perform the command execution, <b>passthru()</b> is used. The string
133-
<b>2\>&1</b> is appended to the command to ensure messages sent to standard
134-
error are not lost.
135-
136-
\warning It is not possible to redirect the standard error output to a file.
123+
* \brief Executes a command and displays the command itself and its output.
124+
*
125+
* \param string $command The command to be executed.
126+
*
127+
* Simplifies the creation and debugging of pages that rely on multiple external
128+
* programs by "emulating" the execution of the requested command in a terminal
129+
* emulator. Can be useful during early stages of development. Replace with
130+
* <b>exec()</b> afterwards.
131+
*
132+
* To perform the command execution, <b>passthru()</b> is used. The string
133+
* <b>2\>&1</b> is appended to the command to ensure messages sent to standard
134+
* error are not lost.
135+
*
136+
* \warning It is not possible to redirect the standard error output to a file.
137137
*/
138138
function debug_exec($command, /** @noinspection PhpUnusedParameterInspection */
139139
&$output, /** @noinspection PhpUnusedParameterInspection */

0 commit comments

Comments
 (0)