forked from N1375/CalenderOfCode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create.php
39 lines (30 loc) · 795 Bytes
/
create.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
require_once "Util/functions.php";
$year = getVal('year');
$day = getVal('day');
$part = getVal('part');
if (is_null($day) || is_null($part))
exit(0);
$classFullName = constructDayClassFullName($year, $day, $part);
$fileName = str_replace('\\', DIRECTORY_SEPARATOR, $classFullName).'.php';
$namespace = constructNamespace($year, $day);
$className = constructDayClassName($day, $part);
$extends = $part == 2
? "extends " . constructDayClassName($day, 1)
: "";
$classContent = "<?php
namespace $namespace;
class $className $extends implements \Days\Day
{
public function run(array \$input): int|string
{
return 'Not Implemented';
}
}
";
forceFilePutContents($fileName, $classContent);
if (file_exists($fileName)) {
echo 1;
} else {
echo 0;
}