Skip to content

Commit c521ed7

Browse files
committed
revert change in filesystem
1 parent b87ee39 commit c521ed7

File tree

4 files changed

+51
-6
lines changed

4 files changed

+51
-6
lines changed

app/Config/Routes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
* @var RouteCollection $routes
77
*/
88
$routes->get('/', 'Home::index');
9+
$routes->get('filesystem', 'Home::filesystem');

app/Controllers/Home.php

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,34 @@
44

55
class Home extends BaseController
66
{
7-
public function index(): string
7+
public function index()
88
{
9-
return view('welcome_message');
9+
helper('form');
10+
11+
timer('set_radio');
12+
13+
for ($i = 0; $i < 10000; $i++) {
14+
set_radio('nama_' . $i, 'val' . $i);
15+
}
16+
timer('set_radio');
17+
18+
echo timer()->getElapsedTime('set_radio');
19+
}
20+
21+
public function filesystem()
22+
{
23+
helper('filesystem');
24+
25+
$tempAverage = [];
26+
27+
for ($i = 0; $i < 100; $i++) {
28+
timer('get_filenames');
29+
get_filenames(ROOTPATH, true, true, true);
30+
timer('get_filenames');
31+
32+
$tempAverage[$i] = timer()->getElapsedTime('get_filenames');
33+
}
34+
35+
echo array_sum($tempAverage) / count($tempAverage);
1036
}
1137
}

system/Helpers/filesystem_helper.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,13 @@ function get_filenames(
218218
}
219219

220220
if ($includeDir || ! $object->isDir()) {
221-
$files[] = $includePath === false ? $basename : ($includePath === null ? str_replace($sourceDir, '', $name) : $name);
221+
if ($includePath === false) {
222+
$files[] = $basename;
223+
} elseif ($includePath === null) {
224+
$files[] = str_replace($sourceDir, '', $name);
225+
} else {
226+
$files[] = $name;
227+
}
222228
}
223229
}
224230
} catch (Throwable $e) {

system/ThirdParty/Escaper/Escaper.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,21 @@ public function __construct(?string $encoding = null)
157157
$this->htmlSpecialCharsFlags = ENT_QUOTES | ENT_SUBSTITUTE;
158158

159159
// set matcher callbacks
160-
$this->htmlAttrMatcher = [$this, 'htmlAttrMatcher'];
161-
$this->jsMatcher = [$this, 'jsMatcher'];
162-
$this->cssMatcher = [$this, 'cssMatcher'];
160+
$this->htmlAttrMatcher =
161+
/** @param array<array-key, string> $matches */
162+
function (array $matches): string {
163+
return $this->htmlAttrMatcher($matches);
164+
};
165+
$this->jsMatcher =
166+
/** @param array<array-key, string> $matches */
167+
function (array $matches): string {
168+
return $this->jsMatcher($matches);
169+
};
170+
$this->cssMatcher =
171+
/** @param array<array-key, string> $matches */
172+
function (array $matches): string {
173+
return $this->cssMatcher($matches);
174+
};
163175
}
164176

165177
/**

0 commit comments

Comments
 (0)