Skip to content

Commit b95e3be

Browse files
committed
chore: add initial project structure with files and strict typing declarations
1 parent ef6f606 commit b95e3be

30 files changed

+154
-0
lines changed

createDirectory.php

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
function createDirectory(string $path): void
6+
{
7+
if (!is_dir($path)) {
8+
mkdir($path, 0777, true);
9+
}
10+
}
11+
12+
function createFile(string $filePath): void
13+
{
14+
$content = "<?php\n\ndeclare(strict_types=1);\n";
15+
if (!file_exists($filePath)) {
16+
file_put_contents($filePath, $content);
17+
}
18+
}
19+
20+
$baseDir = __DIR__ . '/src';
21+
22+
// Directories and their respective files
23+
$structure = [
24+
'AbstractException.php',
25+
'AbstractErrorMessage.php',
26+
'Contract/ErrorMessage.php',
27+
'Contract/Throwable.php',
28+
'CommonErrorMessages.php',
29+
'Auth/AuthenticationException.php',
30+
'Auth/AuthorizationException.php',
31+
'Validation/ValidationException.php',
32+
'Validation/RuleViolationException.php',
33+
'File/FileException.php',
34+
'Input/InputException.php',
35+
'Runtime/RuntimeException.php',
36+
'System/SystemException.php',
37+
'Security/SecurityException.php',
38+
'Security/EncryptionException.php',
39+
'Config/ConfigurationException.php',
40+
'Network/NetworkException.php',
41+
'Network/HttpException.php',
42+
'Database/DatabaseException.php',
43+
'Cache/CacheException.php',
44+
'ExternalService/ExternalServiceException.php',
45+
'Localization/LocalizationException.php',
46+
'Event/EventException.php',
47+
'Middleware/MiddlewareException.php',
48+
'Queue/QueueException.php',
49+
'Routing/RoutingException.php',
50+
'Template/TemplateException.php',
51+
'Session/SessionException.php',
52+
'Container/ContainerException.php',
53+
];
54+
55+
// Create directories and files
56+
foreach ($structure as $filePath) {
57+
$fullPath = $baseDir . '/' . $filePath;
58+
$directory = dirname($fullPath);
59+
60+
// Create the directory if it doesn't exist
61+
createDirectory($directory);
62+
63+
// Create the file with the appropriate content
64+
createFile($fullPath);
65+
}
66+
67+
echo "Directories and files created successfully!\n";

src/AbstractErrorMessage.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
declare(strict_types=1);

src/AbstractException.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
declare(strict_types=1);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
declare(strict_types=1);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
declare(strict_types=1);

src/Cache/CacheException.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
declare(strict_types=1);

src/CommonErrorMessages.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
declare(strict_types=1);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
declare(strict_types=1);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
declare(strict_types=1);

src/Contract/ErrorMessage.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
declare(strict_types=1);

0 commit comments

Comments
 (0)