Skip to content

Commit 1d62466

Browse files
authored
Merge pull request #19 from dconco/dev
Maked the functions to add data to the bin const_types file
2 parents a55be86 + 4669ed0 commit 1d62466

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

App/PhpSlides.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,23 +337,33 @@ public static function config(bool $request_log = true)
337337
$data = "<?php\n\n";
338338

339339
$arr_num = [];
340+
$arr_const_types = [];
340341
$arr_keys = array_keys($web_file);
341342
$arr_vals = array_values($web_file);
342343

344+
// Looping over the web.php array
345+
// Generate random array number key to store in bin const_types
343346
for ($i = 0; $i < count($web_file); $i++)
344347
{
345348
$rand = rand(0, 999);
346349

347350
if (in_array($rand, $arr_num))
348351
{
349352
$rand = rand(0, 9999);
353+
array_push($arr_num, $rand);
354+
$arr_const_types[$rand] = $arr_vals[$i];
350355
}
351356
else
352357
{
353358
array_push($arr_num, $rand);
359+
$arr_const_types[$rand] = $arr_vals[$i];
354360
}
355361
}
356362

363+
// Add the const_types information to the file
364+
$const_types_data = "<?php\n\nreturn " . var_export($arr_const_types, true) . ';';
365+
file_put_contents($dir . '/App/bin/const_types.php', $const_types_data);
366+
357367
$arr_index = 0;
358368
// Looping over the web.php array
359369
foreach ($web_file as $key => $value)

App/bin/const_types.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3-
return [
4-
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
5-
];
3+
return array(
4+
928 =>
5+
array(
6+
0 => 'PhpSlides\\Controller\\PostsController',
7+
1 => '__invoke',
8+
),
9+
443 =>
10+
array(
11+
0 => 'PhpSlides\\Controller\\PostsController',
12+
1 => 'Post',
13+
),
14+
);

0 commit comments

Comments
 (0)