formatting

This commit is contained in:
Shish
2019-09-29 14:30:55 +01:00
parent 56e247faf5
commit a6bb15d859
108 changed files with 424 additions and 429 deletions

View File

@ -759,7 +759,7 @@ function validate_input(array $inputs): array
*/
function sanitize_path(string $path): string
{
return preg_replace('|[\\\\/]+|S',DIRECTORY_SEPARATOR,$path);
return preg_replace('|[\\\\/]+|S', DIRECTORY_SEPARATOR, $path);
}
/**
@ -770,11 +770,11 @@ function join_path(string ...$paths): string
{
$output = "";
foreach ($paths as $path) {
if(empty($path)) {
if (empty($path)) {
continue;
}
$path = sanitize_path($path);
if(empty($output)) {
if (empty($output)) {
$output = $path;
} else {
$output = rtrim($output, DIRECTORY_SEPARATOR);
@ -790,8 +790,8 @@ function join_path(string ...$paths): string
*/
function iterator_map(callable $callback, iterator $iter): Generator
{
foreach($iter as $i) {
yield call_user_func($callback,$i);
foreach ($iter as $i) {
yield call_user_func($callback, $i);
}
}
@ -810,12 +810,16 @@ function get_class_from_file(string $file): string
$class = $buffer = '';
$i = 0;
while (!$class) {
if (feof($fp)) break;
if (feof($fp)) {
break;
}
$buffer .= fread($fp, 512);
$tokens = token_get_all($buffer);
if (strpos($buffer, '{') === false) continue;
if (strpos($buffer, '{') === false) {
continue;
}
for (;$i<count($tokens);$i++) {
if ($tokens[$i][0] === T_CLASS) {
@ -828,4 +832,4 @@ function get_class_from_file(string $file): string
}
}
return $class;
}
}