From 166db905786d362f9dbf5abc80fa8671b5738f01 Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Wed, 24 Jul 2024 13:44:41 +0200 Subject: [PATCH 01/17] PUSH -> Test --- .github/workflows/ci.yml | 8 +- .gitignore | 3 +- addons/Example/Example.php | 0 addons/Example/MythicalFramework.json | 0 addons/data.json | 0 api/System/logs.php | 0 api/User/login.php | 0 app/Database/MySQL.php | 123 +++++++++ app/Database/MySQLCache.php | 95 +++++++ app/Database/Redis/Redis.php | 13 + app/Handlers/NotificationHandler.php | 240 +++++++++++++----- .../AnnouncementNotFoundException.php | 0 .../NotificationNotFoundException.php | 11 + .../interfaces/AnnouncementSocial.php | 0 app/Kernel/Debugger.php | 0 app/Kernel/Encryption.php | 0 app/Kernel/LoggerLevels.php | 0 app/Kernel/LoggerTypes.php | 0 app/Managers/ConfigManager.php | 14 +- app/Managers/Settings.php | 54 ++++ app/Managers/SettingsManager.php | 16 +- app/Plugins/Events/ActivityEvent.php | 0 app/Plugins/Events/AnnouncementEvent.php | 0 app/Plugins/Events/ApplicationEvent.php | 0 app/Plugins/Events/CliCommandEvent.php | 0 app/Plugins/Events/ConfigEvent.php | 0 app/Plugins/Events/CronEvent.php | 0 app/Plugins/Events/DatabaseEvent.php | 0 app/Plugins/Events/EncryptionEvent.php | 0 app/Plugins/Events/ExceptionEvent.php | 0 app/Plugins/Events/LoggerEvent.php | 0 app/Plugins/Events/NotificationEvent.php | 0 app/Plugins/Events/PageEvent.php | 0 app/Plugins/Events/PermissionEvent.php | 0 app/Plugins/Events/RendererEvent.php | 0 app/Plugins/Events/RoleEvent.php | 0 app/Plugins/Events/RouterEvent.php | 0 app/Plugins/Events/SettingEvent.php | 0 app/Plugins/Events/SnowFlakeEvent.php | 0 app/Plugins/Events/TranslationEvent.php | 0 app/Plugins/Events/UnitTestEvent.php | 0 app/Plugins/Events/UserEvent.php | 0 app/Plugins/PluginsEventHandler.php | 0 app/Plugins/PluginsManager.php | 0 app/Roles/RolesDataHandler.php | 0 app/Roles/RolesHelper.php | 0 app/Roles/RolesPermissionDataHandler.php | 0 app/User/Exceptions/UserException.php | 0 app/User/UserHelper.php | 0 caches/.gitkeep | 0 commands/core/config/configmigrate.php | 3 +- composer.lock | 0 cron/jobs/SettingsJob.php | 7 + cron/jobs/cacheJob.php | 2 +- cron/runner.php | 12 + devtools/push.bash | 0 devtools/restore.bash | 0 devtools/setup_permissions.bash | 3 + docs/devs/Roles.md | 0 docs/devs/User.md | 0 docs/devs/design.prompt | 0 docs/plugins/events.md | 0 docs/users/Install.md | 2 + docs/users/OS/deb.md | 0 docs/users/OS/ubuntu.md | 0 docs/users/WEBSERVERS/apache2.md | 0 docs/users/WEBSERVERS/nginx.md | 0 docs/users/WEBSERVERS/ssl.md | 0 framework | 2 +- .../config/{11%3A28_05.05.2024.php => 1.php} | 0 .../config/{13%3A00_16.05.2024.php => 2.php} | 0 migrate/config/3.php | 4 + migrate/database/1.sql | 0 migrate/database/10.sql | 1 + migrate/database/11.sql | 2 + migrate/database/12.sql | 1 + migrate/database/13.sql | 1 + migrate/database/14.sql | 1 + migrate/database/15.sql | 1 + migrate/database/2.sql | 2 +- migrate/database/3.sql | 1 + migrate/database/4.sql | 1 + migrate/database/5.sql | 1 + migrate/database/6.sql | 1 + migrate/database/7.sql | 1 + migrate/database/8.sql | 1 + migrate/database/9.sql | 1 + package.json | 0 postcss.config.js | 0 public/index.php | 7 +- public/style.css | 0 public/third_party/JQuery/jquery-3.7.1.min.js | 0 .../SweetAlert2/sweetalert2.all.min.js | 0 .../SweetAlert2/sweetalert2.min.css | 0 routes/api/system.php | 0 routes/views/core.php | 0 settings.json | 4 +- styles.css | 0 tailwind.config.js | 0 tests/EncryptionTest.php | 41 +++ themes/default/errors/401.twig | 0 themes/default/errors/403.twig | 0 themes/default/errors/404.twig | 0 themes/default/errors/500.twig | 0 themes/default/errors/debug.twig | 0 themes/default/includes/page_footer.twig | 0 themes/default/includes/page_head.twig | 0 107 files changed, 597 insertions(+), 83 deletions(-) mode change 100644 => 100755 addons/Example/Example.php mode change 100644 => 100755 addons/Example/MythicalFramework.json mode change 100644 => 100755 addons/data.json mode change 100644 => 100755 api/System/logs.php mode change 100644 => 100755 api/User/login.php create mode 100755 app/Database/MySQLCache.php create mode 100755 app/Database/Redis/Redis.php mode change 100644 => 100755 app/Handlers/exception/AnnouncementNotFoundException.php create mode 100755 app/Handlers/exception/NotificationNotFoundException.php mode change 100644 => 100755 app/Handlers/interfaces/AnnouncementSocial.php mode change 100644 => 100755 app/Kernel/Debugger.php mode change 100644 => 100755 app/Kernel/Encryption.php mode change 100644 => 100755 app/Kernel/LoggerLevels.php mode change 100644 => 100755 app/Kernel/LoggerTypes.php create mode 100755 app/Managers/Settings.php mode change 100644 => 100755 app/Managers/SettingsManager.php mode change 100644 => 100755 app/Plugins/Events/ActivityEvent.php mode change 100644 => 100755 app/Plugins/Events/AnnouncementEvent.php mode change 100644 => 100755 app/Plugins/Events/ApplicationEvent.php mode change 100644 => 100755 app/Plugins/Events/CliCommandEvent.php mode change 100644 => 100755 app/Plugins/Events/ConfigEvent.php mode change 100644 => 100755 app/Plugins/Events/CronEvent.php mode change 100644 => 100755 app/Plugins/Events/DatabaseEvent.php mode change 100644 => 100755 app/Plugins/Events/EncryptionEvent.php mode change 100644 => 100755 app/Plugins/Events/ExceptionEvent.php mode change 100644 => 100755 app/Plugins/Events/LoggerEvent.php mode change 100644 => 100755 app/Plugins/Events/NotificationEvent.php mode change 100644 => 100755 app/Plugins/Events/PageEvent.php mode change 100644 => 100755 app/Plugins/Events/PermissionEvent.php mode change 100644 => 100755 app/Plugins/Events/RendererEvent.php mode change 100644 => 100755 app/Plugins/Events/RoleEvent.php mode change 100644 => 100755 app/Plugins/Events/RouterEvent.php mode change 100644 => 100755 app/Plugins/Events/SettingEvent.php mode change 100644 => 100755 app/Plugins/Events/SnowFlakeEvent.php mode change 100644 => 100755 app/Plugins/Events/TranslationEvent.php mode change 100644 => 100755 app/Plugins/Events/UnitTestEvent.php mode change 100644 => 100755 app/Plugins/Events/UserEvent.php mode change 100644 => 100755 app/Plugins/PluginsEventHandler.php mode change 100644 => 100755 app/Plugins/PluginsManager.php mode change 100644 => 100755 app/Roles/RolesDataHandler.php mode change 100644 => 100755 app/Roles/RolesHelper.php mode change 100644 => 100755 app/Roles/RolesPermissionDataHandler.php mode change 100644 => 100755 app/User/Exceptions/UserException.php mode change 100644 => 100755 app/User/UserHelper.php create mode 100755 caches/.gitkeep mode change 100644 => 100755 composer.lock create mode 100755 cron/jobs/SettingsJob.php mode change 100644 => 100755 devtools/push.bash mode change 100644 => 100755 devtools/restore.bash create mode 100755 devtools/setup_permissions.bash mode change 100644 => 100755 docs/devs/Roles.md mode change 100644 => 100755 docs/devs/User.md mode change 100644 => 100755 docs/devs/design.prompt mode change 100644 => 100755 docs/plugins/events.md mode change 100644 => 100755 docs/users/Install.md mode change 100644 => 100755 docs/users/OS/deb.md mode change 100644 => 100755 docs/users/OS/ubuntu.md mode change 100644 => 100755 docs/users/WEBSERVERS/apache2.md mode change 100644 => 100755 docs/users/WEBSERVERS/nginx.md mode change 100644 => 100755 docs/users/WEBSERVERS/ssl.md rename migrate/config/{11%3A28_05.05.2024.php => 1.php} (100%) rename migrate/config/{13%3A00_16.05.2024.php => 2.php} (100%) create mode 100755 migrate/config/3.php mode change 100644 => 100755 migrate/database/1.sql create mode 100755 migrate/database/10.sql create mode 100755 migrate/database/11.sql create mode 100755 migrate/database/12.sql create mode 100755 migrate/database/13.sql create mode 100755 migrate/database/14.sql create mode 100755 migrate/database/15.sql mode change 100644 => 100755 migrate/database/2.sql create mode 100755 migrate/database/3.sql create mode 100755 migrate/database/4.sql create mode 100755 migrate/database/5.sql create mode 100755 migrate/database/6.sql create mode 100755 migrate/database/7.sql create mode 100755 migrate/database/8.sql create mode 100755 migrate/database/9.sql mode change 100644 => 100755 package.json mode change 100644 => 100755 postcss.config.js mode change 100644 => 100755 public/style.css mode change 100644 => 100755 public/third_party/JQuery/jquery-3.7.1.min.js mode change 100644 => 100755 public/third_party/SweetAlert2/sweetalert2.all.min.js mode change 100644 => 100755 public/third_party/SweetAlert2/sweetalert2.min.css mode change 100644 => 100755 routes/api/system.php mode change 100644 => 100755 routes/views/core.php mode change 100644 => 100755 styles.css mode change 100644 => 100755 tailwind.config.js create mode 100755 tests/EncryptionTest.php mode change 100644 => 100755 themes/default/errors/401.twig mode change 100644 => 100755 themes/default/errors/403.twig mode change 100644 => 100755 themes/default/errors/404.twig mode change 100644 => 100755 themes/default/errors/500.twig mode change 100644 => 100755 themes/default/errors/debug.twig mode change 100644 => 100755 themes/default/includes/page_footer.twig mode change 100644 => 100755 themes/default/includes/page_head.twig diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7e694f1..964fe7c 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -138,4 +138,10 @@ jobs: ${{ steps.composer-cache.outputs.vcs_cache }} key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: | - ${{ runner.os }}-composer- \ No newline at end of file + ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer validate --no-check-publish && composer install --prefer-dist --no-progress + + - name: Run PHPUnit + run: composer run tests \ No newline at end of file diff --git a/.gitignore b/.gitignore index fe51570..e1ff5e2 100755 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ composer.phar /package-lock.json /node_modules /test.json -/caches/* \ No newline at end of file +/caches/*/ +caches/last_settings_migrate_run diff --git a/addons/Example/Example.php b/addons/Example/Example.php old mode 100644 new mode 100755 diff --git a/addons/Example/MythicalFramework.json b/addons/Example/MythicalFramework.json old mode 100644 new mode 100755 diff --git a/addons/data.json b/addons/data.json old mode 100644 new mode 100755 diff --git a/api/System/logs.php b/api/System/logs.php old mode 100644 new mode 100755 diff --git a/api/User/login.php b/api/User/login.php old mode 100644 new mode 100755 diff --git a/app/Database/MySQL.php b/app/Database/MySQL.php index 7c854f0..934f8b3 100755 --- a/app/Database/MySQL.php +++ b/app/Database/MySQL.php @@ -9,6 +9,7 @@ use PDO; use PDOException; use mysqli; +use Exception; class MySQL { @@ -95,4 +96,126 @@ public function tryConnection(string $host, string|int $port, string $username, return false; } } + + /** + * Try to lock a record! + * + * @param string $table The table name! + * @param string $id The record id! + * + * @return void + */ + public function requestLock(string $table, string $id): void + { + try { + if (self::doesTableExist($table) === false) { + return; + } + $mysqli = new MySQL(); + $conn = $mysqli->connectMYSQLI(); + $stmt = $conn->prepare("UPDATE ? SET `locked` = 'true' WHERE `id` = ?;"); + $stmt->bind_param("si", $table, $id); + $stmt->execute(); + $stmt->close(); + } catch (Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "Failed to lock table: " . $e); + return; + } + } + /** + * Try to unlock a record. + * Unlock a record so you can write and read it! + * + * @param string $table The table name! + * @param string $id The id of the record! + * + * @return void + */ + public static function requestUnLock(string $table, string $id): void + { + try { + if (self::doesTableExist($table) === false) { + return; + } + $mysqli = new MySQL(); + $conn = $mysqli->connectMYSQLI(); + $stmt = $conn->prepare("UPDATE ? SET `locked` = 'false' WHERE `id` = ?;"); + $stmt->bind_param("si", $table, $id); + $stmt->execute(); + $stmt->close(); + } catch (Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "Failed to unlock table: " . $e); + return; + } + } + /** + * Get the lock status of a record. + * + * @param string $table The table name + * @param string $id The id of the record + * + * @return bool + */ + public static function getLock(string $table, string $id): bool + { + try { + if (self::doesTableExist($table) === false) { + return false; + } + $mysqli = new MySQL(); + $conn = $mysqli->connectMYSQLI(); + $stmt = $conn->prepare("SELECT `locked` FROM ? WHERE `id` = ?;"); + $stmt->bind_param("si", $table, $id); + $stmt->execute(); + $stmt->close(); + return $stmt->get_result()->fetch_assoc()["locked"]; + } catch (Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "Failed to get lock status: " . $e); + return false; + } + } + /** + * Does a table exist in the database? + * + * @param string $table The table name + * + * @return bool + */ + public static function doesTableExist(string $table): bool + { + try { + $mysqli = new MySQL(); + $conn = $mysqli->connectMYSQLI(); + $conn->query("SELECT * FROM ".mysqli_real_escape_string($conn, $table)); + return true; + } catch (Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "Failed to check if table exists: " . $e); + return false; + } + } + /** + * Does a record exist in the database? + * + * @param string $table Table name + * @param string $search The term you want to search for (id) + * @param string $term What the value should be (1) + * @return bool + */ + public static function doesRecordExist(string $table, string $search, string $term) : bool { + try { + if (self::doesTableExist($table) === false) { + return false; + } + $mysqli = new MySQL(); + $conn = $mysqli->connectMYSQLI(); + $stmt = $conn->prepare("SELECT * FROM ? WHERE ? = ?;"); + $stmt->bind_param("sss", $table, $search, $term); + $stmt->execute(); + $stmt->close(); + return true; + } catch (Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "Failed to check if record exists: " . $e); + return false; + } + } } \ No newline at end of file diff --git a/app/Database/MySQLCache.php b/app/Database/MySQLCache.php new file mode 100755 index 0000000..f033ac7 --- /dev/null +++ b/app/Database/MySQLCache.php @@ -0,0 +1,95 @@ +connectMYSQLI(); + $query = "SELECT * FROM " . mysqli_real_escape_string($conn, $table_name); + $result = $conn->query($query); + + if ($result->num_rows == 0) { + throw new Exception("No data found."); + } + + /** + * Specific table dump settings! + * + * @requires framework_settings + */ + if ($table_name == "framework_settings") { + /** + * Code to export the settings file in a format that MythicalSystemsFramework\Managers\Settings can read! + */ + $query = "SELECT scategory FROM " . mysqli_real_escape_string($conn, $table_name); + $result = $conn->query($query); + + if ($result->num_rows > 0) { + $categories = []; + while ($row = $result->fetch_assoc()) { + $category = $row['scategory']; + if (!in_array($category, $categories)) { + $categories[] = $category; + } + } + } + $data = []; + foreach ($categories as $category) { + if ($category !== 0) { + $data[$category] = []; + + $query = "SELECT skey, svalue FROM " . mysqli_real_escape_string($conn, $table_name) . " WHERE scategory = '" . mysqli_real_escape_string($conn, $category) . "'"; + $result = $conn->query($query); + + if ($result->num_rows > 0) { + while ($row = $result->fetch_assoc()) { + $name = $row['skey']; + $value = $row['svalue']; + $data[$category][$name] = $value; + } + } + } + } + + } elseif ($table_name == "framework_users") { + + } else { + throw new Exception("Table not supported."); + } + + $cache_info["cache_info"] = [ + "table" => $table_name, + "date_created" => date("Y-m-d H:i:s"), + "date_expire" => date("Y-m-d H:i:s", strtotime("+".$data["caches"]["settings_cache_life"]." seconds")), + ]; + $data = array_merge($cache_info,$data); + $json = json_encode($data, JSON_PRETTY_PRINT); + Settings::up(); + file_put_contents(Settings::$cache_path . '/' . $table_name . '.json', $json); + } catch (Exception $e) { + throw new Exception("Failed to save cache: " . $e); + } + } + + public static function deleteCaches(): void + { + $files = glob(Settings::$cache_path . '/*'); + foreach ($files as $file) { + if (is_file($file)) { + unlink($file); + } + } + } +} \ No newline at end of file diff --git a/app/Database/Redis/Redis.php b/app/Database/Redis/Redis.php new file mode 100755 index 0000000..a9a213f --- /dev/null +++ b/app/Database/Redis/Redis.php @@ -0,0 +1,13 @@ +connectMYSQLI(); - $stmt = $conn->prepare("INSERT INTO framework_users_notifications (user_id, name, description, date) VALUES (?, ?, ?, NOW())"); - $stmt->bind_param("sss", $user_id, $name, $description); - $stmt->execute(); - $notificationID = $stmt->insert_id; - $stmt->close(); - return $notificationID; + try { + $mysqli = new MySQL(); + $conn = $mysqli->connectMYSQLI(); + $stmt = $conn->prepare("INSERT INTO framework_users_notifications (user_id, name, description, date) VALUES (?, ?, ?, NOW())"); + $stmt->bind_param("sss", $user_id, $name, $description); + $stmt->execute(); + $notificationID = $stmt->insert_id; + $stmt->close(); + return $notificationID; + } catch (Exception $e) { + throw new Exception("" . $e->getMessage()); + } } /** @@ -42,12 +45,16 @@ public static function create(string $user_id, string $name, string $description */ public static function edit(int $id, string $name, string $description): void { - $mysqli = new MySQL(); - $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("UPDATE framework_users_notifications SET name = ?, description = ? WHERE id = ?"); - $stmt->bind_param("ssi", $name, $description, $id); - $stmt->execute(); - $stmt->close(); + try { + $mysqli = new MySQL(); + $conn = $mysqli->connectMYSQLI(); + $stmt = $conn->prepare("UPDATE framework_users_notifications SET name = ?, description = ? WHERE id = ?"); + $stmt->bind_param("ssi", $name, $description, $id); + $stmt->execute(); + $stmt->close(); + } catch (Exception $e) { + throw new Exception("" . $e->getMessage()); + } } /** @@ -59,12 +66,16 @@ public static function edit(int $id, string $name, string $description): void */ public static function delete(int $id): void { - $mysqli = new MySQL(); - $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("DELETE FROM framework_users_notifications WHERE id = ?"); - $stmt->bind_param("i", $id); - $stmt->execute(); - $stmt->close(); + try { + $mysqli = new MySQL(); + $conn = $mysqli->connectMYSQLI(); + $stmt = $conn->prepare("DELETE FROM framework_users_notifications WHERE id = ?"); + $stmt->bind_param("i", $id); + $stmt->execute(); + $stmt->close(); + } catch (Exception $e) { + throw new Exception("" . $e->getMessage()); + } } /** @@ -74,9 +85,13 @@ public static function delete(int $id): void */ public static function deleteAll(): void { - $mysqli = new MySQL(); - $conn = $mysqli->connectMYSQLI(); - $conn->query("TRUNCATE TABLE framework_users_notifications"); + try { + $mysqli = new MySQL(); + $conn = $mysqli->connectMYSQLI(); + $conn->query("TRUNCATE TABLE framework_users_notifications"); + } catch (Exception $e) { + throw new Exception("" . $e->getMessage()); + } } /** @@ -88,15 +103,22 @@ public static function deleteAll(): void */ public static function getOne(int $id): ?array { - $mysqli = new MySQL(); - $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("SELECT * FROM framework_users_notifications WHERE id = ?"); - $stmt->bind_param("i", $id); - $stmt->execute(); - $result = $stmt->get_result(); - $notification = $result->fetch_assoc(); - $stmt->close(); - return $notification; + try { + if (!self::exists($id)) { + return []; + } + $mysqli = new MySQL(); + $conn = $mysqli->connectMYSQLI(); + $stmt = $conn->prepare("SELECT * FROM framework_users_notifications WHERE id = ?"); + $stmt->bind_param("i", $id); + $stmt->execute(); + $result = $stmt->get_result(); + $notification = $result->fetch_assoc(); + $stmt->close(); + return $notification; + } catch (Exception $e) { + return []; + } } /** @@ -106,14 +128,18 @@ public static function getOne(int $id): ?array */ public static function getAll(): array { - $mysqli = new MySQL(); - $conn = $mysqli->connectMYSQLI(); - $result = $conn->query("SELECT * FROM framework_users_notifications"); - $framework_users_notifications = []; - while ($notification = $result->fetch_assoc()) { - $framework_users_notifications[] = $notification; + try { + $mysqli = new MySQL(); + $conn = $mysqli->connectMYSQLI(); + $result = $conn->query("SELECT * FROM framework_users_notifications"); + $framework_users_notifications = []; + while ($notification = $result->fetch_assoc()) { + $framework_users_notifications[] = $notification; + } + return $framework_users_notifications; + } catch (Exception $e) { + return []; } - return $framework_users_notifications; } /** @@ -123,14 +149,18 @@ public static function getAll(): array */ public static function getAllSortedById(): array { - $mysqli = new MySQL(); - $conn = $mysqli->connectMYSQLI(); - $result = $conn->query("SELECT * FROM framework_users_notifications ORDER BY id DESC"); - $framework_users_notifications = []; - while ($notification = $result->fetch_assoc()) { - $framework_users_notifications[] = $notification; + try { + $mysqli = new MySQL(); + $conn = $mysqli->connectMYSQLI(); + $result = $conn->query("SELECT * FROM framework_users_notifications ORDER BY id DESC"); + $framework_users_notifications = []; + while ($notification = $result->fetch_assoc()) { + $framework_users_notifications[] = $notification; + } + return $framework_users_notifications; + } catch (Exception $e) { + return []; } - return $framework_users_notifications; } /** @@ -140,14 +170,18 @@ public static function getAllSortedById(): array */ public static function getAllSortedByDate(): array { - $mysqli = new MySQL(); - $conn = $mysqli->connectMYSQLI(); - $result = $conn->query("SELECT * FROM framework_users_notifications ORDER BY date DESC"); - $framework_users_notifications = []; - while ($notification = $result->fetch_assoc()) { - $framework_users_notifications[] = $notification; + try { + $mysqli = new MySQL(); + $conn = $mysqli->connectMYSQLI(); + $result = $conn->query("SELECT * FROM framework_users_notifications ORDER BY date DESC"); + $framework_users_notifications = []; + while ($notification = $result->fetch_assoc()) { + $framework_users_notifications[] = $notification; + } + return $framework_users_notifications; + } catch (Exception $e) { + return []; } - return $framework_users_notifications; } /** @@ -159,17 +193,89 @@ public static function getAllSortedByDate(): array */ public static function getByUserId(string $user_id): array { - $mysqli = new MySQL(); - $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("SELECT * FROM framework_users_notifications WHERE user_id = ?"); - $stmt->bind_param("s", $user_id); - $stmt->execute(); - $result = $stmt->get_result(); - $framework_users_notifications = []; - while ($notification = $result->fetch_assoc()) { - $framework_users_notifications[] = $notification; + try { + $mysqli = new MySQL(); + $conn = $mysqli->connectMYSQLI(); + $stmt = $conn->prepare("SELECT * FROM framework_users_notifications WHERE user_id = ?"); + $stmt->bind_param("s", $user_id); + $stmt->execute(); + $result = $stmt->get_result(); + $framework_users_notifications = []; + while ($notification = $result->fetch_assoc()) { + $framework_users_notifications[] = $notification; + } + $stmt->close(); + return $framework_users_notifications; + } catch (Exception $e) { + return []; + } + } + /** + * Does a notification exist in the database? + * + * @param int $id The id of the notification to check. + * + * @return bool True if the notification exists, false if not. + */ + public static function exists(string $id): bool + { + try { + $mysqli = new MySQL(); + $conn = $mysqli->connectMYSQLI(); + $stmt = $conn->prepare("SELECT * FROM framework_users_notifications WHERE id = ?"); + $stmt->bind_param("i", $id); + $stmt->execute(); + $result = $stmt->get_result(); + $stmt->close(); + return $result->num_rows > 0; + } catch (Exception $e) { + return false; } - $stmt->close(); - return $framework_users_notifications; } + + /** + * Mark a notification as read. + * + * @param string $notification_id The id of the notification to mark as read. + * @param string $user_uuid The user uuid. + * + * @return void + * @throws Exception + */ + public static function markAsRead(string $notification_id, string $user_uuid) : void { + try { + $mysqli = new MySQL(); + $conn = $mysqli->connectMYSQLI(); + $stmt = $conn->prepare("INSERT INTO framework_users_notifications_read (notification_id, user_uuid, date) VALUES (?, ?, NOW())"); + $stmt->bind_param("ss", $notification_id, $user_uuid); + $stmt->execute(); + $stmt->close(); + } catch (Exception $e) { + throw new Exception("" . $e->getMessage()); + } + } + /** + * Check if a notification was already read! + * + * @param string $notification_id The id of the notification + * @param string $user_uuid The uuid of the user + * + * @throws Exception + * @return bool + */ + public static function hasAlreadyRead(string $notification_id, string $user_uuid) : bool { + try { + $mysqli = new MySQL(); + $conn = $mysqli->connectMYSQLI(); + $stmt = $conn->prepare("SELECT * FROM framework_users_notifications_read WHERE notification_id = ? AND user_uuid = ?"); + $stmt->bind_param("ss", $notification_id, $user_uuid); + $stmt->execute(); + $result = $stmt->get_result(); + $stmt->close(); + return $result->num_rows > 0; + } catch (Exception $e) { + throw new Exception("" . $e->getMessage()); + } + } + } diff --git a/app/Handlers/exception/AnnouncementNotFoundException.php b/app/Handlers/exception/AnnouncementNotFoundException.php old mode 100644 new mode 100755 diff --git a/app/Handlers/exception/NotificationNotFoundException.php b/app/Handlers/exception/NotificationNotFoundException.php new file mode 100755 index 0000000..fa9c544 --- /dev/null +++ b/app/Handlers/exception/NotificationNotFoundException.php @@ -0,0 +1,11 @@ +get($category, $name); + } + /** + * Update a setting in the database + * + * @param string $category The name of the category + * @param string $name The name of the setting + * @param string $value The value you want to replace with! + * @param bool $updateCache Update the cache after updating the setting + * + * @return void + * @throws Exception + */ + public static function updateSetting(string $category, string $name, string $value, bool $updateCache = true) : void + { + SettingsManager::update($category, $name, $value); + if ($updateCache) { + MySQLCache::saveCache("framework_settings"); + } + } +} diff --git a/app/Managers/SettingsManager.php b/app/Managers/SettingsManager.php old mode 100644 new mode 100755 index 78380a0..034cd84 --- a/app/Managers/SettingsManager.php +++ b/app/Managers/SettingsManager.php @@ -3,10 +3,14 @@ namespace MythicalSystemsFramework\Managers; use MythicalSystemsFramework\Database\MySQL; - +/** + * DEPRECATED: Use Settings class instead!! + */ class SettingsManager { /** + * DEPRECATED: Use Settings class instead!! + * * Get a setting from the database! * * @param string $category The category of the setting you want to get! @@ -32,6 +36,7 @@ public static function get(string $category, string $key): string|null } /** + * DEPRECATED: Use Settings class instead!! * Set a setting in the database! * * @param string $category The category of the setting you want to set! @@ -45,13 +50,14 @@ public static function set(string $category, string $key, string $value): bool $mysql = new MySQL(); $conn = $mysql->connectMYSQLI(); $stmt = $conn->prepare("INSERT INTO framework_settings (`scategory`, `skey`, `svalue`) VALUES (?, ?, ?)"); - $stmt->bind_param("sss",$category, $key, $value); + $stmt->bind_param("sss", $category, $key, $value); $success = $stmt->execute(); $stmt->close(); return $success; } /** + * DEPRECATED: Use Settings class instead!! * Delete a setting from the database! * * @param string $category The category of the setting you want to delete! @@ -75,6 +81,8 @@ public static function delete(string $category, string $key): bool } /** + * DEPRECATED: Use Settings class instead!! + * * Delete all settings from the database! * * @return bool True if successfully deleted, false otherwise! @@ -88,6 +96,8 @@ public static function deleteAll(): bool } /** + * DEPRECATED: Use Settings class instead!! + * * Update a setting in the database! * * @param string $category The category of the setting you want to update! @@ -112,6 +122,8 @@ public static function update(string $category, string $key, string $value): boo } /** + * DEPRECATED: Use Settings class instead!! + * * Check if a setting exists in the database! * * @param string $category The category of the setting you want to check! diff --git a/app/Plugins/Events/ActivityEvent.php b/app/Plugins/Events/ActivityEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/AnnouncementEvent.php b/app/Plugins/Events/AnnouncementEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/ApplicationEvent.php b/app/Plugins/Events/ApplicationEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/CliCommandEvent.php b/app/Plugins/Events/CliCommandEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/ConfigEvent.php b/app/Plugins/Events/ConfigEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/CronEvent.php b/app/Plugins/Events/CronEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/DatabaseEvent.php b/app/Plugins/Events/DatabaseEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/EncryptionEvent.php b/app/Plugins/Events/EncryptionEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/ExceptionEvent.php b/app/Plugins/Events/ExceptionEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/LoggerEvent.php b/app/Plugins/Events/LoggerEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/NotificationEvent.php b/app/Plugins/Events/NotificationEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/PageEvent.php b/app/Plugins/Events/PageEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/PermissionEvent.php b/app/Plugins/Events/PermissionEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/RendererEvent.php b/app/Plugins/Events/RendererEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/RoleEvent.php b/app/Plugins/Events/RoleEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/RouterEvent.php b/app/Plugins/Events/RouterEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/SettingEvent.php b/app/Plugins/Events/SettingEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/SnowFlakeEvent.php b/app/Plugins/Events/SnowFlakeEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/TranslationEvent.php b/app/Plugins/Events/TranslationEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/UnitTestEvent.php b/app/Plugins/Events/UnitTestEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/Events/UserEvent.php b/app/Plugins/Events/UserEvent.php old mode 100644 new mode 100755 diff --git a/app/Plugins/PluginsEventHandler.php b/app/Plugins/PluginsEventHandler.php old mode 100644 new mode 100755 diff --git a/app/Plugins/PluginsManager.php b/app/Plugins/PluginsManager.php old mode 100644 new mode 100755 diff --git a/app/Roles/RolesDataHandler.php b/app/Roles/RolesDataHandler.php old mode 100644 new mode 100755 diff --git a/app/Roles/RolesHelper.php b/app/Roles/RolesHelper.php old mode 100644 new mode 100755 diff --git a/app/Roles/RolesPermissionDataHandler.php b/app/Roles/RolesPermissionDataHandler.php old mode 100644 new mode 100755 diff --git a/app/User/Exceptions/UserException.php b/app/User/Exceptions/UserException.php old mode 100644 new mode 100755 diff --git a/app/User/UserHelper.php b/app/User/UserHelper.php old mode 100644 new mode 100755 diff --git a/caches/.gitkeep b/caches/.gitkeep new file mode 100755 index 0000000..e69de29 diff --git a/commands/core/config/configmigrate.php b/commands/core/config/configmigrate.php index 901502d..de1ae97 100755 --- a/commands/core/config/configmigrate.php +++ b/commands/core/config/configmigrate.php @@ -11,8 +11,7 @@ public function execute() $mysql = new MySQL(); $db = $mysql->connectPDO(); $db->exec("CREATE TABLE IF NOT EXISTS `framework_settings_migrations` (`id` INT NOT NULL AUTO_INCREMENT , `script` TEXT NOT NULL , `executed_at` DATETIME NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB; ALTER TABLE `framework_settings_migrations` CHANGE `executed_at` `executed_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP;"); - $phpFiles = glob(__DIR__ . '/../../migrate/config/*.php'); - + $phpFiles = glob(__DIR__ . '/../../../migrate/config/*.php'); if (count($phpFiles) > 0) { sort($phpFiles); diff --git a/composer.lock b/composer.lock old mode 100644 new mode 100755 diff --git a/cron/jobs/SettingsJob.php b/cron/jobs/SettingsJob.php new file mode 100755 index 0000000..26c582f --- /dev/null +++ b/cron/jobs/SettingsJob.php @@ -0,0 +1,7 @@ +getMessage() . "")); -} +} \ No newline at end of file diff --git a/migrate/config/11%3A28_05.05.2024.php b/migrate/config/1.php similarity index 100% rename from migrate/config/11%3A28_05.05.2024.php rename to migrate/config/1.php diff --git a/migrate/config/13%3A00_16.05.2024.php b/migrate/config/2.php similarity index 100% rename from migrate/config/13%3A00_16.05.2024.php rename to migrate/config/2.php diff --git a/migrate/config/3.php b/migrate/config/3.php new file mode 100755 index 0000000..3d1cc5a --- /dev/null +++ b/migrate/config/3.php @@ -0,0 +1,4 @@ +getMessage()); } } -$e = new Exception("das"); -Debugger::throw_error(VIEW_ENGINE, "Critical Error while starting up multithread action!", $e->__toString(), 24, "/public/index.php"); $router->add('/(.*)', function () { global $renderer; diff --git a/public/style.css b/public/style.css old mode 100644 new mode 100755 diff --git a/public/third_party/JQuery/jquery-3.7.1.min.js b/public/third_party/JQuery/jquery-3.7.1.min.js old mode 100644 new mode 100755 diff --git a/public/third_party/SweetAlert2/sweetalert2.all.min.js b/public/third_party/SweetAlert2/sweetalert2.all.min.js old mode 100644 new mode 100755 diff --git a/public/third_party/SweetAlert2/sweetalert2.min.css b/public/third_party/SweetAlert2/sweetalert2.min.css old mode 100644 new mode 100755 diff --git a/routes/api/system.php b/routes/api/system.php old mode 100644 new mode 100755 diff --git a/routes/views/core.php b/routes/views/core.php old mode 100644 new mode 100755 diff --git a/settings.json b/settings.json index 5e5a2fc..e2c8fd6 100644 --- a/settings.json +++ b/settings.json @@ -9,9 +9,9 @@ "database": { "host": "127.0.0.1", "port": "3306", - "username": "root", + "username": "", "password": "", - "name": "mythicalframework" + "name": "framework" }, "encryption": { "method": "MythicalCore", diff --git a/styles.css b/styles.css old mode 100644 new mode 100755 diff --git a/tailwind.config.js b/tailwind.config.js old mode 100644 new mode 100755 diff --git a/tests/EncryptionTest.php b/tests/EncryptionTest.php new file mode 100755 index 0000000..5491321 --- /dev/null +++ b/tests/EncryptionTest.php @@ -0,0 +1,41 @@ +assertEquals(self::$data, $decryptedData); + } + + public function testEncryption(): void + { + $encryptedData = EncryptionHandler::encrypt(self::$data, self::$key); + $this->assertEquals(self::$data_e, $encryptedData); + } + +} \ No newline at end of file diff --git a/themes/default/errors/401.twig b/themes/default/errors/401.twig old mode 100644 new mode 100755 diff --git a/themes/default/errors/403.twig b/themes/default/errors/403.twig old mode 100644 new mode 100755 diff --git a/themes/default/errors/404.twig b/themes/default/errors/404.twig old mode 100644 new mode 100755 diff --git a/themes/default/errors/500.twig b/themes/default/errors/500.twig old mode 100644 new mode 100755 diff --git a/themes/default/errors/debug.twig b/themes/default/errors/debug.twig old mode 100644 new mode 100755 diff --git a/themes/default/includes/page_footer.twig b/themes/default/includes/page_footer.twig old mode 100644 new mode 100755 diff --git a/themes/default/includes/page_head.twig b/themes/default/includes/page_head.twig old mode 100644 new mode 100755 From 7d3d76c839f76d3a2b84c43c4ba2339309000f2f Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Wed, 24 Jul 2024 13:48:50 +0200 Subject: [PATCH 02/17] PUSH -> Fix workflow errors! --- .github/workflows/ci.yml | 2 -- FIRST_INSTALL | 0 settings.json | 0 3 files changed, 2 deletions(-) mode change 100644 => 100755 FIRST_INSTALL mode change 100644 => 100755 settings.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 964fe7c..4fe2819 100755 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -98,8 +98,6 @@ jobs: fail-fast: false matrix: php-version: - - "8.0" - - "8.1" - "8.2" - "8.3" count: ${{ fromJson(needs.chunk-matrix.outputs.count) }} diff --git a/FIRST_INSTALL b/FIRST_INSTALL old mode 100644 new mode 100755 diff --git a/settings.json b/settings.json old mode 100644 new mode 100755 From 2e12525b695671a5938ad12af3a506339e49d323 Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Wed, 24 Jul 2024 14:31:14 +0200 Subject: [PATCH 03/17] PUSH -> Try --- .github/workflows/frontend_build.yml | 29 + .../workflows/{build.yml => php_build.yml} | 15 +- public/style.css | 946 +----------------- 3 files changed, 40 insertions(+), 950 deletions(-) create mode 100755 .github/workflows/frontend_build.yml rename .github/workflows/{build.yml => php_build.yml} (79%) diff --git a/.github/workflows/frontend_build.yml b/.github/workflows/frontend_build.yml new file mode 100755 index 0000000..5d14855 --- /dev/null +++ b/.github/workflows/frontend_build.yml @@ -0,0 +1,29 @@ +name: Build Frontend +on: [push, pull_request] + +permissions: + contents: read + +jobs: + ui: + name: UI + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + node-version: [16] + steps: + - name: Code Checkout + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + cache: "yarn" + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Build + run: npm run build diff --git a/.github/workflows/build.yml b/.github/workflows/php_build.yml similarity index 79% rename from .github/workflows/build.yml rename to .github/workflows/php_build.yml index 78d4766..da93937 100755 --- a/.github/workflows/build.yml +++ b/.github/workflows/php_build.yml @@ -1,9 +1,7 @@ name: Build and PHP APP -on: - push: - branches: [ "develop" ] - workflow_dispatch: +on: [push, pull_request] + env: PHP_VERSION: '8.2' @@ -46,4 +44,11 @@ jobs: - name: Run composer install if composer.json exists if: steps.check_files.outputs.files_exists == 'true' - run: composer validate --no-check-publish && composer install --prefer-dist --no-progress \ No newline at end of file + run: composer validate --no-check-publish && composer install --prefer-dist --no-progress + + - name: Run composer install if composer.json does not exist + if: steps.check_files.outputs.files_exists == 'false' + run: echo "No composer.json found, skipping composer install" + + - name: Run PHP Unit Tests + run: composer run tests \ No newline at end of file diff --git a/public/style.css b/public/style.css index 7ae5788..2801b2f 100755 --- a/public/style.css +++ b/public/style.css @@ -1,945 +1 @@ -/* -! tailwindcss v3.4.4 | MIT License | https://tailwindcss.com -*/ - -/* -1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4) -2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116) -*/ - -*, -::before, -::after { - box-sizing: border-box; - /* 1 */ - border-width: 0; - /* 2 */ - border-style: solid; - /* 2 */ - border-color: #e5e7eb; - /* 2 */ -} - -::before, -::after { - --tw-content: ''; -} - -/* -1. Use a consistent sensible line-height in all browsers. -2. Prevent adjustments of font size after orientation changes in iOS. -3. Use a more readable tab size. -4. Use the user's configured `sans` font-family by default. -5. Use the user's configured `sans` font-feature-settings by default. -6. Use the user's configured `sans` font-variation-settings by default. -7. Disable tap highlights on iOS -*/ - -html, -:host { - line-height: 1.5; - /* 1 */ - -webkit-text-size-adjust: 100%; - /* 2 */ - -moz-tab-size: 4; - /* 3 */ - -o-tab-size: 4; - tab-size: 4; - /* 3 */ - font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; - /* 4 */ - font-feature-settings: normal; - /* 5 */ - font-variation-settings: normal; - /* 6 */ - -webkit-tap-highlight-color: transparent; - /* 7 */ -} - -/* -1. Remove the margin in all browsers. -2. Inherit line-height from `html` so users can set them as a class directly on the `html` element. -*/ - -body { - margin: 0; - /* 1 */ - line-height: inherit; - /* 2 */ -} - -/* -1. Add the correct height in Firefox. -2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655) -3. Ensure horizontal rules are visible by default. -*/ - -hr { - height: 0; - /* 1 */ - color: inherit; - /* 2 */ - border-top-width: 1px; - /* 3 */ -} - -/* -Add the correct text decoration in Chrome, Edge, and Safari. -*/ - -abbr:where([title]) { - -webkit-text-decoration: underline dotted; - text-decoration: underline dotted; -} - -/* -Remove the default font size and weight for headings. -*/ - -h1, -h2, -h3, -h4, -h5, -h6 { - font-size: inherit; - font-weight: inherit; -} - -/* -Reset links to optimize for opt-in styling instead of opt-out. -*/ - -a { - color: inherit; - text-decoration: inherit; -} - -/* -Add the correct font weight in Edge and Safari. -*/ - -b, -strong { - font-weight: bolder; -} - -/* -1. Use the user's configured `mono` font-family by default. -2. Use the user's configured `mono` font-feature-settings by default. -3. Use the user's configured `mono` font-variation-settings by default. -4. Correct the odd `em` font sizing in all browsers. -*/ - -code, -kbd, -samp, -pre { - font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; - /* 1 */ - font-feature-settings: normal; - /* 2 */ - font-variation-settings: normal; - /* 3 */ - font-size: 1em; - /* 4 */ -} - -/* -Add the correct font size in all browsers. -*/ - -small { - font-size: 80%; -} - -/* -Prevent `sub` and `sup` elements from affecting the line height in all browsers. -*/ - -sub, -sup { - font-size: 75%; - line-height: 0; - position: relative; - vertical-align: baseline; -} - -sub { - bottom: -0.25em; -} - -sup { - top: -0.5em; -} - -/* -1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297) -2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016) -3. Remove gaps between table borders by default. -*/ - -table { - text-indent: 0; - /* 1 */ - border-color: inherit; - /* 2 */ - border-collapse: collapse; - /* 3 */ -} - -/* -1. Change the font styles in all browsers. -2. Remove the margin in Firefox and Safari. -3. Remove default padding in all browsers. -*/ - -button, -input, -optgroup, -select, -textarea { - font-family: inherit; - /* 1 */ - font-feature-settings: inherit; - /* 1 */ - font-variation-settings: inherit; - /* 1 */ - font-size: 100%; - /* 1 */ - font-weight: inherit; - /* 1 */ - line-height: inherit; - /* 1 */ - letter-spacing: inherit; - /* 1 */ - color: inherit; - /* 1 */ - margin: 0; - /* 2 */ - padding: 0; - /* 3 */ -} - -/* -Remove the inheritance of text transform in Edge and Firefox. -*/ - -button, -select { - text-transform: none; -} - -/* -1. Correct the inability to style clickable types in iOS and Safari. -2. Remove default button styles. -*/ - -button, -input:where([type='button']), -input:where([type='reset']), -input:where([type='submit']) { - -webkit-appearance: button; - /* 1 */ - background-color: transparent; - /* 2 */ - background-image: none; - /* 2 */ -} - -/* -Use the modern Firefox focus style for all focusable elements. -*/ - -:-moz-focusring { - outline: auto; -} - -/* -Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737) -*/ - -:-moz-ui-invalid { - box-shadow: none; -} - -/* -Add the correct vertical alignment in Chrome and Firefox. -*/ - -progress { - vertical-align: baseline; -} - -/* -Correct the cursor style of increment and decrement buttons in Safari. -*/ - -::-webkit-inner-spin-button, -::-webkit-outer-spin-button { - height: auto; -} - -/* -1. Correct the odd appearance in Chrome and Safari. -2. Correct the outline style in Safari. -*/ - -[type='search'] { - -webkit-appearance: textfield; - /* 1 */ - outline-offset: -2px; - /* 2 */ -} - -/* -Remove the inner padding in Chrome and Safari on macOS. -*/ - -::-webkit-search-decoration { - -webkit-appearance: none; -} - -/* -1. Correct the inability to style clickable types in iOS and Safari. -2. Change font properties to `inherit` in Safari. -*/ - -::-webkit-file-upload-button { - -webkit-appearance: button; - /* 1 */ - font: inherit; - /* 2 */ -} - -/* -Add the correct display in Chrome and Safari. -*/ - -summary { - display: list-item; -} - -/* -Removes the default spacing and border for appropriate elements. -*/ - -blockquote, -dl, -dd, -h1, -h2, -h3, -h4, -h5, -h6, -hr, -figure, -p, -pre { - margin: 0; -} - -fieldset { - margin: 0; - padding: 0; -} - -legend { - padding: 0; -} - -ol, -ul, -menu { - list-style: none; - margin: 0; - padding: 0; -} - -/* -Reset default styling for dialogs. -*/ - -dialog { - padding: 0; -} - -/* -Prevent resizing textareas horizontally by default. -*/ - -textarea { - resize: vertical; -} - -/* -1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300) -2. Set the default placeholder color to the user's configured gray 400 color. -*/ - -input::-moz-placeholder, textarea::-moz-placeholder { - opacity: 1; - /* 1 */ - color: #9ca3af; - /* 2 */ -} - -input::placeholder, -textarea::placeholder { - opacity: 1; - /* 1 */ - color: #9ca3af; - /* 2 */ -} - -/* -Set the default cursor for buttons. -*/ - -button, -[role="button"] { - cursor: pointer; -} - -/* -Make sure disabled buttons don't get the pointer cursor. -*/ - -:disabled { - cursor: default; -} - -/* -1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14) -2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210) - This can trigger a poorly considered lint error in some tools but is included by design. -*/ - -img, -svg, -video, -canvas, -audio, -iframe, -embed, -object { - display: block; - /* 1 */ - vertical-align: middle; - /* 2 */ -} - -/* -Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14) -*/ - -img, -video { - max-width: 100%; - height: auto; -} - -/* Make elements with the HTML hidden attribute stay hidden by default */ - -[hidden] { - display: none; -} - -*, ::before, ::after { - --tw-border-spacing-x: 0; - --tw-border-spacing-y: 0; - --tw-translate-x: 0; - --tw-translate-y: 0; - --tw-rotate: 0; - --tw-skew-x: 0; - --tw-skew-y: 0; - --tw-scale-x: 1; - --tw-scale-y: 1; - --tw-pan-x: ; - --tw-pan-y: ; - --tw-pinch-zoom: ; - --tw-scroll-snap-strictness: proximity; - --tw-gradient-from-position: ; - --tw-gradient-via-position: ; - --tw-gradient-to-position: ; - --tw-ordinal: ; - --tw-slashed-zero: ; - --tw-numeric-figure: ; - --tw-numeric-spacing: ; - --tw-numeric-fraction: ; - --tw-ring-inset: ; - --tw-ring-offset-width: 0px; - --tw-ring-offset-color: #fff; - --tw-ring-color: rgb(59 130 246 / 0.5); - --tw-ring-offset-shadow: 0 0 #0000; - --tw-ring-shadow: 0 0 #0000; - --tw-shadow: 0 0 #0000; - --tw-shadow-colored: 0 0 #0000; - --tw-blur: ; - --tw-brightness: ; - --tw-contrast: ; - --tw-grayscale: ; - --tw-hue-rotate: ; - --tw-invert: ; - --tw-saturate: ; - --tw-sepia: ; - --tw-drop-shadow: ; - --tw-backdrop-blur: ; - --tw-backdrop-brightness: ; - --tw-backdrop-contrast: ; - --tw-backdrop-grayscale: ; - --tw-backdrop-hue-rotate: ; - --tw-backdrop-invert: ; - --tw-backdrop-opacity: ; - --tw-backdrop-saturate: ; - --tw-backdrop-sepia: ; - --tw-contain-size: ; - --tw-contain-layout: ; - --tw-contain-paint: ; - --tw-contain-style: ; -} - -::backdrop { - --tw-border-spacing-x: 0; - --tw-border-spacing-y: 0; - --tw-translate-x: 0; - --tw-translate-y: 0; - --tw-rotate: 0; - --tw-skew-x: 0; - --tw-skew-y: 0; - --tw-scale-x: 1; - --tw-scale-y: 1; - --tw-pan-x: ; - --tw-pan-y: ; - --tw-pinch-zoom: ; - --tw-scroll-snap-strictness: proximity; - --tw-gradient-from-position: ; - --tw-gradient-via-position: ; - --tw-gradient-to-position: ; - --tw-ordinal: ; - --tw-slashed-zero: ; - --tw-numeric-figure: ; - --tw-numeric-spacing: ; - --tw-numeric-fraction: ; - --tw-ring-inset: ; - --tw-ring-offset-width: 0px; - --tw-ring-offset-color: #fff; - --tw-ring-color: rgb(59 130 246 / 0.5); - --tw-ring-offset-shadow: 0 0 #0000; - --tw-ring-shadow: 0 0 #0000; - --tw-shadow: 0 0 #0000; - --tw-shadow-colored: 0 0 #0000; - --tw-blur: ; - --tw-brightness: ; - --tw-contrast: ; - --tw-grayscale: ; - --tw-hue-rotate: ; - --tw-invert: ; - --tw-saturate: ; - --tw-sepia: ; - --tw-drop-shadow: ; - --tw-backdrop-blur: ; - --tw-backdrop-brightness: ; - --tw-backdrop-contrast: ; - --tw-backdrop-grayscale: ; - --tw-backdrop-hue-rotate: ; - --tw-backdrop-invert: ; - --tw-backdrop-opacity: ; - --tw-backdrop-saturate: ; - --tw-backdrop-sepia: ; - --tw-contain-size: ; - --tw-contain-layout: ; - --tw-contain-paint: ; - --tw-contain-style: ; -} - -.absolute { - position: absolute; -} - -.relative { - position: relative; -} - -.inset-0 { - inset: 0px; -} - -.mx-auto { - margin-left: auto; - margin-right: auto; -} - -.mb-4 { - margin-bottom: 1rem; -} - -.ml-auto { - margin-left: auto; -} - -.mr-2 { - margin-right: 0.5rem; -} - -.mt-2 { - margin-top: 0.5rem; -} - -.mt-4 { - margin-top: 1rem; -} - -.mt-5 { - margin-top: 1.25rem; -} - -.mt-6 { - margin-top: 1.5rem; -} - -.block { - display: block; -} - -.inline-block { - display: inline-block; -} - -.flex { - display: flex; -} - -.h-screen { - height: 100vh; -} - -.min-h-screen { - min-height: 100vh; -} - -.w-full { - width: 100%; -} - -.max-w-4xl { - max-width: 56rem; -} - -.max-w-md { - max-width: 28rem; -} - -.translate-x-0 { - --tw-translate-x: 0px; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -.translate-x-0\.5 { - --tw-translate-x: 0.125rem; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -.translate-y-0 { - --tw-translate-y: 0px; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -.translate-y-0\.5 { - --tw-translate-y: 0.125rem; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -.rotate-12 { - --tw-rotate: 12deg; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -@keyframes bounce { - 0%, 100% { - transform: translateY(-25%); - animation-timing-function: cubic-bezier(0.8,0,1,1); - } - - 50% { - transform: none; - animation-timing-function: cubic-bezier(0,0,0.2,1); - } -} - -.animate-bounce { - animation: bounce 1s infinite; -} - -.flex-col { - flex-direction: column; -} - -.items-center { - align-items: center; -} - -.justify-center { - justify-content: center; -} - -.gap-6 { - gap: 1.5rem; -} - -.rounded { - border-radius: 0.25rem; -} - -.rounded-lg { - border-radius: 0.5rem; -} - -.rounded-t-lg { - border-top-left-radius: 0.5rem; - border-top-right-radius: 0.5rem; -} - -.border { - border-width: 1px; -} - -.border-current { - border-color: currentColor; -} - -.bg-\[\#1A2238\] { - --tw-bg-opacity: 1; - background-color: rgb(26 34 56 / var(--tw-bg-opacity)); -} - -.bg-\[\#b527b9\] { - --tw-bg-opacity: 1; - background-color: rgb(181 39 185 / var(--tw-bg-opacity)); -} - -.bg-\[\#ff3dd5\] { - --tw-bg-opacity: 1; - background-color: rgb(255 61 213 / var(--tw-bg-opacity)); -} - -.bg-blue-500 { - --tw-bg-opacity: 1; - background-color: rgb(59 130 246 / var(--tw-bg-opacity)); -} - -.bg-gray-200 { - --tw-bg-opacity: 1; - background-color: rgb(229 231 235 / var(--tw-bg-opacity)); -} - -.bg-gray-600 { - --tw-bg-opacity: 1; - background-color: rgb(75 85 99 / var(--tw-bg-opacity)); -} - -.bg-gray-800 { - --tw-bg-opacity: 1; - background-color: rgb(31 41 55 / var(--tw-bg-opacity)); -} - -.bg-gray-900 { - --tw-bg-opacity: 1; - background-color: rgb(17 24 39 / var(--tw-bg-opacity)); -} - -.bg-red-500 { - --tw-bg-opacity: 1; - background-color: rgb(239 68 68 / var(--tw-bg-opacity)); -} - -.bg-zinc-100 { - --tw-bg-opacity: 1; - background-color: rgb(244 244 245 / var(--tw-bg-opacity)); -} - -.bg-zinc-800 { - --tw-bg-opacity: 1; - background-color: rgb(39 39 42 / var(--tw-bg-opacity)); -} - -.p-4 { - padding: 1rem; -} - -.px-2 { - padding-left: 0.5rem; - padding-right: 0.5rem; -} - -.px-4 { - padding-left: 1rem; - padding-right: 1rem; -} - -.px-8 { - padding-left: 2rem; - padding-right: 2rem; -} - -.py-2 { - padding-top: 0.5rem; - padding-bottom: 0.5rem; -} - -.py-3 { - padding-top: 0.75rem; - padding-bottom: 0.75rem; -} - -.text-2xl { - font-size: 1.5rem; - line-height: 2rem; -} - -.text-9xl { - font-size: 8rem; - line-height: 1; -} - -.text-base { - font-size: 1rem; - line-height: 1.5rem; -} - -.text-sm { - font-size: 0.875rem; - line-height: 1.25rem; -} - -.text-xl { - font-size: 1.25rem; - line-height: 1.75rem; -} - -.font-extrabold { - font-weight: 800; -} - -.font-medium { - font-weight: 500; -} - -.font-semibold { - font-weight: 600; -} - -.tracking-widest { - letter-spacing: 0.1em; -} - -.text-\[\#b527b9\] { - --tw-text-opacity: 1; - color: rgb(181 39 185 / var(--tw-text-opacity)); -} - -.text-blue-400 { - --tw-text-opacity: 1; - color: rgb(96 165 250 / var(--tw-text-opacity)); -} - -.text-purple-500 { - --tw-text-opacity: 1; - color: rgb(168 85 247 / var(--tw-text-opacity)); -} - -.text-white { - --tw-text-opacity: 1; - color: rgb(255 255 255 / var(--tw-text-opacity)); -} - -.text-zinc-400 { - --tw-text-opacity: 1; - color: rgb(161 161 170 / var(--tw-text-opacity)); -} - -.text-zinc-500 { - --tw-text-opacity: 1; - color: rgb(113 113 122 / var(--tw-text-opacity)); -} - -.text-zinc-900 { - --tw-text-opacity: 1; - color: rgb(24 24 27 / var(--tw-text-opacity)); -} - -.shadow-md { - --tw-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); - --tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color); - box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow); -} - -.transition-colors { - transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; - transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); - transition-duration: 150ms; -} - -.transition-transform { - transition-property: transform; - transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); - transition-duration: 150ms; -} - -.duration-300 { - transition-duration: 300ms; -} - -.hover\:bg-blue-400:hover { - --tw-bg-opacity: 1; - background-color: rgb(96 165 250 / var(--tw-bg-opacity)); -} - -.hover\:bg-zinc-700:hover { - --tw-bg-opacity: 1; - background-color: rgb(63 63 70 / var(--tw-bg-opacity)); -} - -.hover\:underline:hover { - text-decoration-line: underline; -} - -.focus\:outline-none:focus { - outline: 2px solid transparent; - outline-offset: 2px; -} - -.focus\:ring:focus { - --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); - --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color); - box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); -} - -.active\:text-pink-500:active { - --tw-text-opacity: 1; - color: rgb(236 72 153 / var(--tw-text-opacity)); -} - -.group:hover .group-hover\:translate-x-0 { - --tw-translate-x: 0px; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -.group:hover .group-hover\:translate-y-0 { - --tw-translate-y: 0px; - transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); -} - -@media (prefers-color-scheme: dark) { - .dark\:bg-zinc-900 { - --tw-bg-opacity: 1; - background-color: rgb(24 24 27 / var(--tw-bg-opacity)); - } - - .dark\:text-zinc-100 { - --tw-text-opacity: 1; - color: rgb(244 244 245 / var(--tw-text-opacity)); - } -} - +/*! tailwindcss v3.4.6 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,::backdrop,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.absolute{position:absolute}.relative{position:relative}.inset-0{inset:0}.mx-auto{margin-left:auto;margin-right:auto}.mb-4{margin-bottom:1rem}.ml-auto{margin-left:auto}.mr-2{margin-right:.5rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.h-screen{height:100vh}.min-h-screen{min-height:100vh}.w-full{width:100%}.max-w-4xl{max-width:56rem}.max-w-md{max-width:28rem}.translate-x-0\.5{--tw-translate-x:0.125rem}.translate-x-0\.5,.translate-y-0\.5{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-0\.5{--tw-translate-y:0.125rem}.rotate-12{--tw-rotate:12deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes bounce{0%,to{transform:translateY(-25%);animation-timing-function:cubic-bezier(.8,0,1,1)}50%{transform:none;animation-timing-function:cubic-bezier(0,0,.2,1)}}.animate-bounce{animation:bounce 1s infinite}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.gap-6{gap:1.5rem}.rounded{border-radius:.25rem}.rounded-lg{border-radius:.5rem}.rounded-t-lg{border-top-left-radius:.5rem;border-top-right-radius:.5rem}.border{border-width:1px}.border-current{border-color:currentColor}.bg-\[\#1A2238\]{--tw-bg-opacity:1;background-color:rgb(26 34 56/var(--tw-bg-opacity))}.bg-\[\#b527b9\]{--tw-bg-opacity:1;background-color:rgb(181 39 185/var(--tw-bg-opacity))}.bg-\[\#ff3dd5\]{--tw-bg-opacity:1;background-color:rgb(255 61 213/var(--tw-bg-opacity))}.bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity))}.bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.bg-gray-600{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity))}.bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}.bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.bg-zinc-100{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity))}.bg-zinc-800{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity))}.p-4{padding:1rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.text-2xl{font-size:1.5rem;line-height:2rem}.text-9xl{font-size:8rem;line-height:1}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-extrabold{font-weight:800}.font-medium{font-weight:500}.font-semibold{font-weight:600}.tracking-widest{letter-spacing:.1em}.text-\[\#b527b9\]{--tw-text-opacity:1;color:rgb(181 39 185/var(--tw-text-opacity))}.text-blue-400{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity))}.text-purple-500{--tw-text-opacity:1;color:rgb(168 85 247/var(--tw-text-opacity))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity))}.text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity))}.text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity))}.shadow-md{--tw-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a;--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.hover\:bg-blue-400:hover{--tw-bg-opacity:1;background-color:rgb(96 165 250/var(--tw-bg-opacity))}.hover\:bg-zinc-700:hover{--tw-bg-opacity:1;background-color:rgb(63 63 70/var(--tw-bg-opacity))}.hover\:underline:hover{text-decoration-line:underline}.focus\:outline-none:focus{outline:2px solid #0000;outline-offset:2px}.focus\:ring:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.active\:text-pink-500:active{--tw-text-opacity:1;color:rgb(236 72 153/var(--tw-text-opacity))}.group:hover .group-hover\:translate-x-0{--tw-translate-x:0px}.group:hover .group-hover\:translate-x-0,.group:hover .group-hover\:translate-y-0{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:translate-y-0{--tw-translate-y:0px}@media (prefers-color-scheme:dark){.dark\:bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity))}.dark\:text-zinc-100{--tw-text-opacity:1;color:rgb(244 244 245/var(--tw-text-opacity))}} \ No newline at end of file From 19416d1f119a0fc8406237edd200e025a6fd947c Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Wed, 24 Jul 2024 14:32:16 +0200 Subject: [PATCH 04/17] PUSH -> Fix --- .github/workflows/frontend_build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/frontend_build.yml b/.github/workflows/frontend_build.yml index 5d14855..4311f48 100755 --- a/.github/workflows/frontend_build.yml +++ b/.github/workflows/frontend_build.yml @@ -20,10 +20,10 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - cache: "yarn" + cache: "npm" - name: Install dependencies - run: yarn install --frozen-lockfile + run: npm install - name: Build run: npm run build From 9859a79b615ae5c20702b064d693a7a362f691de Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Wed, 24 Jul 2024 14:33:21 +0200 Subject: [PATCH 05/17] PUSH -> Go --- .github/workflows/frontend_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/frontend_build.yml b/.github/workflows/frontend_build.yml index 4311f48..be2f1b4 100755 --- a/.github/workflows/frontend_build.yml +++ b/.github/workflows/frontend_build.yml @@ -23,7 +23,7 @@ jobs: cache: "npm" - name: Install dependencies - run: npm install + run: npm install --frozen-lockfile - name: Build run: npm run build From 58225c9518eda13854b853ff375f878cf9349915 Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Wed, 24 Jul 2024 14:34:41 +0200 Subject: [PATCH 06/17] PUSH -> Final fix maybe? --- .github/workflows/frontend_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/frontend_build.yml b/.github/workflows/frontend_build.yml index be2f1b4..899ed3b 100755 --- a/.github/workflows/frontend_build.yml +++ b/.github/workflows/frontend_build.yml @@ -23,7 +23,7 @@ jobs: cache: "npm" - name: Install dependencies - run: npm install --frozen-lockfile + run: npm ci - name: Build run: npm run build From 54f8f0d02192817b51bffd7b2a33687ea856c1cb Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Wed, 24 Jul 2024 14:36:23 +0200 Subject: [PATCH 07/17] PUSH -> Fix --- .github/workflows/frontend_build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/frontend_build.yml b/.github/workflows/frontend_build.yml index 899ed3b..4114951 100755 --- a/.github/workflows/frontend_build.yml +++ b/.github/workflows/frontend_build.yml @@ -11,13 +11,13 @@ jobs: strategy: fail-fast: false matrix: - node-version: [16] + node-version: [20] steps: - name: Code Checkout uses: actions/checkout@v3 - name: Setup Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: "npm" From dcbf2d0b31239359e27c323c03ca7c197216257a Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Wed, 24 Jul 2024 14:37:36 +0200 Subject: [PATCH 08/17] PUSH -> Fix --- .github/workflows/frontend_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/frontend_build.yml b/.github/workflows/frontend_build.yml index 4114951..253ebc8 100755 --- a/.github/workflows/frontend_build.yml +++ b/.github/workflows/frontend_build.yml @@ -23,7 +23,7 @@ jobs: cache: "npm" - name: Install dependencies - run: npm ci + run: npm i --package-lock - name: Build run: npm run build From 467a5186331cb23360d97dfa8a75c0b6745262ae Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Wed, 24 Jul 2024 14:39:53 +0200 Subject: [PATCH 09/17] PUSH -> Fix --- .github/workflows/frontend_build.yml | 4 +- yarn.lock | 796 +++++++++++++++++++++++++++ 2 files changed, 798 insertions(+), 2 deletions(-) create mode 100644 yarn.lock diff --git a/.github/workflows/frontend_build.yml b/.github/workflows/frontend_build.yml index 253ebc8..11316dd 100755 --- a/.github/workflows/frontend_build.yml +++ b/.github/workflows/frontend_build.yml @@ -20,10 +20,10 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - cache: "npm" + cache: "yarn" - name: Install dependencies - run: npm i --package-lock + run: yarn install --frozen-lockfile - name: Build run: npm run build diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..b78c9e5 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,796 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@alloc/quick-lru@^5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@alloc/quick-lru/-/quick-lru-5.2.0.tgz#7bf68b20c0a350f936915fcae06f58e32007ce30" + integrity sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw== + +"@isaacs/cliui@^8.0.2": + version "8.0.2" + resolved "https://registry.yarnpkg.com/@isaacs/cliui/-/cliui-8.0.2.tgz#b37667b7bc181c168782259bab42474fbf52b550" + integrity sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA== + dependencies: + string-width "^5.1.2" + string-width-cjs "npm:string-width@^4.2.0" + strip-ansi "^7.0.1" + strip-ansi-cjs "npm:strip-ansi@^6.0.1" + wrap-ansi "^8.1.0" + wrap-ansi-cjs "npm:wrap-ansi@^7.0.0" + +"@jridgewell/gen-mapping@^0.3.2": + version "0.3.5" + resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz#dcce6aff74bdf6dad1a95802b69b04a2fcb1fb36" + integrity sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg== + dependencies: + "@jridgewell/set-array" "^1.2.1" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping" "^0.3.24" + +"@jridgewell/resolve-uri@^3.1.0": + version "3.1.2" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6" + integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw== + +"@jridgewell/set-array@^1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.2.1.tgz#558fb6472ed16a4c850b889530e6b36438c49280" + integrity sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A== + +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": + version "1.5.0" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz#3188bcb273a414b0d215fd22a58540b989b9409a" + integrity sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ== + +"@jridgewell/trace-mapping@^0.3.24": + version "0.3.25" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz#15f190e98895f3fc23276ee14bc76b675c2e50f0" + integrity sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ== + dependencies: + "@jridgewell/resolve-uri" "^3.1.0" + "@jridgewell/sourcemap-codec" "^1.4.14" + +"@nodelib/fs.scandir@2.1.5": + version "2.1.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" + integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g== + dependencies: + "@nodelib/fs.stat" "2.0.5" + run-parallel "^1.1.9" + +"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2": + version "2.0.5" + resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b" + integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A== + +"@nodelib/fs.walk@^1.2.3": + version "1.2.8" + resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a" + integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg== + dependencies: + "@nodelib/fs.scandir" "2.1.5" + fastq "^1.6.0" + +"@pkgjs/parseargs@^0.11.0": + version "0.11.0" + resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33" + integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg== + +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + +ansi-regex@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.0.1.tgz#3183e38fae9a65d7cb5e53945cd5897d0260a06a" + integrity sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA== + +ansi-styles@^4.0.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + +ansi-styles@^6.1.0: + version "6.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" + integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== + +any-promise@^1.0.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" + integrity sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A== + +anymatch@~3.1.2: + version "3.1.3" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" + integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + +arg@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/arg/-/arg-5.0.2.tgz#c81433cc427c92c4dcf4865142dbca6f15acd59c" + integrity sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg== + +autoprefixer@^10.4.19: + version "10.4.19" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.19.tgz#ad25a856e82ee9d7898c59583c1afeb3fa65f89f" + integrity sha512-BaENR2+zBZ8xXhM4pUaKUxlVdxZ0EZhjvbopwnXmxRUfqDmwSpC2lAi/QXvx7NRdPCo1WKEcEF6mV64si1z4Ew== + dependencies: + browserslist "^4.23.0" + caniuse-lite "^1.0.30001599" + fraction.js "^4.3.7" + normalize-range "^0.1.2" + picocolors "^1.0.0" + postcss-value-parser "^4.2.0" + +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== + +binary-extensions@^2.0.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" + integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== + +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + +braces@^3.0.3, braces@~3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" + integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== + dependencies: + fill-range "^7.1.1" + +browserslist@^4.23.0: + version "4.23.2" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.23.2.tgz#244fe803641f1c19c28c48c4b6ec9736eb3d32ed" + integrity sha512-qkqSyistMYdxAcw+CzbZwlBy8AGmS/eEWs+sEV5TnLRGDOL+C5M2EnH6tlZyg0YoAxGJAFKh61En9BR941GnHA== + dependencies: + caniuse-lite "^1.0.30001640" + electron-to-chromium "^1.4.820" + node-releases "^2.0.14" + update-browserslist-db "^1.1.0" + +camelcase-css@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/camelcase-css/-/camelcase-css-2.0.1.tgz#ee978f6947914cc30c6b44741b6ed1df7f043fd5" + integrity sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA== + +caniuse-lite@^1.0.30001599, caniuse-lite@^1.0.30001640: + version "1.0.30001643" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001643.tgz#9c004caef315de9452ab970c3da71085f8241dbd" + integrity sha512-ERgWGNleEilSrHM6iUz/zJNSQTP8Mr21wDWpdgvRwcTXGAq6jMtOUPP4dqFPTdKqZ2wKTdtB+uucZ3MRpAUSmg== + +chokidar@^3.5.3: + version "3.6.0" + resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" + integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== + dependencies: + anymatch "~3.1.2" + braces "~3.0.2" + glob-parent "~5.1.2" + is-binary-path "~2.1.0" + is-glob "~4.0.1" + normalize-path "~3.0.0" + readdirp "~3.6.0" + optionalDependencies: + fsevents "~2.3.2" + +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + +commander@^4.0.0: + version "4.1.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" + integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== + +cross-spawn@^7.0.0: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" + integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +cssesc@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee" + integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg== + +didyoumean@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/didyoumean/-/didyoumean-1.2.2.tgz#989346ffe9e839b4555ecf5666edea0d3e8ad037" + integrity sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw== + +dlv@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/dlv/-/dlv-1.1.3.tgz#5c198a8a11453596e751494d49874bc7732f2e79" + integrity sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA== + +eastasianwidth@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" + integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== + +electron-to-chromium@^1.4.820: + version "1.5.0" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.0.tgz#0d3123a9f09189b9c7ab4b5d6848d71b3c1fd0e8" + integrity sha512-Vb3xHHYnLseK8vlMJQKJYXJ++t4u1/qJ3vykuVrVjvdiOEhYyT1AuP4x03G8EnPmYvYOhe9T+dADTmthjRQMkA== + +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + +emoji-regex@^9.2.2: + version "9.2.2" + resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-9.2.2.tgz#840c8803b0d8047f4ff0cf963176b32d4ef3ed72" + integrity sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg== + +escalade@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/escalade/-/escalade-3.1.2.tgz#54076e9ab29ea5bf3d8f1ed62acffbb88272df27" + integrity sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA== + +fast-glob@^3.3.0: + version "3.3.2" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129" + integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow== + dependencies: + "@nodelib/fs.stat" "^2.0.2" + "@nodelib/fs.walk" "^1.2.3" + glob-parent "^5.1.2" + merge2 "^1.3.0" + micromatch "^4.0.4" + +fastq@^1.6.0: + version "1.17.1" + resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.17.1.tgz#2a523f07a4e7b1e81a42b91b8bf2254107753b47" + integrity sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w== + dependencies: + reusify "^1.0.4" + +fill-range@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" + integrity sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg== + dependencies: + to-regex-range "^5.0.1" + +foreground-child@^3.1.0: + version "3.2.1" + resolved "https://registry.yarnpkg.com/foreground-child/-/foreground-child-3.2.1.tgz#767004ccf3a5b30df39bed90718bab43fe0a59f7" + integrity sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA== + dependencies: + cross-spawn "^7.0.0" + signal-exit "^4.0.1" + +fraction.js@^4.3.7: + version "4.3.7" + resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.3.7.tgz#06ca0085157e42fda7f9e726e79fefc4068840f7" + integrity sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew== + +fsevents@~2.3.2: + version "2.3.3" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" + integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== + +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + +glob-parent@^5.1.2, glob-parent@~5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" + integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== + dependencies: + is-glob "^4.0.1" + +glob-parent@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3" + integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A== + dependencies: + is-glob "^4.0.3" + +glob@^10.3.10: + version "10.4.5" + resolved "https://registry.yarnpkg.com/glob/-/glob-10.4.5.tgz#f4d9f0b90ffdbab09c9d77f5f29b4262517b0956" + integrity sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg== + dependencies: + foreground-child "^3.1.0" + jackspeak "^3.1.2" + minimatch "^9.0.4" + minipass "^7.1.2" + package-json-from-dist "^1.0.0" + path-scurry "^1.11.1" + +hasown@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.2.tgz#003eaf91be7adc372e84ec59dc37252cedb80003" + integrity sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ== + dependencies: + function-bind "^1.1.2" + +is-binary-path@~2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" + integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== + dependencies: + binary-extensions "^2.0.0" + +is-core-module@^2.13.0: + version "2.15.0" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.15.0.tgz#71c72ec5442ace7e76b306e9d48db361f22699ea" + integrity sha512-Dd+Lb2/zvk9SKy1TGCt1wFJFo/MWBPMX5x7KcvLajWTGuomczdQX61PvY5yK6SVACwpoexWo81IfFyoKY2QnTA== + dependencies: + hasown "^2.0.2" + +is-extglob@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" + integrity sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ== + +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + +is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== + +jackspeak@^3.1.2: + version "3.4.3" + resolved "https://registry.yarnpkg.com/jackspeak/-/jackspeak-3.4.3.tgz#8833a9d89ab4acde6188942bd1c53b6390ed5a8a" + integrity sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw== + dependencies: + "@isaacs/cliui" "^8.0.2" + optionalDependencies: + "@pkgjs/parseargs" "^0.11.0" + +jiti@^1.21.0: + version "1.21.6" + resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.21.6.tgz#6c7f7398dd4b3142767f9a168af2f317a428d268" + integrity sha512-2yTgeWTWzMWkHu6Jp9NKgePDaYHbntiwvYuuJLbbN9vl7DC9DvXKOB2BC3ZZ92D3cvV/aflH0osDfwpHepQ53w== + +lilconfig@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.1.0.tgz#78e23ac89ebb7e1bfbf25b18043de756548e7f52" + integrity sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ== + +lilconfig@^3.0.0: + version "3.1.2" + resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-3.1.2.tgz#e4a7c3cb549e3a606c8dcc32e5ae1005e62c05cb" + integrity sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow== + +lines-and-columns@^1.1.6: + version "1.2.4" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632" + integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg== + +lru-cache@^10.2.0: + version "10.4.3" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.4.3.tgz#410fc8a17b70e598013df257c2446b7f3383f119" + integrity sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ== + +merge2@^1.3.0: + version "1.4.1" + resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" + integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== + +micromatch@^4.0.4, micromatch@^4.0.5: + version "4.0.7" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.7.tgz#33e8190d9fe474a9895525f5618eee136d46c2e5" + integrity sha512-LPP/3KorzCwBxfeUuZmaR6bG2kdeHSbe0P2tY3FLRU4vYrjYz5hI4QZwV0njUx3jeuKe67YukQ1LSPZBKDqO/Q== + dependencies: + braces "^3.0.3" + picomatch "^2.3.1" + +minimatch@^9.0.4: + version "9.0.5" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5" + integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow== + dependencies: + brace-expansion "^2.0.1" + +"minipass@^5.0.0 || ^6.0.2 || ^7.0.0", minipass@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-7.1.2.tgz#93a9626ce5e5e66bd4db86849e7515e92340a707" + integrity sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw== + +mz@^2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" + integrity sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q== + dependencies: + any-promise "^1.0.0" + object-assign "^4.0.1" + thenify-all "^1.0.0" + +nanoid@^3.3.7: + version "3.3.7" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" + integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== + +node-releases@^2.0.14: + version "2.0.18" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.18.tgz#f010e8d35e2fe8d6b2944f03f70213ecedc4ca3f" + integrity sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g== + +normalize-path@^3.0.0, normalize-path@~3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" + integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== + +normalize-range@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/normalize-range/-/normalize-range-0.1.2.tgz#2d10c06bdfd312ea9777695a4d28439456b75942" + integrity sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA== + +object-assign@^4.0.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" + integrity sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg== + +object-hash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9" + integrity sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw== + +package-json-from-dist@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz#e501cd3094b278495eb4258d4c9f6d5ac3019f00" + integrity sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw== + +path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +path-parse@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" + integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== + +path-scurry@^1.11.1: + version "1.11.1" + resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.11.1.tgz#7960a668888594a0720b12a911d1a742ab9f11d2" + integrity sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA== + dependencies: + lru-cache "^10.2.0" + minipass "^5.0.0 || ^6.0.2 || ^7.0.0" + +picocolors@^1.0.0, picocolors@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1" + integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew== + +picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" + integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== + +pify@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" + integrity sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog== + +pirates@^4.0.1: + version "4.0.6" + resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.6.tgz#3018ae32ecfcff6c29ba2267cbf21166ac1f36b9" + integrity sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg== + +postcss-import@^15.1.0: + version "15.1.0" + resolved "https://registry.yarnpkg.com/postcss-import/-/postcss-import-15.1.0.tgz#41c64ed8cc0e23735a9698b3249ffdbf704adc70" + integrity sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew== + dependencies: + postcss-value-parser "^4.0.0" + read-cache "^1.0.0" + resolve "^1.1.7" + +postcss-js@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/postcss-js/-/postcss-js-4.0.1.tgz#61598186f3703bab052f1c4f7d805f3991bee9d2" + integrity sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw== + dependencies: + camelcase-css "^2.0.1" + +postcss-load-config@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-load-config/-/postcss-load-config-4.0.2.tgz#7159dcf626118d33e299f485d6afe4aff7c4a3e3" + integrity sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ== + dependencies: + lilconfig "^3.0.0" + yaml "^2.3.4" + +postcss-nested@^6.0.1: + version "6.2.0" + resolved "https://registry.yarnpkg.com/postcss-nested/-/postcss-nested-6.2.0.tgz#4c2d22ab5f20b9cb61e2c5c5915950784d068131" + integrity sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ== + dependencies: + postcss-selector-parser "^6.1.1" + +postcss-selector-parser@^6.0.11, postcss-selector-parser@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.1.1.tgz#5be94b277b8955904476a2400260002ce6c56e38" + integrity sha512-b4dlw/9V8A71rLIDsSwVmak9z2DuBUB7CA1/wSdelNEzqsjoSPeADTWNO09lpH49Diy3/JIZ2bSPB1dI3LJCHg== + dependencies: + cssesc "^3.0.0" + util-deprecate "^1.0.2" + +postcss-value-parser@^4.0.0, postcss-value-parser@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514" + integrity sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ== + +postcss@^8.4.23, postcss@^8.4.39: + version "8.4.39" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.39.tgz#aa3c94998b61d3a9c259efa51db4b392e1bde0e3" + integrity sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw== + dependencies: + nanoid "^3.3.7" + picocolors "^1.0.1" + source-map-js "^1.2.0" + +queue-microtask@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243" + integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A== + +read-cache@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/read-cache/-/read-cache-1.0.0.tgz#e664ef31161166c9751cdbe8dbcf86b5fb58f774" + integrity sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA== + dependencies: + pify "^2.3.0" + +readdirp@~3.6.0: + version "3.6.0" + resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" + integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== + dependencies: + picomatch "^2.2.1" + +resolve@^1.1.7, resolve@^1.22.2: + version "1.22.8" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.22.8.tgz#b6c87a9f2aa06dfab52e3d70ac8cde321fa5a48d" + integrity sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw== + dependencies: + is-core-module "^2.13.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + +reusify@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" + integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== + +run-parallel@^1.1.9: + version "1.2.0" + resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" + integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA== + dependencies: + queue-microtask "^1.2.2" + +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + +signal-exit@^4.0.1: + version "4.1.0" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" + integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== + +source-map-js@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.2.0.tgz#16b809c162517b5b8c3e7dcd315a2a5c2612b2af" + integrity sha512-itJW8lvSA0TXEphiRoawsCksnlf8SyvmFzIhltqAHluXd88pkCd+cXJVHTDwdCr0IzwptSm035IHQktUu1QUMg== + +"string-width-cjs@npm:string-width@^4.2.0": + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^4.1.0: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + +string-width@^5.0.1, string-width@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" + integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA== + dependencies: + eastasianwidth "^0.2.0" + emoji-regex "^9.2.2" + strip-ansi "^7.0.1" + +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@^7.0.1: + version "7.1.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" + integrity sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ== + dependencies: + ansi-regex "^6.0.1" + +sucrase@^3.32.0: + version "3.35.0" + resolved "https://registry.yarnpkg.com/sucrase/-/sucrase-3.35.0.tgz#57f17a3d7e19b36d8995f06679d121be914ae263" + integrity sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA== + dependencies: + "@jridgewell/gen-mapping" "^0.3.2" + commander "^4.0.0" + glob "^10.3.10" + lines-and-columns "^1.1.6" + mz "^2.7.0" + pirates "^4.0.1" + ts-interface-checker "^0.1.9" + +supports-preserve-symlinks-flag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" + integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w== + +tailwindcss@^3.4.4: + version "3.4.6" + resolved "https://registry.yarnpkg.com/tailwindcss/-/tailwindcss-3.4.6.tgz#41faae16607e0916da1eaa4a3b44053457ba70dd" + integrity sha512-1uRHzPB+Vzu57ocybfZ4jh5Q3SdlH7XW23J5sQoM9LhE9eIOlzxer/3XPSsycvih3rboRsvt0QCmzSrqyOYUIA== + dependencies: + "@alloc/quick-lru" "^5.2.0" + arg "^5.0.2" + chokidar "^3.5.3" + didyoumean "^1.2.2" + dlv "^1.1.3" + fast-glob "^3.3.0" + glob-parent "^6.0.2" + is-glob "^4.0.3" + jiti "^1.21.0" + lilconfig "^2.1.0" + micromatch "^4.0.5" + normalize-path "^3.0.0" + object-hash "^3.0.0" + picocolors "^1.0.0" + postcss "^8.4.23" + postcss-import "^15.1.0" + postcss-js "^4.0.1" + postcss-load-config "^4.0.1" + postcss-nested "^6.0.1" + postcss-selector-parser "^6.0.11" + resolve "^1.22.2" + sucrase "^3.32.0" + +thenify-all@^1.0.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/thenify-all/-/thenify-all-1.6.0.tgz#1a1918d402d8fc3f98fbf234db0bcc8cc10e9726" + integrity sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA== + dependencies: + thenify ">= 3.1.0 < 4" + +"thenify@>= 3.1.0 < 4": + version "3.3.1" + resolved "https://registry.yarnpkg.com/thenify/-/thenify-3.3.1.tgz#8932e686a4066038a016dd9e2ca46add9838a95f" + integrity sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw== + dependencies: + any-promise "^1.0.0" + +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + +ts-interface-checker@^0.1.9: + version "0.1.13" + resolved "https://registry.yarnpkg.com/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz#784fd3d679722bc103b1b4b8030bcddb5db2a699" + integrity sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA== + +update-browserslist-db@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz#7ca61c0d8650766090728046e416a8cde682859e" + integrity sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ== + dependencies: + escalade "^3.1.2" + picocolors "^1.0.1" + +util-deprecate@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" + integrity sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw== + +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + +wrap-ansi@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" + integrity sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ== + dependencies: + ansi-styles "^6.1.0" + string-width "^5.0.1" + strip-ansi "^7.0.1" + +yaml@^2.3.4: + version "2.5.0" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.5.0.tgz#c6165a721cf8000e91c36490a41d7be25176cf5d" + integrity sha512-2wWLbGbYDiSqqIKoPjar3MPgB94ErzCtrNE1FdqGuaO0pi2JGjmE8aW8TDZwzU7vuxcGRdL/4gPQwQ7hD5AMSw== From 40a2887ae2bc1441a6c354bba6911847731ae79e Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Thu, 25 Jul 2024 00:12:06 +0200 Subject: [PATCH 10/17] PUSH -> Add lint -> More work! --- .github/workflows/lint.yml | 54 + .gitignore | 1 + addons/Example/Example.php | 3 - api/System/logs.php | 7 +- api/User/login.php | 5 +- app/Cli/Colors.php | 3 +- app/Cli/Commands/Colors.php | 16 + app/Cli/Commands/Command.php | 72 + app/Cli/Commands/Configure.php | 99 + app/Cli/Commands/Down.php | 21 + app/Cli/Commands/Help.php | 35 + app/Cli/Commands/Migrate.php | 58 + app/Cli/Commands/Rebuild.php | 105 + app/Cli/Commands/Up.php | 21 + app/Cli/Kernel.php | 80 +- app/Database/MySQL.php | 112 +- app/Database/MySQLCache.php | 6 +- app/Database/Redis/Redis.php | 5 +- .../exception/database/MySQLError.php | 14 + .../exception/migration/NoMigrationsFound.php | 14 + app/Handlers/ActivityHandler.php | 8 +- app/Handlers/AnnouncementHandler.php | 100 +- app/Handlers/CacheHandler.php | 6 +- app/Handlers/NotificationHandler.php | 34 +- .../AnnouncementNotFoundException.php | 2 +- .../NotificationNotFoundException.php | 2 +- .../interfaces/AnnouncementSocial.php | 3 +- app/Kernel/Debugger.php | 10 +- app/Kernel/Encryption.php | 8 +- app/Kernel/Logger.php | 6 +- app/Kernel/LoggerLevels.php | 2 +- app/Managers/ConfigManager.php | 28 +- app/Managers/LanguageManager.php | 9 +- app/Managers/Settings.php | 56 +- app/Managers/SettingsManager.php | 19 +- app/Managers/SnowFlakeManager.php | 22 +- .../exception/settings/NoMigrationsFound.php | 14 + app/Plugins/Events/ActivityEvent.php | 9 +- app/Plugins/Events/AnnouncementEvent.php | 10 +- app/Plugins/Events/ApplicationEvent.php | 12 +- app/Plugins/Events/CliCommandEvent.php | 7 +- app/Plugins/Events/ConfigEvent.php | 9 +- app/Plugins/Events/CronEvent.php | 9 +- app/Plugins/Events/DatabaseEvent.php | 5 +- app/Plugins/Events/EncryptionEvent.php | 9 +- app/Plugins/Events/ExceptionEvent.php | 7 +- app/Plugins/Events/LoggerEvent.php | 15 +- app/Plugins/Events/NotificationEvent.php | 10 +- app/Plugins/Events/PageEvent.php | 5 +- app/Plugins/Events/PermissionEvent.php | 9 +- app/Plugins/Events/RendererEvent.php | 10 +- app/Plugins/Events/RoleEvent.php | 7 +- app/Plugins/Events/RouterEvent.php | 8 +- app/Plugins/Events/SettingEvent.php | 14 +- app/Plugins/Events/SnowFlakeEvent.php | 9 +- app/Plugins/Events/TranslationEvent.php | 7 +- app/Plugins/Events/UnitTestEvent.php | 8 +- app/Plugins/PluginsEventHandler.php | 8 +- app/Plugins/PluginsManager.php | 22 +- app/Roles/RolesDataHandler.php | 24 +- app/Roles/RolesHelper.php | 6 +- app/Roles/RolesPermissionDataHandler.php | 31 +- app/User/Exceptions/UserException.php | 8 +- app/User/UserDataHandler.php | 31 +- app/User/UserHelper.php | 93 +- commands/core/cache/cacheprocess.php | 10 +- commands/core/cache/cachepurge.php | 10 +- commands/core/config/configmigrate.php | 45 - commands/core/database/dbconfigure.php | 79 - commands/core/database/dbmigrate.php | 81 - commands/core/database/dbrebuild.php | 56 - commands/core/encryption/newkey.php | 13 +- commands/core/status/down.php | 16 - commands/core/status/up.php | 16 - commands/custom/setup.php | 21 - composer.json | 25 +- composer.lock | 3608 +++++++++++++---- cron/jobs/SettingsJob.php | 1 + cron/jobs/cacheJob.php | 5 +- cron/runner.php | 10 +- devtools/lint.bash | 1 + framework | 7 +- install/install.php | 20 +- install/mysql.php | 2 +- lang/en_US.php | 20 +- migrate/config/1.php | 3 +- migrate/config/2.php | 3 +- migrate/config/3.php | 3 +- migrate/database/1.sql | 1 + public/index.php | 3 +- routes/views/core.php | 8 +- routes/views/index.php | 11 +- tests/EncryptionTest.php | 8 +- yarn.lock | 0 94 files changed, 4045 insertions(+), 1503 deletions(-) create mode 100755 .github/workflows/lint.yml create mode 100755 app/Cli/Commands/Colors.php create mode 100755 app/Cli/Commands/Command.php create mode 100755 app/Cli/Commands/Configure.php create mode 100755 app/Cli/Commands/Down.php create mode 100755 app/Cli/Commands/Help.php create mode 100755 app/Cli/Commands/Migrate.php create mode 100755 app/Cli/Commands/Rebuild.php create mode 100755 app/Cli/Commands/Up.php create mode 100755 app/Database/exception/database/MySQLError.php create mode 100755 app/Database/exception/migration/NoMigrationsFound.php create mode 100755 app/Managers/exception/settings/NoMigrationsFound.php delete mode 100755 commands/core/config/configmigrate.php delete mode 100755 commands/core/database/dbconfigure.php delete mode 100755 commands/core/database/dbmigrate.php delete mode 100755 commands/core/database/dbrebuild.php delete mode 100755 commands/core/status/down.php delete mode 100755 commands/core/status/up.php delete mode 100755 commands/custom/setup.php create mode 100755 devtools/lint.bash mode change 100644 => 100755 yarn.lock diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100755 index 0000000..b747f7e --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,54 @@ +name: Lint + +on: + push: + branches: + - "develop" + - "1.0-develop" + pull_request: + branches: + - "develop" + - "1.0-develop" + +jobs: + lint: + name: Lint + runs-on: ubuntu-20.04 + steps: + - name: Code Checkout + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "8.3" + extensions: bcmath, curl, gd, mbstring, mysql, openssl, pdo, tokenizer, xml, zip + tools: composer:v2 + coverage: none + + - name: Install dependencies + run: composer install --no-interaction --no-progress --no-suggest --prefer-dist + + - name: PHP CS Fixer (APP) + run: vendor/bin/php-cs-fixer fix app --dry-run + + - name: PHP CS Fixer (Tests) + run: vendor/bin/php-cs-fixer fix tests --dry-run + - name: PHP CS Fixer (Routes) + run: vendor/bin/php-cs-fixer fix routes --dry-run + - name: PHP CS Fixer (Lang) + run: vendor/bin/php-cs-fixer fix lang --dry-run + - name: PHP CS Fixer (Cron) + run: vendor/bin/php-cs-fixer fix lang --dry-run + - name: PHP CS Fixer (API) + run: vendor/bin/php-cs-fixer fix api --dry-run + - name: PHP CS Fixer (Addons) + run: vendor/bin/php-cs-fixer fix addons --dry-run + - name: PHP CS Fixer (Commands) + run: vendor/bin/php-cs-fixer fix commands --dry-run + - name: PHP CS Fixer (Install) + run: vendor/bin/php-cs-fixer fix install --dry-run + - name: PHP CS Fixer (Public) + run: vendor/bin/php-cs-fixer fix public --dry-run + - name: PHP CS Fixer (Migrate) + run: vendor/bin/php-cs-fixer fix migrate --dry-run diff --git a/.gitignore b/.gitignore index e1ff5e2..6e144da 100755 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ composer.phar /test.json /caches/*/ caches/last_settings_migrate_run +.php-cs-fixer.cache diff --git a/addons/Example/Example.php b/addons/Example/Example.php index 2a44c8f..dc81f57 100755 --- a/addons/Example/Example.php +++ b/addons/Example/Example.php @@ -3,11 +3,8 @@ class Example { - public function Main(array $args = []) { } } - -?> \ No newline at end of file diff --git a/api/System/logs.php b/api/System/logs.php index fa2cc75..b513a2a 100755 --- a/api/System/logs.php +++ b/api/System/logs.php @@ -1,4 +1,5 @@ - Logger::getAllSortedByDate(LoggerTypes::OTHER, LoggerLevels::OTHER,10) + "logs" => Logger::getAllSortedByDate(LoggerTypes::OTHER, LoggerLevels::OTHER, 10) ]); -} \ No newline at end of file +} diff --git a/api/User/login.php b/api/User/login.php index e30faf3..14ea07c 100755 --- a/api/User/login.php +++ b/api/User/login.php @@ -1,4 +1,5 @@ - \ No newline at end of file diff --git a/app/Cli/Colors.php b/app/Cli/Colors.php index 04cd29e..2fa7495 100755 --- a/app/Cli/Colors.php +++ b/app/Cli/Colors.php @@ -164,7 +164,8 @@ public static function Underline(): string return "\033[4m"; } - public static function NewLine() : string { + public static function NewLine(): string + { return "\n"; } diff --git a/app/Cli/Commands/Colors.php b/app/Cli/Commands/Colors.php new file mode 100755 index 0000000..e2797ae --- /dev/null +++ b/app/Cli/Commands/Colors.php @@ -0,0 +1,16 @@ +tryConnection($host, $port, $username, $password, $database) == true) { + echo self::NewLine(); + echo self::translateColorsCode("&fConnection to the database was &asuccessful!&o"); + echo self::NewLine(); + echo self::translateColorsCode("&fSaving the configuration...&o"); + cfg::set("database", "host", $host); + cfg::set("database", "port", $port); + cfg::set("database", "username", $username); + cfg::set("database", "password", $password); + cfg::set("database", "name", $database); + echo self::translateColorsCode("&fConfiguration saved &asuccessfully!&o"); + } else { + echo self::translateColorsCode("&7Failed to connect to the database. &o&fPlease check the provided information."); + } + + } + + public static function configure(): void + { + + } +} diff --git a/app/Cli/Commands/Down.php b/app/Cli/Commands/Down.php new file mode 100755 index 0000000..6eeb63e --- /dev/null +++ b/app/Cli/Commands/Down.php @@ -0,0 +1,21 @@ +hasProperty('description')) { + continue; + } + + echo self::log_info("{$command} > {$reflectionClass->getProperty('description')->getValue()}"); + } + echo self::log_info(""); + } +} diff --git a/app/Cli/Commands/Migrate.php b/app/Cli/Commands/Migrate.php new file mode 100755 index 0000000..e73d085 --- /dev/null +++ b/app/Cli/Commands/Migrate.php @@ -0,0 +1,58 @@ +getMessage() . ""); + } + } + + public static function cfg(): void + { + + } +} diff --git a/app/Cli/Commands/Rebuild.php b/app/Cli/Commands/Rebuild.php new file mode 100755 index 0000000..e74ea91 --- /dev/null +++ b/app/Cli/Commands/Rebuild.php @@ -0,0 +1,105 @@ +tryConnection(cfg::get("database", "host"), cfg::get("database", "port"), cfg::get("database", "username"), cfg::get("database", "password"), cfg::get("database", "name")) == true) { + echo self::translateColorsCode("&o&fConnection to the database was &asuccessful!&o"); + echo self::NewLine(); + echo self::translateColorsCode("&4&lWARNING: &fThis option will wipe the database. &o"); + echo self::translateColorsCode("&4&lWARNING: &fOnly use this function if you know what you are doing &o"); + echo self::translateColorsCode("&4&lWARNING: &fOnce you wipe the database there is no going back! &o"); + echo self::translateColorsCode("&4&lWARNING: &fPlease be careful and don't play around with commands! &o"); + echo self::translateColorsCode("&4&lWARNING: &fThere is no other message then this so keep in mind! &o"); + echo self::translateColorsCode("&4&lWARNING: &fDo you really want to wipe the database? (&ey&f/&en&f): "); + + $confirm = readline(); + if (strtolower($confirm) == 'y') { + try { + $mysql = new MySQL(); + $db = $mysql->connectPDO(); + + $db->exec("SET FOREIGN_KEY_CHECKS = 0"); + $tables = $db->query("SHOW TABLES")->fetchAll(PDO::FETCH_COLUMN); + foreach ($tables as $table) { + $db->exec("DROP TABLE IF EXISTS $table"); + } + $db->exec("SET FOREIGN_KEY_CHECKS = 1"); + echo self::NewLine(); + echo self::NewLine(); + echo self::NewLine(); + echo self::NewLine(); + echo self::NewLine(); + echo self::translateColorsCode("&fDatabase wiped!!&o"); + MySQL::migrate(true); + Settings::migrate(true); + echo self::NewLine(); + echo self::translateColorsCode("&fDatabase rebuilt!&o"); + echo self::translateColorsCode("&fLet's start by setting up your configuration!&o"); + Configure::configure(); + } catch (PDOException $e) { + echo self::translateColorsCode("&fFailed to drop tables: &c" . $e->getMessage() . "&o"); + echo self::NewLine(); + } + } else { + self::exit("&fExiting...&o"); + } + } else { + self::exit("&cFailed to connect to the database!&o"); + } + } catch (Exception $e) { + self::exit("&cFailed to rebuild the database: &r" . $e->getMessage() . ""); + } + } + + public static function app(): void + { + try { + self::log_info("Rebuilding the app..."); + self::log_info(""); + self::log_success("&rApp rebuilt &asuccessfully&r!"); + self::exit(); + } catch (Exception $e) { + die("Failed to rebuild the app: " . $e->getMessage() . ""); + } + } +} diff --git a/app/Cli/Commands/Up.php b/app/Cli/Commands/Up.php new file mode 100755 index 0000000..c2c93af --- /dev/null +++ b/app/Cli/Commands/Up.php @@ -0,0 +1,21 @@ +execute(true); - } else { - throw new Exception("Command class not found: $commandClass"); - } - } else { - throw new Exception("Command file not found: $commandName"); + $commandName = ucfirst($commandName); + $commandFile = __DIR__ . "/Commands/$commandName.php"; + + if (!file_exists($commandFile)) { + throw new Exception("Command not found!"); + } + + require_once $commandFile; + + $commandClass = "MythicalSystemsFramework\\Cli\\Commands\\$commandName"; + + if (!class_exists($commandClass)) { + throw new Exception("Command not found!"); } - } + $reflectionClass = new ReflectionClass($commandClass); + + if (!$reflectionClass->hasProperty('description')) { + throw new Exception("Command class '$commandClass' does not have 'name' or 'description' properties."); + } + + $commandClass::execute(true); + + } /** - * Recursively searches for the command file with the specified command name. + * Exit the CLI application. + * + * @param string $message The message to display before exiting. * - * @param string $commandName The name of the command to search for. - * @param string $directory The directory to search in. Defaults to '/var/www/network-masters/framework/commands'. - * - * @return string|null The path to the command file if found, or null if not found. + * @return void */ - public static function findCommandFile($commandName, $directory = __DIR__ . '/../../commands'): string|null + public static function exit(string $message = '&7Application exited &asuccessfully&7!'): void { - $files = scandir($directory); - foreach ($files as $file) { - if ($file === '.' || $file === '..') { - continue; - } - $path = $directory . '/' . $file; - if (is_dir($path)) { - $subCommandFile = self::findCommandFile($commandName, $path); - if ($subCommandFile !== null) { - return $subCommandFile; - } - } elseif (pathinfo($file, PATHINFO_FILENAME) === $commandName) { - return $path; - } + if ($message !== '') { + echo self::translateColorsCode($message); } - return null; + + exit; } -} \ No newline at end of file +} diff --git a/app/Database/MySQL.php b/app/Database/MySQL.php index 934f8b3..ecee282 100755 --- a/app/Database/MySQL.php +++ b/app/Database/MySQL.php @@ -2,6 +2,9 @@ namespace MythicalSystemsFramework\Database; +use MythicalSystemsFramework\Cli\Kernel; +use MythicalSystemsFramework\Database\exception\database\MySQLError; +use MythicalSystemsFramework\Database\exception\migration\NoMigrationsFound; use MythicalSystemsFramework\Managers\ConfigManager as cfg; use MythicalSystemsFramework\Kernel\Logger; use MythicalSystemsFramework\Kernel\LoggerLevels; @@ -14,10 +17,10 @@ class MySQL { private static $connection; - + public static int $migrated_files_count; /** * Connects to the database server using PDO. - * + * * @return PDO The PDO object representing the database connection. * @throws PDOException If the connection to the database fails. */ @@ -37,7 +40,7 @@ public function connectPDO(): PDO /** * Connects to the database server using MYSQLI. - * + * * @return mysqli */ public function connectMYSQLI(): mysqli @@ -61,7 +64,7 @@ public function connectMYSQLI(): mysqli /** * Close a database connection if open - * + * * @return void */ public static function closeConnection(): void @@ -80,9 +83,9 @@ public static function closeConnection(): void * @param string $username The username * @param string $password The password * @param string $database The database name - * + * * @return bool True if the connection is successful, false otherwise. - * @throws PDOException If the connection to the database fails. * + * @throws PDOException If the connection to the database fails. * */ public function tryConnection(string $host, string|int $port, string $username, string $password, string $database): bool { @@ -99,10 +102,10 @@ public function tryConnection(string $host, string|int $port, string $username, /** * Try to lock a record! - * + * * @param string $table The table name! * @param string $id The record id! - * + * * @return void */ public function requestLock(string $table, string $id): void @@ -125,10 +128,10 @@ public function requestLock(string $table, string $id): void /** * Try to unlock a record. * Unlock a record so you can write and read it! - * + * * @param string $table The table name! * @param string $id The id of the record! - * + * * @return void */ public static function requestUnLock(string $table, string $id): void @@ -150,10 +153,10 @@ public static function requestUnLock(string $table, string $id): void } /** * Get the lock status of a record. - * + * * @param string $table The table name * @param string $id The id of the record - * + * * @return bool */ public static function getLock(string $table, string $id): bool @@ -176,9 +179,9 @@ public static function getLock(string $table, string $id): bool } /** * Does a table exist in the database? - * + * * @param string $table The table name - * + * * @return bool */ public static function doesTableExist(string $table): bool @@ -186,7 +189,7 @@ public static function doesTableExist(string $table): bool try { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $conn->query("SELECT * FROM ".mysqli_real_escape_string($conn, $table)); + $conn->query("SELECT * FROM " . mysqli_real_escape_string($conn, $table)); return true; } catch (Exception $e) { Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "Failed to check if table exists: " . $e); @@ -195,13 +198,14 @@ public static function doesTableExist(string $table): bool } /** * Does a record exist in the database? - * + * * @param string $table Table name * @param string $search The term you want to search for (id) * @param string $term What the value should be (1) * @return bool */ - public static function doesRecordExist(string $table, string $search, string $term) : bool { + public static function doesRecordExist(string $table, string $search, string $term): bool + { try { if (self::doesTableExist($table) === false) { return false; @@ -218,4 +222,76 @@ public static function doesRecordExist(string $table, string $search, string $te return false; } } -} \ No newline at end of file + + /** + * Migrate the database. + * + * @return void + */ + public static function migrate(bool $isCli = false): void + { + try { + + $mysql = new MySQL(); + $db = $mysql->connectPDO(); + + $db->exec(" + CREATE TABLE IF NOT EXISTS framework_migrations ( + id INT AUTO_INCREMENT PRIMARY KEY, + script VARCHAR(255) NOT NULL, + executed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP + ) + "); + + $sqlFiles = glob(__DIR__ . '/../../migrate/database/*.sql'); + + if (count($sqlFiles) > 0) { + usort($sqlFiles, function ($a, $b) { + $aDate = intval(basename($a, '.sql')); + $bDate = intval(basename($b, '.sql')); + return $aDate - $bDate; + }); + + foreach ($sqlFiles as $sqlFile) { + $script = file_get_contents($sqlFile); + + $fileName = basename($sqlFile); // Get only the file name + + $stmt = $db->prepare("SELECT COUNT(*) FROM framework_migrations WHERE script = ?"); + $stmt->execute([$fileName]); + $count = $stmt->fetchColumn(); + + if ($count == 0) { + $db->exec($script); + + $stmt = $db->prepare("INSERT INTO framework_migrations (script) VALUES (?)"); + $stmt->execute([$fileName]); + if ($isCli == true) { + echo Kernel::translateColorsCode("&fExecuted migration: &e" . $fileName . "&o"); + echo Kernel::NewLine(); + } + } else { + if ($isCli == true) { + echo Kernel::translateColorsCode("&fSkipping migration: &e" . $fileName . " &f(&ealready executed&f)&o"); + echo Kernel::NewLine(); + } + } + } + } else { + if ($isCli == true) { + echo Kernel::translateColorsCode("&cNo migrations found!&o"); + echo Kernel::NewLine(); + } else { + throw new NoMigrationsFound(); + } + } + } catch (PDOException $e) { + if ($isCli == true) { + echo Kernel::translateColorsCode("&cFailed to migrate the database: " . $e->getMessage() . "&o"); + echo Kernel::NewLine(); + } else { + throw new MySQLError("Failed to migrate the database: " . $e->getMessage()); + } + } + } +} diff --git a/app/Database/MySQLCache.php b/app/Database/MySQLCache.php index f033ac7..aac2c35 100755 --- a/app/Database/MySQLCache.php +++ b/app/Database/MySQLCache.php @@ -26,7 +26,7 @@ public static function saveCache(string $table_name): void /** * Specific table dump settings! - * + * * @requires framework_settings */ if ($table_name == "framework_settings") { @@ -74,7 +74,7 @@ public static function saveCache(string $table_name): void "date_created" => date("Y-m-d H:i:s"), "date_expire" => date("Y-m-d H:i:s", strtotime("+".$data["caches"]["settings_cache_life"]." seconds")), ]; - $data = array_merge($cache_info,$data); + $data = array_merge($cache_info, $data); $json = json_encode($data, JSON_PRETTY_PRINT); Settings::up(); file_put_contents(Settings::$cache_path . '/' . $table_name . '.json', $json); @@ -92,4 +92,4 @@ public static function deleteCaches(): void } } } -} \ No newline at end of file +} diff --git a/app/Database/Redis/Redis.php b/app/Database/Redis/Redis.php index a9a213f..59c5082 100755 --- a/app/Database/Redis/Redis.php +++ b/app/Database/Redis/Redis.php @@ -2,12 +2,11 @@ namespace MythicalSystemsFramework\Database\Redis; - class Redis { public static function getConnection() { - + } -} \ No newline at end of file +} diff --git a/app/Database/exception/database/MySQLError.php b/app/Database/exception/database/MySQLError.php new file mode 100755 index 0000000..17213bd --- /dev/null +++ b/app/Database/exception/database/MySQLError.php @@ -0,0 +1,14 @@ +connectMYSQLI(); @@ -253,17 +252,18 @@ public static function markAsRead(string $notification_id, string $user_uuid) : } catch (Exception $e) { throw new Exception("" . $e->getMessage()); } - } + } /** * Check if a notification was already read! - * + * * @param string $notification_id The id of the notification * @param string $user_uuid The uuid of the user - * + * * @throws Exception * @return bool */ - public static function hasAlreadyRead(string $notification_id, string $user_uuid) : bool { + public static function hasAlreadyRead(string $notification_id, string $user_uuid): bool + { try { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); diff --git a/app/Handlers/exception/AnnouncementNotFoundException.php b/app/Handlers/exception/AnnouncementNotFoundException.php index ac11ab0..acb8a33 100755 --- a/app/Handlers/exception/AnnouncementNotFoundException.php +++ b/app/Handlers/exception/AnnouncementNotFoundException.php @@ -8,4 +8,4 @@ public function __construct($message = "Announcement not found.", $code = 0, \Th { parent::__construct($message, $code, $previous); } -} \ No newline at end of file +} diff --git a/app/Handlers/exception/NotificationNotFoundException.php b/app/Handlers/exception/NotificationNotFoundException.php index fa9c544..b514849 100755 --- a/app/Handlers/exception/NotificationNotFoundException.php +++ b/app/Handlers/exception/NotificationNotFoundException.php @@ -8,4 +8,4 @@ public function __construct($message = "Notification not found.", $code = 0, \Ex { parent::__construct($message, $code, $previous); } -} \ No newline at end of file +} diff --git a/app/Handlers/interfaces/AnnouncementSocial.php b/app/Handlers/interfaces/AnnouncementSocial.php index 7f19479..bc8a92b 100755 --- a/app/Handlers/interfaces/AnnouncementSocial.php +++ b/app/Handlers/interfaces/AnnouncementSocial.php @@ -2,7 +2,8 @@ namespace MythicalSystemsFramework\Handlers\interfaces; -interface AnnouncementSocial { +interface AnnouncementSocial +{ public static const Read = "read"; public static const Like = "like"; public static const Dislike = "dislike"; diff --git a/app/Kernel/Debugger.php b/app/Kernel/Debugger.php index 2b0f178..d43e239 100755 --- a/app/Kernel/Debugger.php +++ b/app/Kernel/Debugger.php @@ -8,10 +8,10 @@ class Debugger { /** * Display the information - * + * * @param mixed $input The input to display the info about! * @param bool $collapse This is always false by default - * + * * @return void */ public static function display_info($input, $collapse = false): void @@ -144,13 +144,13 @@ public static function display_info($input, $collapse = false): void /** * Throw an error - * + * * @param mixed $renderer The twig renderer * @param string $error_text The error text * @param string $error_full_message The full error message * @param int $error_database_id The error database id * @param string $error_file_path The error file path - * + * * @return void IT will die */ public static function throw_error($renderer, $error_text, $error_full_message, $error_database_id, $error_file_path) @@ -174,4 +174,4 @@ public static function throw_error($renderer, $error_text, $error_full_message, die($e->getMessage()); } } -} \ No newline at end of file +} diff --git a/app/Kernel/Encryption.php b/app/Kernel/Encryption.php index 05d28f9..5fe8f34 100755 --- a/app/Kernel/Encryption.php +++ b/app/Kernel/Encryption.php @@ -9,9 +9,9 @@ class Encryption { /** * Encrypt the data - * + * * @param string $data - * + * * @return string */ public static function encrypt(string $data): string @@ -21,9 +21,9 @@ public static function encrypt(string $data): string /** * Decrypt the data - * + * * @param string $data - * + * * @return string */ public static function decrypt(string $data): string diff --git a/app/Kernel/Logger.php b/app/Kernel/Logger.php index 3c685e8..a363fed 100755 --- a/app/Kernel/Logger.php +++ b/app/Kernel/Logger.php @@ -11,11 +11,11 @@ class Logger { /** * Log something inside the kernel framework_logs - * + * * @param LoggerTypes|string $level (INFO, WARNING, ERROR, CRITICAL, OTHER) * @param LoggerLevels|string $type (CORE, DATABASE, PLUGIN, LOG, OTHER, LANGUAGE) * @param string $message The message you want to log - * + * * @return int The log id! */ public static function log(LoggerTypes|string $level, LoggerLevels|string $type, string $message): int @@ -118,7 +118,7 @@ public static function getAllSortedById(): array * @param LoggerTypes|string $level (INFO, WARNING, ERROR, CRITICAL, OTHER) * @param LoggerLevels|string $type (CORE, DATABASE, PLUGIN, LOG, OTHER, LANGUAGE) * @param int $limit The amount of logs you want to get (15 by default) - * + * * @return array|null Returns the logs in an array */ public static function getAllSortedByDate(LoggerTypes|string $level, LoggerLevels|string $type, int $limit = 15): array|null diff --git a/app/Kernel/LoggerLevels.php b/app/Kernel/LoggerLevels.php index c613a0f..d561ff9 100755 --- a/app/Kernel/LoggerLevels.php +++ b/app/Kernel/LoggerLevels.php @@ -4,7 +4,7 @@ interface LoggerLevels { - // Log level + // Log level public const INFO = 'INFO'; public const WARNING = 'WARNING'; public const ERROR = 'ERROR'; diff --git a/app/Managers/ConfigManager.php b/app/Managers/ConfigManager.php index 17716d7..7114cb3 100755 --- a/app/Managers/ConfigManager.php +++ b/app/Managers/ConfigManager.php @@ -11,12 +11,12 @@ class ConfigManager /** * DEPRECATED: Use Settings class instead!! * DEPRECATED: This class is used for the settings.json file! - * + * * Get value form the config! - * + * * @param string $category The category of the value you want to take from the config * @param string $value The value you want to take from the config file! - * + * * @return string|null */ public static function get(string $category, string $key): string|null @@ -39,12 +39,12 @@ public static function get(string $category, string $key): string|null /** * DEPRECATED: Use Settings class instead!! * DEPRECATED: This class is used for the settings.json file! - * + * * Set a value in the config file! - * + * * @param string $category The category of the value you want to set in the config - * @param string $value The value you want to set in the config file! - * + * @param string $value The value you want to set in the config file! + * * @return bool If true then success if false then false! */ public static function set(string $category, string $key, string $value): bool @@ -67,13 +67,13 @@ public static function set(string $category, string $key, string $value): bool /** * DEPRECATED: Use Settings class instead!! * DEPRECATED: This class is used for the settings.json file! - * + * * Add a value to the config file! - * + * * @param string $category The category of the value you want to add in the config * @param string $key The key of the value you want to add in the config file! - * @param string $value The value you want to add in the config file! - * + * @param string $value The value you want to add in the config file! + * * @return bool */ public static function add(string $category, string $key, string $value): bool @@ -96,12 +96,12 @@ public static function add(string $category, string $key, string $value): bool /** * DEPRECATED: Use Settings class instead!! * DEPRECATED: This class is used for the settings.json file! - * + * * Remove a value from the config file! - * + * * @param string $category The category of the value you want to remove from the config * @param string $key The key of the value you want to remove from the config file! - * + * * @return bool */ public static function remove(string $category, string $key): bool diff --git a/app/Managers/LanguageManager.php b/app/Managers/LanguageManager.php index 6ad6ab2..22180f3 100755 --- a/app/Managers/LanguageManager.php +++ b/app/Managers/LanguageManager.php @@ -9,10 +9,9 @@ class LanguageManager { - /** * Get the language from the file - * + * * @return mixed */ public static function getLang(): mixed @@ -45,7 +44,7 @@ public static function getLang(): mixed /** * Get all available languages - * + * * @return array */ public static function getAllAvailableLanguages(): array @@ -57,10 +56,10 @@ public static function getAllAvailableLanguages(): array /** * Log translation key not found - * + * * @param string $key Translation key * @param string $message The alternative message - * + * * @return string The translation key not found message */ public static function logKeyTranslationNotFound($key, $message = "TRANSLATION_KEY_NOT_FOUND"): string diff --git a/app/Managers/Settings.php b/app/Managers/Settings.php index d36c9b3..c215b7b 100755 --- a/app/Managers/Settings.php +++ b/app/Managers/Settings.php @@ -3,6 +3,10 @@ namespace MythicalSystemsFramework\Managers; use MythicalSystemsFramework\Database\MySQLCache; +use MythicalSystemsFramework\Database\MySQL; +use MythicalSystemsFramework\Cli\Colors as color; +use MythicalSystemsFramework\Managers\exception\settings\NoMigrationsFound; +use Exception; class Settings { @@ -35,20 +39,66 @@ public static function getSetting(string $category, string $name): string|null } /** * Update a setting in the database - * + * * @param string $category The name of the category * @param string $name The name of the setting * @param string $value The value you want to replace with! * @param bool $updateCache Update the cache after updating the setting - * + * * @return void * @throws Exception */ - public static function updateSetting(string $category, string $name, string $value, bool $updateCache = true) : void + public static function updateSetting(string $category, string $name, string $value, bool $updateCache = true): void { SettingsManager::update($category, $name, $value); if ($updateCache) { MySQLCache::saveCache("framework_settings"); } } + + + public static function migrate(bool $isTerminal = false): void + { + try { + $mysql = new MySQL(); + $db = $mysql->connectPDO(); + $db->exec("CREATE TABLE IF NOT EXISTS `framework_settings_migrations` (`id` INT NOT NULL AUTO_INCREMENT , `script` TEXT NOT NULL , `executed_at` DATETIME NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB; ALTER TABLE `framework_settings_migrations` CHANGE `executed_at` `executed_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP;"); + $phpFiles = glob(__DIR__ . '/../../migrate/config/*.php'); + if (count($phpFiles) > 0) { + sort($phpFiles); + + $migratedCount = 0; // Initialize migrated count + + foreach ($phpFiles as $phpFile) { + $fileName = basename($phpFile); + + $stmt = $db->prepare("SELECT COUNT(*) FROM framework_settings_migrations WHERE script = ?"); + $stmt->execute([$fileName]); + $count = $stmt->fetchColumn(); + + if ($count == 0) { + include $phpFile; + + $stmt = $db->prepare("INSERT INTO framework_settings_migrations (script) VALUES (?)"); + $stmt->execute([$fileName]); + + $migratedCount++; // Increment migrated count + } + } + if ($isTerminal) { + echo color::translateColorsCode("&fMigration completed. Migrated &e" . $migratedCount . " &ffiles."); + } + } else { + if ($isTerminal) { + echo color::translateColorsCode("&fNo migrations found!"); + } + } + } catch (Exception $e) { + if ($isTerminal) { + echo color::translateColorsCode("&cFailed to migrate the database: &f" . $e->getMessage() . ""); + } else { + throw new NoMigrationsFound("No migrations found!". $e->getMessage()); + } + } + } } diff --git a/app/Managers/SettingsManager.php b/app/Managers/SettingsManager.php index 034cd84..51d19c4 100755 --- a/app/Managers/SettingsManager.php +++ b/app/Managers/SettingsManager.php @@ -3,6 +3,7 @@ namespace MythicalSystemsFramework\Managers; use MythicalSystemsFramework\Database\MySQL; + /** * DEPRECATED: Use Settings class instead!! */ @@ -10,9 +11,9 @@ class SettingsManager { /** * DEPRECATED: Use Settings class instead!! - * + * * Get a setting from the database! - * + * * @param string $category The category of the setting you want to get! * @param string $key The key of the setting you want to get! * @@ -38,7 +39,7 @@ public static function get(string $category, string $key): string|null /** * DEPRECATED: Use Settings class instead!! * Set a setting in the database! - * + * * @param string $category The category of the setting you want to set! * @param string $key The key of the setting you want to set! * @param string $value The value of the setting you want to set! @@ -59,7 +60,7 @@ public static function set(string $category, string $key, string $value): bool /** * DEPRECATED: Use Settings class instead!! * Delete a setting from the database! - * + * * @param string $category The category of the setting you want to delete! * @param string $key The key of the setting you want to delete! * @@ -82,9 +83,9 @@ public static function delete(string $category, string $key): bool /** * DEPRECATED: Use Settings class instead!! - * + * * Delete all settings from the database! - * + * * @return bool True if successfully deleted, false otherwise! */ public static function deleteAll(): bool @@ -97,9 +98,9 @@ public static function deleteAll(): bool /** * DEPRECATED: Use Settings class instead!! - * + * * Update a setting in the database! - * + * * @param string $category The category of the setting you want to update! * @param string $key The key of the setting you want to update! * @param string $value The value of the setting you want to update! @@ -125,7 +126,7 @@ public static function update(string $category, string $key, string $value): boo * DEPRECATED: Use Settings class instead!! * * Check if a setting exists in the database! - * + * * @param string $category The category of the setting you want to check! * @param string $key The key of the setting you want to check! * diff --git a/app/Managers/SnowFlakeManager.php b/app/Managers/SnowFlakeManager.php index 08ec884..c84cf88 100755 --- a/app/Managers/SnowFlakeManager.php +++ b/app/Managers/SnowFlakeManager.php @@ -8,8 +8,8 @@ class SnowFlakeManager { /** * Function to generate a unique user ID - * - * @return string The new user id + * + * @return string The new user id */ private static function generateUserID(): string { @@ -18,7 +18,7 @@ private static function generateUserID(): string /** * Function to get the cached user IDs from the database - * + * * @return array Array of cached user IDs */ private static function getCachedUserIDs(): array @@ -40,9 +40,9 @@ private static function getCachedUserIDs(): array /** * Function to save user IDs to the database - * + * * @param string $userId Save the user id inside the database - * + * * @return bool True if successfully saved, false otherwise */ private static function saveUserIDToDatabase(string $userId): bool @@ -58,7 +58,7 @@ private static function saveUserIDToDatabase(string $userId): bool /** * Function to check if a user ID is already used - * + * * @return bool If this is used or not */ private static function isUserIDUsed(string $userId, array $cachedUserIds): bool @@ -68,7 +68,7 @@ private static function isUserIDUsed(string $userId, array $cachedUserIds): bool /** * Function to get a unique user ID - * + * * @return string The user id */ public static function getUniqueUserID(): string @@ -89,9 +89,9 @@ public static function getUniqueUserID(): string /** * Function to delete a user ID from the database - * + * * @param string $userId The user ID to be deleted from the database - * + * * @return bool True if the user ID was successfully deleted, false otherwise */ public static function deleteUserFromDatabase(string $userId): bool @@ -107,9 +107,9 @@ public static function deleteUserFromDatabase(string $userId): bool /** * Function to check if a user ID exists in the database - * + * * @param string $userId The user ID to check - * + * * @return bool True if the user ID exists in the database, false otherwise */ public static function doesUserExistInDatabase(string $userId): bool diff --git a/app/Managers/exception/settings/NoMigrationsFound.php b/app/Managers/exception/settings/NoMigrationsFound.php new file mode 100755 index 0000000..bfa8645 --- /dev/null +++ b/app/Managers/exception/settings/NoMigrationsFound.php @@ -0,0 +1,14 @@ +connectMYSQLI(); - + // Update the role $stmtRole = $mysqli->prepare("UPDATE framework_roles SET name = ?, weight = ? WHERE id = ?"); $stmtRole->bind_param("sii", $name, $weight, $id); @@ -125,10 +125,10 @@ public static function update(int $id, string $name, int $weight = 1): string|nu /** * Get a role - * + * * @param int $id The role id * @param string $data The data you are looking for - * + * * MAKE SURE YOU CHECK THE DOCS FOR THIS FUNCTION * @return string|null */ @@ -159,7 +159,7 @@ public static function getSpecificRoleInfo(int $id, string $data): string|null /** * Get all roles with name, weight, and id - * + * * @return array|null An array of roles with name, weight, and id */ public static function getAllRoles(): array|null @@ -193,9 +193,9 @@ public static function getAllRoles(): array|null } /** * This function just looks if the role exists - * + * * @param int $id The name of the role - * + * * @return string|null */ public static function roleExists(int $id): string|null diff --git a/app/Roles/RolesHelper.php b/app/Roles/RolesHelper.php index 558d355..d10d4d4 100755 --- a/app/Roles/RolesHelper.php +++ b/app/Roles/RolesHelper.php @@ -10,14 +10,14 @@ class RolesHelper extends RolesDataHandler { /** * Get the role name from the role id - * + * * @param string $role_id - * + * * @return string|null */ public static function getRoleName(int $role_id): ?string { return self::getSpecificRoleInfo($role_id, "name"); } - + } diff --git a/app/Roles/RolesPermissionDataHandler.php b/app/Roles/RolesPermissionDataHandler.php index ccf9331..35be23a 100755 --- a/app/Roles/RolesPermissionDataHandler.php +++ b/app/Roles/RolesPermissionDataHandler.php @@ -7,15 +7,14 @@ use MythicalSystemsFramework\Kernel\LoggerLevels; use MythicalSystemsFramework\Kernel\LoggerTypes; - class RolesPermissionDataHandler { /** * Create a role permission - * + * * @param int $roleId The role id * @param string $permission The permission - * + * * @return string|null The role permission id in a string */ public static function create(int $roleId, string $permission): string|null @@ -40,9 +39,9 @@ public static function create(int $roleId, string $permission): string|null /** * Delete a role permission - * + * * @param int $id The role permission id - * + * * @return string|null */ public static function delete(int $id): string|null @@ -74,10 +73,10 @@ public static function delete(int $id): string|null /** * Update a role permission - * + * * @param int $id The role permission id * @param string $permission The permission - * + * * @return string|null */ public static function update(int $id, string $permission): string|null @@ -110,9 +109,9 @@ public static function update(int $id, string $permission): string|null /** * Get all permissions for a role - * + * * @param int $roleId The role id - * + * * @return array|null An array of permissions or null if role does not exist */ public static function getAllPermissionsForRole(int $roleId): ?array @@ -149,10 +148,10 @@ public static function getAllPermissionsForRole(int $roleId): ?array /** * Get a role permission - * + * * @param int $id The role permission id * @param string $data The data you are looking for - * + * * @return string|null */ public static function getSpecificRolePermissionInfo(int $id, string $data): string|null @@ -182,9 +181,9 @@ public static function getSpecificRolePermissionInfo(int $id, string $data): str /** * This function checks if the role permission exists - * + * * @param int $id The role permission id - * + * * @return string|null */ public static function rolePermissionExists(int $id): string|null @@ -215,11 +214,11 @@ public static function rolePermissionExists(int $id): string|null /** * Check if a role has a specific permission - * + * * @param int $roleId The role id * @param string $permission The permission - * - * @return string|null + * + * @return string|null */ public static function doesRoleHavePermission(int $roleId, string $permission): string|null { diff --git a/app/User/Exceptions/UserException.php b/app/User/Exceptions/UserException.php index 8b96f4a..013949e 100755 --- a/app/User/Exceptions/UserException.php +++ b/app/User/Exceptions/UserException.php @@ -11,11 +11,13 @@ public function __construct($message, $code = 0, Throwable $previous = null) { parent::__construct($message, $code, $previous); } - public function __toString(): string { + public function __toString(): string + { return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; } - - public function toString() : string { + + public function toString(): string + { return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; } } diff --git a/app/User/UserDataHandler.php b/app/User/UserDataHandler.php index 02c362b..4ce0595 100755 --- a/app/User/UserDataHandler.php +++ b/app/User/UserDataHandler.php @@ -2,11 +2,12 @@ /** * UNIT TEST REQUIRED!!! - * + * * This file is responsible for handling the user data! - * + * * @category User */ + namespace MythicalSystemsFramework\User; use DateTime; @@ -26,11 +27,11 @@ class UserDataHandler { /** * Login a user - * + * * @param string $email * @param string $password * @param string $ip - * + * * MAKE SURE YOU CHECK THE DOCS FOR THIS FUNCTION * @return string|null The user token */ @@ -85,20 +86,20 @@ public static function login(string $email, string $password, string $ip): strin } } } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL,LoggerTypes::DATABASE,"(App/User/UserDataHandler.php) Failed to login user: " . $e->getMessage()); + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserDataHandler.php) Failed to login user: " . $e->getMessage()); return "ERROR_DATABASE_SELECT_FAILED"; } } /** * Create a user - * + * * @param string $username * @param string $password * @param string $email * @param string $first_name * @param string $last_name * @param string $ip - * + * * MAKE SURE YOU CHECK THE DOCS FOR THIS FUNCTION * @return string|null The user token */ @@ -155,18 +156,18 @@ public static function create(string $username, string $password, string $email, } } } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL,LoggerTypes::DATABASE,"(App/User/UserDataHandler.php) Failed to create user: " . $e->getMessage()); + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserDataHandler.php) Failed to create user: " . $e->getMessage()); return "ERROR_DATABASE_INSERT_FAILED"; } } /** * Get the user data - * + * * @param string $account_token The token of the account you want the data for! * @param string $data The data you want to get from the user! * @param bool $encrypted Set to false in case the data is not encrypted! - * + * * @return string The user data or null if not found! */ public static function getSpecificUserData(string $account_token, string $data, bool $encrypted = true): string|null @@ -196,22 +197,22 @@ public static function getSpecificUserData(string $account_token, string $data, return "ERROR_FIELD_NOT_FOUND"; } } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL,LoggerTypes::DATABASE,"(App/User/UserDataHandler.php) Failed to get user data: " . $e->getMessage()); + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserDataHandler.php) Failed to get user data: " . $e->getMessage()); return "ERROR_DATABASE_SELECT_FAILED"; } } /** * Update the user data - * + * * @param string $account_token The token of the account you want to update the data for! * @param string $data The data you want to update! * @param string $value The value you want to set! * @param bool $encrypted Set to false in case the data is not encrypted! - * + * * @return bool True if the data was updated false if not! */ - public static function updateSpecificUserData(string $account_token, string $data, string $value, bool $encrypted = true): string + public static function updateSpecificUserData(string $account_token, string $data, string $value, bool $encrypted = true): string { try { $isAccountValid = UserHelper::isSessionValid($account_token); @@ -231,7 +232,7 @@ public static function updateSpecificUserData(string $account_token, string $dat $stmt->close(); return "SUCCESS"; } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL,LoggerTypes::DATABASE,"(App/User/UserDataHandler.php) Failed to update user: " . $e->getMessage()); + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserDataHandler.php) Failed to update user: " . $e->getMessage()); return "ERROR_DATABASE_UPDATE_FAILED"; } } diff --git a/app/User/UserHelper.php b/app/User/UserHelper.php index 9ab8eac..88290c2 100755 --- a/app/User/UserHelper.php +++ b/app/User/UserHelper.php @@ -16,12 +16,11 @@ class UserHelper extends UserDataHandler { - /** - * This function will ban a user from the system. - * + * This function will ban a user from the system. + * * @param string $account_token The account token of the user you want to ban. - * + * * @return string The response of the ban. */ public static function banUser(string $account_token): string @@ -44,10 +43,10 @@ public static function banUser(string $account_token): string } /** - * This function will unban a user from the system. - * + * This function will unban a user from the system. + * * @param string $account_token The account token of the user you want to unban. - * + * * @return string The response of the unban. */ public static function unbanUser(string $account_token): string @@ -71,9 +70,9 @@ public static function unbanUser(string $account_token): string /** * This function will check if the user is banned. - * + * * @param string $account_token The account token of the user you want to check. - * + * * @return string If the user is banned or not. */ public static function isUserBanned(string $account_token): string @@ -95,11 +94,11 @@ public static function isUserBanned(string $account_token): string } } - /** + /** * Check if the user session is valid - * + * * @param string $account_token The token of the account you want the check the session for! - * + * * @return bool True if yes false if no! */ public static function isSessionValid(string $account_token): bool @@ -123,14 +122,14 @@ public static function isSessionValid(string $account_token): bool return true; } } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL,LoggerTypes::DATABASE,"(App/User/UserDataHandler.php) Failed to validate user: " . $e->getMessage()); + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserDataHandler.php) Failed to validate user: " . $e->getMessage()); return false; } } /** * Log the user out of his account - * + * * @return void This functions removes the token header! */ public static function killSession(): void @@ -141,14 +140,15 @@ public static function killSession(): void Cookies::unSetCookie("token"); } - /** + /** * This function will soft delete a user * * @param string $account_token The account token of the user you want to delete. - * + * * @return string The response of the delete. - */ - public static function deleteUser(string $account_token): string { + */ + public static function deleteUser(string $account_token): string + { try { if (self::isSessionValid($account_token)) { $update_user = self::updateSpecificUserData($account_token, "deleted", "true", false); @@ -168,12 +168,13 @@ public static function deleteUser(string $account_token): string { /** * This function will restore a soft deleted user - * + * * @param string $account_token The account token of the user you want to restore. - * + * * @return string The response of the restore. */ - public static function restoreUser(string $account_token): string { + public static function restoreUser(string $account_token): string + { try { if (self::isSessionValid($account_token)) { $update_user = self::updateSpecificUserData($account_token, "deleted", "false", false); @@ -193,12 +194,13 @@ public static function restoreUser(string $account_token): string { /** * This function will check if the user is soft deleted - * + * * @param string $account_token The account token of the user you want to check. - * + * * @return string The response of the check. */ - public static function isUserDeleted(string $account_token): string { + public static function isUserDeleted(string $account_token): string + { try { if (self::isSessionValid($account_token)) { $delete_state = self::getSpecificUserData($account_token, "deleted", false); @@ -218,12 +220,13 @@ public static function isUserDeleted(string $account_token): string { /** * This function will check if the user is verified - * + * * @param string $account_token The account token of the user you want to check. - * + * * @return string The response of the check. */ - public static function isUserVerified(string $account_token): string { + public static function isUserVerified(string $account_token): string + { try { if (self::isSessionValid($account_token)) { $verified_state = self::getSpecificUserData($account_token, "verified", false); @@ -243,12 +246,13 @@ public static function isUserVerified(string $account_token): string { /** * This function will verify a user - * + * * @param string $account_token The account token of the user you want to verify. - * + * * @return string The response of the verification. */ - public static function verifyUser(string $account_token): string { + public static function verifyUser(string $account_token): string + { try { if (self::isSessionValid($account_token)) { $update_user = self::updateSpecificUserData($account_token, "verified", "true", false); @@ -268,12 +272,13 @@ public static function verifyUser(string $account_token): string { /** * This function will unverify a user - * + * * @param string $account_token The account token of the user you want to unverify. - * + * * @return string The response of the unverification. */ - public static function unverifyUser(string $account_token): string { + public static function unverifyUser(string $account_token): string + { try { if (self::isSessionValid($account_token)) { $update_user = self::updateSpecificUserData($account_token, "verified", "false", false); @@ -293,13 +298,14 @@ public static function unverifyUser(string $account_token): string { /** * This function will update the last seen and the last ip of the user - * + * * @param string $account_token The account token of the user you want to update. * @param string $ip The ip of the user. - * + * * @return string */ - public static function updateLastSeen(string $account_token, string $ip): string { + public static function updateLastSeen(string $account_token, string $ip): string + { try { if (self::isSessionValid($account_token)) { $update_user = self::updateSpecificUserData($account_token, "last_seen", date("Y-m-d H:i:s"), false); @@ -324,12 +330,13 @@ public static function updateLastSeen(string $account_token, string $ip): string /** * This function will return your the role id of a user - * + * * @param string $account_token The account token of the user you want to get the role id from. - * + * * @return string|null The role id of the user or an error. */ - public static function getUserRoleId($account_token) : string|null { + public static function getUserRoleId($account_token): string|null + { try { if (self::isSessionValid($account_token)) { $role_id = self::getSpecificUserData($account_token, "role", false); @@ -343,12 +350,12 @@ public static function getUserRoleId($account_token) : string|null { } } - /** + /** * Does this user have permission? - * + * * @param string $account_token The account token. * @param string $permission The permission name. - * + * * @return string|null */ public static function doesUserHavePermission(string $account_token, string $permission): string|null @@ -371,4 +378,4 @@ public static function doesUserHavePermission(string $account_token, string $per return "ERROR_DATABASE_SELECT_FAILED"; } } -} \ No newline at end of file +} diff --git a/commands/core/cache/cacheprocess.php b/commands/core/cache/cacheprocess.php index e47efca..fb42b00 100755 --- a/commands/core/cache/cacheprocess.php +++ b/commands/core/cache/cacheprocess.php @@ -1,4 +1,5 @@ -getMessage()); - } + } } -} \ No newline at end of file +} diff --git a/commands/core/cache/cachepurge.php b/commands/core/cache/cachepurge.php index fdb0c97..d188083 100755 --- a/commands/core/cache/cachepurge.php +++ b/commands/core/cache/cachepurge.php @@ -1,4 +1,5 @@ -getMessage()); - } + } } -} \ No newline at end of file +} diff --git a/commands/core/config/configmigrate.php b/commands/core/config/configmigrate.php deleted file mode 100755 index de1ae97..0000000 --- a/commands/core/config/configmigrate.php +++ /dev/null @@ -1,45 +0,0 @@ -connectPDO(); - $db->exec("CREATE TABLE IF NOT EXISTS `framework_settings_migrations` (`id` INT NOT NULL AUTO_INCREMENT , `script` TEXT NOT NULL , `executed_at` DATETIME NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB; ALTER TABLE `framework_settings_migrations` CHANGE `executed_at` `executed_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP;"); - $phpFiles = glob(__DIR__ . '/../../../migrate/config/*.php'); - if (count($phpFiles) > 0) { - sort($phpFiles); - - $migratedCount = 0; // Initialize migrated count - - foreach ($phpFiles as $phpFile) { - $fileName = basename($phpFile); - - $stmt = $db->prepare("SELECT COUNT(*) FROM framework_settings_migrations WHERE script = ?"); - $stmt->execute([$fileName]); - $count = $stmt->fetchColumn(); - - if ($count == 0) { - include $phpFile; - - $stmt = $db->prepare("INSERT INTO framework_settings_migrations (script) VALUES (?)"); - $stmt->execute([$fileName]); - - $migratedCount++; // Increment migrated count - } - } - - echo color::translateColorsCode("&fMigration completed. Migrated &e$migratedCount &ffiles."); - } else { - echo color::translateColorsCode("&fMigration completed. Migrated &e0 &ffiles."); - } - } catch (PDOException $e) { - echo color::translateColorsCode("Failed to migrate the database: " . $e->getMessage() . ""); - } - } -} diff --git a/commands/core/database/dbconfigure.php b/commands/core/database/dbconfigure.php deleted file mode 100755 index 4265f71..0000000 --- a/commands/core/database/dbconfigure.php +++ /dev/null @@ -1,79 +0,0 @@ -tryConnection(cfg::get("database", "host"), cfg::get("database", "port"), cfg::get("database", "username"), cfg::get("database", "password"), cfg::get("database", "name")) == true) { - echo color::translateColorsCode("&fConnection to the database was &asuccessful!&o"); - echo color::NewLine(); - echo color::translateColorsCode("&fDo you want to reconfigure the database? (&ey&f/&en&f): "); - $confirm = readline(); - if (strtolower($confirm) === 'y') { - $this->configure(); - } else { - die(color::translateColorsCode("&fExiting...&o")); - } - return; - } else { - $this->configure(); - } - } - /** - * Configures the database connection. - * - * @return void - */ - public function configure(): void - { - $defaultHost = "127.0.0.1"; - $defaultPort = "3306"; - $db = new MySQL(); - echo color::translateColorsCode("&fEnter the host of the database &8[&e$defaultHost&8]&f: "); - $host = readline() ?: $defaultHost; - echo color::translateColorsCode("&fEnter the port of the database &8[&e$defaultPort&8]&f: "); - $port = readline() ?: $defaultPort; - echo color::translateColorsCode("&fEnter the username: "); - $username = readline(); - echo color::translateColorsCode("&fEnter the password: "); - $password = readline(); - echo color::translateColorsCode("&fEnter the database name: "); - $database = readline(); - // Perform validation - if (empty($username) || empty($password) || empty($database)) { - echo color::translateColorsCode("&cPlease provide all the required information.&o"); - return; - } - - // Hide the password - $hiddenPassword = str_repeat('*', strlen($password)); - - // Use the provided information - echo color::NewLine(); - echo color::translateColorsCode("&fHost: &e$host&o"); - echo color::translateColorsCode("&fPort: &e$port&o"); - echo color::translateColorsCode("&fUsername: &e$username&o"); - echo color::translateColorsCode("&fPassword: &e$hiddenPassword&o"); - echo color::translateColorsCode("&fDatabase: &e$database&o"); - - if ($db->tryConnection($host, $port, $username, $password, $database) == true) { - echo color::NewLine(); - echo color::translateColorsCode("&fConnection to the database was &asuccessful!&o"); - echo color::NewLine(); - echo color::translateColorsCode("&fSaving the configuration...&o"); - cfg::set("database", "host", $host); - cfg::set("database", "port", $port); - cfg::set("database", "username", $username); - cfg::set("database", "password", $password); - cfg::set("database", "name", $database); - echo color::translateColorsCode("&fConfiguration saved &asuccessfully!&o"); - } else { - echo color::translateColorsCode("&7Failed to connect to the database. &o&fPlease check the provided information."); - } - } - -} \ No newline at end of file diff --git a/commands/core/database/dbmigrate.php b/commands/core/database/dbmigrate.php deleted file mode 100755 index b888518..0000000 --- a/commands/core/database/dbmigrate.php +++ /dev/null @@ -1,81 +0,0 @@ -tryConnection(cfg::get("database", "host"), cfg::get("database", "port"), cfg::get("database", "username"), cfg::get("database", "password"), cfg::get("database", "name")) == true) { - echo color::translateColorsCode("&fConnection to the database was &asuccessful!&o"); - echo color::NewLine(); - echo color::translateColorsCode("&fDo you want to migrate the database? (&ey&f/&en&f): "); - $confirm = readline(); - if (strtolower($confirm) == 'y') { - $this->migrate(); - } else { - die(color::translateColorsCode("&fExiting...&o")); - } - return; - } else { - die(color::translateColorsCode("&cFailed to connect to the database!&o")); - } - } - - public function migrate() - { - try { - $mysql = new MySQL(); - $db = $mysql->connectPDO(); - - $db->exec(" - CREATE TABLE IF NOT EXISTS framework_migrations ( - id INT AUTO_INCREMENT PRIMARY KEY, - script VARCHAR(255) NOT NULL, - executed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP - ) - "); - - $sqlFiles = glob(__DIR__ . '/../../../migrate/database/*.sql'); - - if (count($sqlFiles) > 0) { - usort($sqlFiles, function($a, $b) { - $aDate = intval(basename($a, '.sql')); - $bDate = intval(basename($b, '.sql')); - return $aDate - $bDate; - }); - - foreach ($sqlFiles as $sqlFile) { - $script = file_get_contents($sqlFile); - - $fileName = basename($sqlFile); // Get only the file name - - $stmt = $db->prepare("SELECT COUNT(*) FROM framework_migrations WHERE script = ?"); - $stmt->execute([$fileName]); - $count = $stmt->fetchColumn(); - - if ($count == 0) { - $db->exec($script); - - $stmt = $db->prepare("INSERT INTO framework_migrations (script) VALUES (?)"); - $stmt->execute([$fileName]); - - echo color::translateColorsCode("&fExecuted migration: &e" . $fileName . "&o"); - echo color::NewLine(); - } else { - echo color::translateColorsCode("&fSkipping migration: &e" . $fileName . " &f(&ealready executed&f)&o"); - echo color::NewLine(); - } - } - } else { - echo color::translateColorsCode("&cNo migrations found!&o"); - echo color::NewLine(); - } - } catch (PDOException $e) { - echo color::translateColorsCode("&cFailed to migrate the database: " . $e->getMessage() . "&o"); - echo color::NewLine(); - } - } -} \ No newline at end of file diff --git a/commands/core/database/dbrebuild.php b/commands/core/database/dbrebuild.php deleted file mode 100755 index 4b770cf..0000000 --- a/commands/core/database/dbrebuild.php +++ /dev/null @@ -1,56 +0,0 @@ -tryConnection(cfg::get("database", "host"), cfg::get("database", "port"), cfg::get("database", "username"), cfg::get("database", "password"), cfg::get("database", "name")) == true) { - echo color::translateColorsCode("&fConnection to the database was &asuccessful!&o"); - echo color::NewLine(); - echo color::translateColorsCode("&4&lWARNING: &fThis option will wipe the database. &o"); - echo color::translateColorsCode("&4&lWARNING: &fOnly use this function if you know what you are doing &o"); - echo color::translateColorsCode("&4&lWARNING: &fOnce you wipe the database there is no going back! &o"); - echo color::translateColorsCode("&4&lWARNING: &fPlease be careful and don't play around with commands! &o"); - echo color::translateColorsCode("&4&lWARNING: &fThere is no other message then this so keep in mind! &o"); - echo color::translateColorsCode("&4&lWARNING: &fDo you really want to wipe the database? (&ey&f/&en&f): "); - - $confirm = readline(); - if (strtolower($confirm) == 'y') { - $this->wipe(); - } else { - die(color::translateColorsCode("&fExiting...&o")); - } - return; - } else { - die(color::translateColorsCode("&cFailed to connect to the database!&o")); - } - } - - public function wipe() { - try { - $mysql = new MySQL(); - $db = $mysql->connectPDO(); - - $db->exec("SET FOREIGN_KEY_CHECKS = 0"); - $tables = $db->query("SHOW TABLES")->fetchAll(PDO::FETCH_COLUMN); - foreach ($tables as $table) { - $db->exec("DROP TABLE IF EXISTS $table"); - } - $db->exec("SET FOREIGN_KEY_CHECKS = 1"); - echo color::NewLine(); - echo color::NewLine(); - echo color::NewLine(); - echo color::NewLine(); - echo color::NewLine(); - echo color::translateColorsCode("&fDatabase wiped!!&o"); - echo color::translateColorsCode("&fPlease run the migration command to rebuild the database!&o"); - } catch (PDOException $e) { - echo color::translateColorsCode("&fFailed to drop tables: &c" . $e->getMessage() . "&o"); - echo color::NewLine(); - } - } -} \ No newline at end of file diff --git a/commands/core/encryption/newkey.php b/commands/core/encryption/newkey.php index 37cd833..461be47 100755 --- a/commands/core/encryption/newkey.php +++ b/commands/core/encryption/newkey.php @@ -1,4 +1,5 @@ -generate(); } else { echo color::translateColorsCode("&4&lWARNING: &fA key already exists. Do you want to generate a new one?&o"); @@ -21,12 +22,12 @@ public function execute() } } /** - * + * */ public function generate() { - $key = "mythicalcore_".bin2hex(random_bytes(64*32)); - cfg::set("encryption","key",$key); + $key = "mythicalcore_".bin2hex(random_bytes(64 * 32)); + cfg::set("encryption", "key", $key); echo color::translateColorsCode("&fKey generated successfully!&o"); } -} \ No newline at end of file +} diff --git a/commands/core/status/down.php b/commands/core/status/down.php deleted file mode 100755 index 9cde1d2..0000000 --- a/commands/core/status/down.php +++ /dev/null @@ -1,16 +0,0 @@ -tryConnection(cfg::get("database", "host"), cfg::get("database", "port"), cfg::get("database", "username"), cfg::get("database", "password"), cfg::get("database", "name")) == true) { - echo color::translateColorsCode("&fConnection to the database was &asuccessful!&o"); - echo color::NewLine(); - if (cfg::get("encryption","key") == "") { - die(color::translateColorsCode("&cEncryption key is not set!&o&fHave you set it up already?&o")); - } - } else { - die(color::translateColorsCode("&cFailed to connect to the database!&o&fHave you set it up already?&o")); - } - } -} \ No newline at end of file diff --git a/composer.json b/composer.json index a3e0b2d..3de5a65 100755 --- a/composer.json +++ b/composer.json @@ -52,7 +52,8 @@ } }, "require-dev": { - "phpunit/phpunit": "^11.1" + "phpunit/phpunit": "^11.1", + "friendsofphp/php-cs-fixer": "^3.59" }, "scripts": { "tests": [ @@ -62,26 +63,16 @@ "push": [ "export COMPOSER_ALLOW_SUPERUSER=1", "bash devtools/push.bash", - "git push origin develop" + "git push origin develop", + "composer run tests", + "composer run lint" ], "pull": [ "export COMPOSER_ALLOW_SUPERUSER=1", "git pull origin develop", "bash devtools/restore.bash" ], - "frontend:build": [ - "export COMPOSER_ALLOW_SUPERUSER=1", - "npx tailwindcss -i styles.css -o ./public/style.css --minify --jit" - ], - "frontend:watch": [ - "export COMPOSER_ALLOW_SUPERUSER=1", - "npx tailwindcss -i styles.css -o ./public/style.css --watch" - ], - "frontend:clear": [ - "export COMPOSER_ALLOW_SUPERUSER=1", - "rm -rf ./public/style.css" - ], - "frontend:install:dependency": [ + "install:dependency": [ "export COMPOSER_ALLOW_SUPERUSER=1", "composer install && npm i" ], @@ -93,9 +84,9 @@ "export COMPOSER_ALLOW_SUPERUSER=1", "php framework" ], - "convert:code":[ + "lint": [ "export COMPOSER_ALLOW_SUPERUSER=1", - "php framework convert:code" + "vendor/bin/php-cs-fixer fix ." ] } } diff --git a/composer.lock b/composer.lock index 1fdd8ff..91c4005 100755 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "9b9a095f793f7c67933c87249e1b17b1", + "content-hash": "d0d736cc77e2510ef863bc93d4d6a57b", "packages": [ { "name": "gravatarphp/gravatar", @@ -530,408 +530,2381 @@ ], "packages-dev": [ { - "name": "myclabs/deep-copy", - "version": "1.12.0", + "name": "clue/ndjson-react", + "version": "v1.3.0", "source": { "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" + "url": "https://github.com/clue/reactphp-ndjson.git", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", - "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "url": "https://api.github.com/repos/clue/reactphp-ndjson/zipball/392dc165fce93b5bb5c637b67e59619223c931b0", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" - }, - "conflict": { - "doctrine/collections": "<1.6.8", - "doctrine/common": "<2.13.3 || >=3 <3.2.2" + "php": ">=5.3", + "react/stream": "^1.2" }, "require-dev": { - "doctrine/collections": "^1.6.8", - "doctrine/common": "^2.13.3 || ^3.2.2", - "phpspec/prophecy": "^1.10", - "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35", + "react/event-loop": "^1.2" }, "type": "library", "autoload": { - "files": [ - "src/DeepCopy/deep_copy.php" - ], "psr-4": { - "DeepCopy\\": "src/DeepCopy/" + "Clue\\React\\NDJson\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "Create deep copies (clones) of your objects", + "authors": [ + { + "name": "Christian LĆ¼ck", + "email": "christian@clue.engineering" + } + ], + "description": "Streaming newline-delimited JSON (NDJSON) parser and encoder for ReactPHP.", + "homepage": "https://github.com/clue/reactphp-ndjson", "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" + "NDJSON", + "json", + "jsonlines", + "newline", + "reactphp", + "streaming" ], "support": { - "issues": "https://github.com/myclabs/DeepCopy/issues", - "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" + "issues": "https://github.com/clue/reactphp-ndjson/issues", + "source": "https://github.com/clue/reactphp-ndjson/tree/v1.3.0" }, "funding": [ { - "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", - "type": "tidelift" + "url": "https://clue.engineering/support", + "type": "custom" + }, + { + "url": "https://github.com/clue", + "type": "github" } ], - "time": "2024-06-12T14:39:25+00:00" + "time": "2022-12-23T10:58:28+00:00" }, { - "name": "nikic/php-parser", - "version": "v5.1.0", + "name": "composer/pcre", + "version": "3.1.4", "source": { "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" + "url": "https://github.com/composer/pcre.git", + "reference": "04229f163664973f68f38f6f73d917799168ef24" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", - "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "url": "https://api.github.com/repos/composer/pcre/zipball/04229f163664973f68f38f6f73d917799168ef24", + "reference": "04229f163664973f68f38f6f73d917799168ef24", "shasum": "" }, "require": { - "ext-ctype": "*", - "ext-json": "*", - "ext-tokenizer": "*", - "php": ">=7.4" + "php": "^7.4 || ^8.0" }, "require-dev": { - "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^9.0" + "phpstan/phpstan": "^1.3", + "phpstan/phpstan-strict-rules": "^1.1", + "symfony/phpunit-bridge": "^5" }, - "bin": [ - "bin/php-parse" - ], "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-main": "3.x-dev" } }, "autoload": { "psr-4": { - "PhpParser\\": "lib/PhpParser" + "Composer\\Pcre\\": "src" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Nikita Popov" + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" } ], - "description": "A PHP parser written in PHP", + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", "keywords": [ - "parser", - "php" + "PCRE", + "preg", + "regex", + "regular expression" ], "support": { - "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.1.4" }, - "time": "2024-07-01T20:03:41+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-05-27T13:40:54+00:00" }, { - "name": "phar-io/manifest", - "version": "2.0.4", + "name": "composer/semver", + "version": "3.4.2", "source": { "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "54750ef60c58e43759730615a392c31c80e23176" + "url": "https://github.com/composer/semver.git", + "reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", - "reference": "54750ef60c58e43759730615a392c31c80e23176", + "url": "https://api.github.com/repos/composer/semver/zipball/c51258e759afdb17f1fd1fe83bc12baaef6309d6", + "reference": "c51258e759afdb17f1fd1fe83bc12baaef6309d6", "shasum": "" }, "require": { - "ext-dom": "*", - "ext-libxml": "*", - "ext-phar": "*", - "ext-xmlwriter": "*", - "phar-io/version": "^3.0.1", - "php": "^7.2 || ^8.0" + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.4", + "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-main": "3.x-dev" } }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Composer\\Semver\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" }, { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" }, { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" } ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], "support": { - "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.4" + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.4.2" }, "funding": [ { - "url": "https://github.com/theseer", + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" } ], - "time": "2024-03-03T12:33:53+00:00" + "time": "2024-07-12T11:35:52+00:00" }, { - "name": "phar-io/version", - "version": "3.2.1", + "name": "composer/xdebug-handler", + "version": "3.0.5", "source": { "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", - "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6c1925561632e83d60a44492e0b344cf48ab85ef", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1 || ^2 || ^3" + }, + "require-dev": { + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "phpunit/phpunit": "^8.5 || ^9.6 || ^10.5" }, "type": "library", "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/3.0.5" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" }, { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" + "url": "https://github.com/composer", + "type": "github" }, { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" } ], - "description": "Library for handling version information and constraints", - "support": { - "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/3.2.1" - }, - "time": "2022-02-21T01:04:05+00:00" + "time": "2024-05-06T16:37:16+00:00" }, { - "name": "phpunit/php-code-coverage", - "version": "11.0.5", + "name": "evenement/evenement", + "version": "v3.0.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "19b6365ab8b59a64438c0c3f4241feeb480c9861" + "url": "https://github.com/igorw/evenement.git", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/19b6365ab8b59a64438c0c3f4241feeb480c9861", - "reference": "19b6365ab8b59a64438c0c3f4241feeb480c9861", + "url": "https://api.github.com/repos/igorw/evenement/zipball/0a16b0d71ab13284339abb99d9d2bd813640efbc", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc", "shasum": "" }, "require": { - "ext-dom": "*", - "ext-libxml": "*", - "ext-xmlwriter": "*", - "nikic/php-parser": "^5.0", - "php": ">=8.2", - "phpunit/php-file-iterator": "^5.0", - "phpunit/php-text-template": "^4.0", - "sebastian/code-unit-reverse-lookup": "^4.0", - "sebastian/complexity": "^4.0", - "sebastian/environment": "^7.0", - "sebastian/lines-of-code": "^3.0", - "sebastian/version": "^5.0", - "theseer/tokenizer": "^1.2.0" + "php": ">=7.0" }, "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "suggest": { - "ext-pcov": "PHP extension that provides line coverage", - "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + "phpunit/phpunit": "^9 || ^6" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "11.0-dev" - } - }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Evenement\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" } ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "description": "ƉvĆ©nement is a very simple event dispatching library for PHP", "keywords": [ - "coverage", - "testing", - "xunit" + "event-dispatcher", + "event-emitter" ], "support": { - "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.5" + "issues": "https://github.com/igorw/evenement/issues", + "source": "https://github.com/igorw/evenement/tree/v3.0.2" }, - "funding": [ - { - "url": "https://github.com/sebastianbergmann", - "type": "github" - } - ], - "time": "2024-07-03T05:05:37+00:00" + "time": "2023-08-08T05:53:35+00:00" }, { - "name": "phpunit/php-file-iterator", - "version": "5.0.1", + "name": "fidry/cpu-core-counter", + "version": "1.1.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "6ed896bf50bbbfe4d504a33ed5886278c78e4a26" + "url": "https://github.com/theofidry/cpu-core-counter.git", + "reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6ed896bf50bbbfe4d504a33ed5886278c78e4a26", - "reference": "6ed896bf50bbbfe4d504a33ed5886278c78e4a26", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/f92996c4d5c1a696a6a970e20f7c4216200fcc42", + "reference": "f92996c4d5c1a696a6a970e20f7c4216200fcc42", "shasum": "" }, "require": { - "php": ">=8.2" + "php": "^7.2 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "fidry/makefile": "^0.2.0", + "fidry/php-cs-fixer-config": "^1.1.2", + "phpstan/extension-installer": "^1.2.0", + "phpstan/phpstan": "^1.9.2", + "phpstan/phpstan-deprecation-rules": "^1.0.0", + "phpstan/phpstan-phpunit": "^1.2.2", + "phpstan/phpstan-strict-rules": "^1.4.4", + "phpunit/phpunit": "^8.5.31 || ^9.5.26", + "webmozarts/strict-phpunit": "^7.5" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "5.0-dev" - } - }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Fidry\\CpuCoreCounter\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "ThĆ©o FIDRY", + "email": "theo.fidry@gmail.com" } ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "description": "Tiny utility to get the number of CPU cores.", "keywords": [ - "filesystem", - "iterator" + "CPU", + "core" ], "support": { - "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.0.1" + "issues": "https://github.com/theofidry/cpu-core-counter/issues", + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.1.0" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://github.com/theofidry", "type": "github" } ], - "time": "2024-07-03T05:06:37+00:00" + "time": "2024-02-07T09:43:46+00:00" }, { - "name": "phpunit/php-invoker", - "version": "5.0.1", + "name": "friendsofphp/php-cs-fixer", + "version": "v3.59.3", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-invoker.git", - "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2" + "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", + "reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/c1ca3814734c07492b3d4c5f794f4b0995333da2", - "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/30ba9ecc2b0e5205e578fe29973c15653d9bfd29", + "reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29", "shasum": "" }, "require": { - "php": ">=8.2" + "clue/ndjson-react": "^1.0", + "composer/semver": "^3.4", + "composer/xdebug-handler": "^3.0.3", + "ext-filter": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "fidry/cpu-core-counter": "^1.0", + "php": "^7.4 || ^8.0", + "react/child-process": "^0.6.5", + "react/event-loop": "^1.0", + "react/promise": "^2.0 || ^3.0", + "react/socket": "^1.0", + "react/stream": "^1.0", + "sebastian/diff": "^4.0 || ^5.0 || ^6.0", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0", + "symfony/filesystem": "^5.4 || ^6.0 || ^7.0", + "symfony/finder": "^5.4 || ^6.0 || ^7.0", + "symfony/options-resolver": "^5.4 || ^6.0 || ^7.0", + "symfony/polyfill-mbstring": "^1.28", + "symfony/polyfill-php80": "^1.28", + "symfony/polyfill-php81": "^1.28", + "symfony/process": "^5.4 || ^6.0 || ^7.0", + "symfony/stopwatch": "^5.4 || ^6.0 || ^7.0" + }, + "require-dev": { + "facile-it/paraunit": "^1.3 || ^2.3", + "infection/infection": "^0.29.5", + "justinrainbow/json-schema": "^5.2", + "keradus/cli-executor": "^2.1", + "mikey179/vfsstream": "^1.6.11", + "php-coveralls/php-coveralls": "^2.7", + "php-cs-fixer/accessible-object": "^1.1", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.5", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.5", + "phpunit/phpunit": "^9.6.19 || ^10.5.21 || ^11.2", + "symfony/var-dumper": "^5.4 || ^6.0 || ^7.0", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "autoload": { + "psr-4": { + "PhpCsFixer\\": "src/" + }, + "exclude-from-classmap": [ + "src/Fixer/Internal/*" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "keywords": [ + "Static code analysis", + "fixer", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.59.3" + }, + "funding": [ + { + "url": "https://github.com/keradus", + "type": "github" + } + ], + "time": "2024-06-16T14:17:03+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.12.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "reference": "3a6b9a42cd8f8771bd4295d13e1423fa7f3d942c", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3 <3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.12.0" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2024-06-12T14:39:25+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v5.1.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "reference": "683130c2ff8c2739f4822ff7ac5c873ec529abd1", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "php": ">=7.4" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v5.1.0" + }, + "time": "2024-07-01T20:03:41+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "54750ef60c58e43759730615a392c31c80e23176" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "11.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "19b6365ab8b59a64438c0c3f4241feeb480c9861" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/19b6365ab8b59a64438c0c3f4241feeb480c9861", + "reference": "19b6365ab8b59a64438c0c3f4241feeb480c9861", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^5.0", + "php": ">=8.2", + "phpunit/php-file-iterator": "^5.0", + "phpunit/php-text-template": "^4.0", + "sebastian/code-unit-reverse-lookup": "^4.0", + "sebastian/complexity": "^4.0", + "sebastian/environment": "^7.0", + "sebastian/lines-of-code": "^3.0", + "sebastian/version": "^5.0", + "theseer/tokenizer": "^1.2.0" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "suggest": { + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "11.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.5" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T05:05:37+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "5.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "6ed896bf50bbbfe4d504a33ed5886278c78e4a26" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/6ed896bf50bbbfe4d504a33ed5886278c78e4a26", + "reference": "6ed896bf50bbbfe4d504a33ed5886278c78e4a26", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T05:06:37+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "5.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/c1ca3814734c07492b3d4c5f794f4b0995333da2", + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^11.0" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/5.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T05:07:44+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "4.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/3e0404dc6b300e6bf56415467ebcb3fe4f33e964", + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/4.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T05:08:43+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "7.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "7.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "security": "https://github.com/sebastianbergmann/php-timer/security/policy", + "source": "https://github.com/sebastianbergmann/php-timer/tree/7.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T05:09:35+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "11.2.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "a7a29e8d3113806f18f99d670f580a30e8ffff39" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a7a29e8d3113806f18f99d670f580a30e8ffff39", + "reference": "a7a29e8d3113806f18f99d670f580a30e8ffff39", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.12.0", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", + "php": ">=8.2", + "phpunit/php-code-coverage": "^11.0.5", + "phpunit/php-file-iterator": "^5.0.1", + "phpunit/php-invoker": "^5.0.1", + "phpunit/php-text-template": "^4.0.1", + "phpunit/php-timer": "^7.0.1", + "sebastian/cli-parser": "^3.0.2", + "sebastian/code-unit": "^3.0.1", + "sebastian/comparator": "^6.0.1", + "sebastian/diff": "^6.0.2", + "sebastian/environment": "^7.2.0", + "sebastian/exporter": "^6.1.3", + "sebastian/global-state": "^7.0.2", + "sebastian/object-enumerator": "^6.0.1", + "sebastian/type": "^5.0.1", + "sebastian/version": "^5.0.1" + }, + "suggest": { + "ext-soap": "To be able to generate mocks based on WSDL files" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "11.2-dev" + } + }, + "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.2.8" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" + } + ], + "time": "2024-07-18T14:56:37+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/log", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", + "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.0" + }, + "time": "2021-07-14T16:46:02+00:00" + }, + { + "name": "react/cache", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/cache.git", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/cache/zipball/d47c472b64aa5608225f47965a484b75c7817d5b", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/promise": "^3.0 || ^2.0 || ^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian LĆ¼ck", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, Promise-based cache interface for ReactPHP", + "keywords": [ + "cache", + "caching", + "promise", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/cache/issues", + "source": "https://github.com/reactphp/cache/tree/v1.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2022-11-30T15:59:55+00:00" + }, + { + "name": "react/child-process", + "version": "v0.6.5", + "source": { + "type": "git", + "url": "https://github.com/reactphp/child-process.git", + "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/child-process/zipball/e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", + "reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/event-loop": "^1.2", + "react/stream": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35", + "react/socket": "^1.8", + "sebastian/environment": "^5.0 || ^3.0 || ^2.0 || ^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\ChildProcess\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian LĆ¼ck", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven library for executing child processes with ReactPHP.", + "keywords": [ + "event-driven", + "process", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/child-process/issues", + "source": "https://github.com/reactphp/child-process/tree/v0.6.5" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-09-16T13:41:56+00:00" + }, + { + "name": "react/dns", + "version": "v1.13.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/dns.git", + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/dns/zipball/eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", + "reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/cache": "^1.0 || ^0.6 || ^0.5", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.7 || ^1.2.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3 || ^2", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Dns\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian LĆ¼ck", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async DNS resolver for ReactPHP", + "keywords": [ + "async", + "dns", + "dns-resolver", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/dns/issues", + "source": "https://github.com/reactphp/dns/tree/v1.13.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-13T14:18:03+00:00" + }, + { + "name": "react/event-loop", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/event-loop.git", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "suggest": { + "ext-pcntl": "For signal handling support when using the StreamSelectLoop" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\EventLoop\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian LĆ¼ck", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.", + "keywords": [ + "asynchronous", + "event-loop" + ], + "support": { + "issues": "https://github.com/reactphp/event-loop/issues", + "source": "https://github.com/reactphp/event-loop/tree/v1.5.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-11-13T13:48:05+00:00" + }, + { + "name": "react/promise", + "version": "v3.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "8a164643313c71354582dc850b42b33fa12a4b63" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/8a164643313c71354582dc850b42b33fa12a4b63", + "reference": "8a164643313c71354582dc850b42b33fa12a4b63", + "shasum": "" + }, + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "phpstan/phpstan": "1.10.39 || 1.4.10", + "phpunit/phpunit": "^9.6 || ^7.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian LĆ¼ck", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v3.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-05-24T10:39:05+00:00" + }, + { + "name": "react/socket", + "version": "v1.15.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/socket.git", + "reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/socket/zipball/216d3aec0b87f04a40ca04f481e6af01bdd1d038", + "reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/dns": "^1.11", + "react/event-loop": "^1.2", + "react/promise": "^3 || ^2.6 || ^1.2.1", + "react/stream": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4 || ^3 || ^2", + "react/promise-stream": "^1.4", + "react/promise-timer": "^1.10" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Socket\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian LĆ¼ck", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP", + "keywords": [ + "Connection", + "Socket", + "async", + "reactphp", + "stream" + ], + "support": { + "issues": "https://github.com/reactphp/socket/issues", + "source": "https://github.com/reactphp/socket/tree/v1.15.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-12-15T11:02:10+00:00" + }, + { + "name": "react/stream", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/stream.git", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/stream/zipball/1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.8", + "react/event-loop": "^1.2" + }, + "require-dev": { + "clue/stream-filter": "~1.2", + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian LĆ¼ck", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP", + "keywords": [ + "event-driven", + "io", + "non-blocking", + "pipe", + "reactphp", + "readable", + "stream", + "writable" + ], + "support": { + "issues": "https://github.com/reactphp/stream/issues", + "source": "https://github.com/reactphp/stream/tree/v1.4.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-11T12:45:25+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/15c5dd40dc4f38794d383bb95465193f5e0ae180", + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:41:36+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "6bb7d09d6623567178cf54126afa9c2310114268" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/6bb7d09d6623567178cf54126afa9c2310114268", + "reference": "6bb7d09d6623567178cf54126afa9c2310114268", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "security": "https://github.com/sebastianbergmann/code-unit/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:44:28+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "4.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "183a9b2632194febd219bb9246eee421dad8d45e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/183a9b2632194febd219bb9246eee421dad8d45e", + "reference": "183a9b2632194febd219bb9246eee421dad8d45e", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "security": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/4.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:45:54+00:00" + }, + { + "name": "sebastian/comparator", + "version": "6.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "131942b86d3587291067a94f295498ab6ac79c20" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/131942b86d3587291067a94f295498ab6ac79c20", + "reference": "131942b86d3587291067a94f295498ab6ac79c20", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/diff": "^6.0", + "sebastian/exporter": "^6.0" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/6.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:48:07+00:00" + }, + { + "name": "sebastian/complexity", + "version": "4.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/ee41d384ab1906c68852636b6de493846e13e5a0", + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^5.0", + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/4.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:49:50+00:00" + }, + { + "name": "sebastian/diff", + "version": "6.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544", + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/6.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:53:05+00:00" + }, + { + "name": "sebastian/environment", + "version": "7.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", + "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "7.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "https://github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/7.2.0" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:54:44+00:00" + }, + { + "name": "sebastian/exporter", + "version": "6.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "c414673eee9a8f9d51bbf8d61fc9e3ef1e85b20e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c414673eee9a8f9d51bbf8d61fc9e3ef1e85b20e", + "reference": "c414673eee9a8f9d51bbf8d61fc9e3ef1e85b20e", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/recursion-context": "^6.0" + }, + "require-dev": { + "phpunit/phpunit": "^11.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "https://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/6.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:56:19+00:00" + }, + { + "name": "sebastian/global-state", + "version": "7.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "3be331570a721f9a4b5917f4209773de17f747d7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7", + "reference": "3be331570a721f9a4b5917f4209773de17f747d7", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { - "ext-pcntl": "*", + "ext-dom": "*", "phpunit/phpunit": "^11.0" }, - "suggest": { - "ext-pcntl": "*" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "7.0-dev" } }, "autoload": { @@ -946,19 +2919,18 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "email": "sebastian@phpunit.de" } ], - "description": "Invoke callables with a timeout", - "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "description": "Snapshotting of global state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", "keywords": [ - "process" + "global state" ], "support": { - "issues": "https://github.com/sebastianbergmann/php-invoker/issues", - "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", - "source": "https://github.com/sebastianbergmann/php-invoker/tree/5.0.1" + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.2" }, "funding": [ { @@ -966,23 +2938,24 @@ "type": "github" } ], - "time": "2024-07-03T05:07:44+00:00" + "time": "2024-07-03T04:57:36+00:00" }, { - "name": "phpunit/php-text-template", - "version": "4.0.1", + "name": "sebastian/lines-of-code", + "version": "3.0.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964" + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/3e0404dc6b300e6bf56415467ebcb3fe4f33e964", - "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d36ad0d782e5756913e42ad87cb2890f4ffe467a", + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a", "shasum": "" }, "require": { + "nikic/php-parser": "^5.0", "php": ">=8.2" }, "require-dev": { @@ -991,7 +2964,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "4.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1010,15 +2983,12 @@ "role": "lead" } ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { - "issues": "https://github.com/sebastianbergmann/php-text-template/issues", - "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", - "source": "https://github.com/sebastianbergmann/php-text-template/tree/4.0.1" + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/3.0.1" }, "funding": [ { @@ -1026,24 +2996,26 @@ "type": "github" } ], - "time": "2024-07-03T05:08:43+00:00" + "time": "2024-07-03T04:58:38+00:00" }, { - "name": "phpunit/php-timer", - "version": "7.0.1", + "name": "sebastian/object-enumerator", + "version": "6.0.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3" + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "f5b498e631a74204185071eb41f33f38d64608aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", - "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aa", + "reference": "f5b498e631a74204185071eb41f33f38d64608aa", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" }, "require-dev": { "phpunit/phpunit": "^11.0" @@ -1051,7 +3023,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "7.0-dev" + "dev-main": "6.0-dev" } }, "autoload": { @@ -1066,19 +3038,15 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "email": "sebastian@phpunit.de" } ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", "support": { - "issues": "https://github.com/sebastianbergmann/php-timer/issues", - "security": "https://github.com/sebastianbergmann/php-timer/security/policy", - "source": "https://github.com/sebastianbergmann/php-timer/tree/7.0.1" + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/6.0.1" }, "funding": [ { @@ -1086,65 +3054,35 @@ "type": "github" } ], - "time": "2024-07-03T05:09:35+00:00" + "time": "2024-07-03T05:00:13+00:00" }, { - "name": "phpunit/phpunit", - "version": "11.2.8", + "name": "sebastian/object-reflector", + "version": "4.0.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a7a29e8d3113806f18f99d670f580a30e8ffff39" + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a7a29e8d3113806f18f99d670f580a30e8ffff39", - "reference": "a7a29e8d3113806f18f99d670f580a30e8ffff39", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9", + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9", "shasum": "" }, "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.12.0", - "phar-io/manifest": "^2.0.4", - "phar-io/version": "^3.2.1", - "php": ">=8.2", - "phpunit/php-code-coverage": "^11.0.5", - "phpunit/php-file-iterator": "^5.0.1", - "phpunit/php-invoker": "^5.0.1", - "phpunit/php-text-template": "^4.0.1", - "phpunit/php-timer": "^7.0.1", - "sebastian/cli-parser": "^3.0.2", - "sebastian/code-unit": "^3.0.1", - "sebastian/comparator": "^6.0.1", - "sebastian/diff": "^6.0.2", - "sebastian/environment": "^7.2.0", - "sebastian/exporter": "^6.1.3", - "sebastian/global-state": "^7.0.2", - "sebastian/object-enumerator": "^6.0.1", - "sebastian/type": "^5.0.1", - "sebastian/version": "^5.0.1" + "php": ">=8.2" }, - "suggest": { - "ext-soap": "To be able to generate mocks based on WSDL files" + "require-dev": { + "phpunit/phpunit": "^11.0" }, - "bin": [ - "phpunit" - ], "type": "library", "extra": { "branch-alias": { - "dev-main": "11.2-dev" + "dev-main": "4.0-dev" } }, "autoload": { - "files": [ - "src/Framework/Assert/Functions.php" - ], "classmap": [ "src/" ] @@ -1156,50 +3094,100 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "email": "sebastian@phpunit.de" } ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", "support": { - "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.2.8" + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/4.0.1" }, "funding": [ - { - "url": "https://phpunit.de/sponsors.html", - "type": "custom" - }, { "url": "https://github.com/sebastianbergmann", "type": "github" + } + ], + "time": "2024-07-03T05:01:32+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "6.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "694d156164372abbd149a4b85ccda2e4670c0e16" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/694d156164372abbd149a4b85ccda2e4670c0e16", + "reference": "694d156164372abbd149a4b85ccda2e4670c0e16", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" }, { - "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", - "type": "tidelift" + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" } ], - "time": "2024-07-18T14:56:37+00:00" + "description": "Provides functionality to recursively process PHP variables", + "homepage": "https://github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T05:10:34+00:00" }, { - "name": "sebastian/cli-parser", - "version": "3.0.2", + "name": "sebastian/type", + "version": "5.0.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180" + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "fb6a6566f9589e86661291d13eba708cce5eb4aa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/15c5dd40dc4f38794d383bb95465193f5e0ae180", - "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb6a6566f9589e86661291d13eba708cce5eb4aa", + "reference": "fb6a6566f9589e86661291d13eba708cce5eb4aa", "shasum": "" }, "require": { @@ -1211,7 +3199,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1230,12 +3218,12 @@ "role": "lead" } ], - "description": "Library for parsing CLI options", - "homepage": "https://github.com/sebastianbergmann/cli-parser", + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", "support": { - "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.2" + "issues": "https://github.com/sebastianbergmann/type/issues", + "security": "https://github.com/sebastianbergmann/type/security/policy", + "source": "https://github.com/sebastianbergmann/type/tree/5.0.1" }, "funding": [ { @@ -1243,32 +3231,29 @@ "type": "github" } ], - "time": "2024-07-03T04:41:36+00:00" + "time": "2024-07-03T05:11:49+00:00" }, { - "name": "sebastian/code-unit", - "version": "3.0.1", + "name": "sebastian/version", + "version": "5.0.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "6bb7d09d6623567178cf54126afa9c2310114268" + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "45c9debb7d039ce9b97de2f749c2cf5832a06ac4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/6bb7d09d6623567178cf54126afa9c2310114268", - "reference": "6bb7d09d6623567178cf54126afa9c2310114268", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/45c9debb7d039ce9b97de2f749c2cf5832a06ac4", + "reference": "45c9debb7d039ce9b97de2f749c2cf5832a06ac4", "shasum": "" }, "require": { "php": ">=8.2" }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.0-dev" + "dev-main": "5.0-dev" } }, "autoload": { @@ -1287,12 +3272,12 @@ "role": "lead" } ], - "description": "Collection of value objects that represent the PHP code units", - "homepage": "https://github.com/sebastianbergmann/code-unit", + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", "support": { - "issues": "https://github.com/sebastianbergmann/code-unit/issues", - "security": "https://github.com/sebastianbergmann/code-unit/security/policy", - "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.1" + "issues": "https://github.com/sebastianbergmann/version/issues", + "security": "https://github.com/sebastianbergmann/version/security/policy", + "source": "https://github.com/sebastianbergmann/version/tree/5.0.1" }, "funding": [ { @@ -1300,816 +3285,981 @@ "type": "github" } ], - "time": "2024-07-03T04:44:28+00:00" + "time": "2024-07-03T05:13:08+00:00" }, { - "name": "sebastian/code-unit-reverse-lookup", - "version": "4.0.1", + "name": "symfony/console", + "version": "v7.1.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "183a9b2632194febd219bb9246eee421dad8d45e" + "url": "https://github.com/symfony/console.git", + "reference": "0aa29ca177f432ab68533432db0de059f39c92ae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/183a9b2632194febd219bb9246eee421dad8d45e", - "reference": "183a9b2632194febd219bb9246eee421dad8d45e", + "url": "https://api.github.com/repos/symfony/console/zipball/0aa29ca177f432ab68533432db0de059f39c92ae", + "reference": "0aa29ca177f432ab68533432db0de059f39c92ae", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.2", + "symfony/polyfill-mbstring": "~1.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/string": "^6.4|^7.0" + }, + "conflict": { + "symfony/dependency-injection": "<6.4", + "symfony/dotenv": "<6.4", + "symfony/event-dispatcher": "<6.4", + "symfony/lock": "<6.4", + "symfony/process": "<6.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "psr/log": "^1|^2|^3", + "symfony/config": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/event-dispatcher": "^6.4|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/lock": "^6.4|^7.0", + "symfony/messenger": "^6.4|^7.0", + "symfony/process": "^6.4|^7.0", + "symfony/stopwatch": "^6.4|^7.0", + "symfony/var-dumper": "^6.4|^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "4.0-dev" - } - }, "autoload": { - "classmap": [ - "src/" + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], "support": { - "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", - "security": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/security/policy", - "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/4.0.1" + "source": "https://github.com/symfony/console/tree/v7.1.2" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2024-07-03T04:45:54+00:00" + "time": "2024-06-28T10:03:55+00:00" }, { - "name": "sebastian/comparator", - "version": "6.0.1", + "name": "symfony/event-dispatcher", + "version": "v7.1.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "131942b86d3587291067a94f295498ab6ac79c20" + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "9fa7f7a21beb22a39a8f3f28618b29e50d7a55a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/131942b86d3587291067a94f295498ab6ac79c20", - "reference": "131942b86d3587291067a94f295498ab6ac79c20", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9fa7f7a21beb22a39a8f3f28618b29e50d7a55a7", + "reference": "9fa7f7a21beb22a39a8f3f28618b29e50d7a55a7", "shasum": "" }, "require": { - "ext-dom": "*", - "ext-mbstring": "*", "php": ">=8.2", - "sebastian/diff": "^6.0", - "sebastian/exporter": "^6.0" + "symfony/event-dispatcher-contracts": "^2.5|^3" + }, + "conflict": { + "symfony/dependency-injection": "<6.4", + "symfony/service-contracts": "<2.5" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0|3.0" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "psr/log": "^1|^2|^3", + "symfony/config": "^6.4|^7.0", + "symfony/dependency-injection": "^6.4|^7.0", + "symfony/error-handler": "^6.4|^7.0", + "symfony/expression-language": "^6.4|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/stopwatch": "^6.4|^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "6.0-dev" - } - }, "autoload": { - "classmap": [ - "src/" + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], + "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", + "homepage": "https://symfony.com", "support": { - "issues": "https://github.com/sebastianbergmann/comparator/issues", - "security": "https://github.com/sebastianbergmann/comparator/security/policy", - "source": "https://github.com/sebastianbergmann/comparator/tree/6.0.1" + "source": "https://github.com/symfony/event-dispatcher/tree/v7.1.1" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2024-07-03T04:48:07+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { - "name": "sebastian/complexity", - "version": "4.0.1", + "name": "symfony/event-dispatcher-contracts", + "version": "v3.5.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "ee41d384ab1906c68852636b6de493846e13e5a0" + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "8f93aec25d41b72493c6ddff14e916177c9efc50" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/ee41d384ab1906c68852636b6de493846e13e5a0", - "reference": "ee41d384ab1906c68852636b6de493846e13e5a0", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/8f93aec25d41b72493c6ddff14e916177c9efc50", + "reference": "8f93aec25d41b72493c6ddff14e916177c9efc50", "shasum": "" }, "require": { - "nikic/php-parser": "^5.0", - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" + "php": ">=8.1", + "psr/event-dispatcher": "^1" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "4.0-dev" + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { - "classmap": [ - "src/" - ] + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Library for calculating the complexity of PHP code units", - "homepage": "https://github.com/sebastianbergmann/complexity", + "description": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], "support": { - "issues": "https://github.com/sebastianbergmann/complexity/issues", - "security": "https://github.com/sebastianbergmann/complexity/security/policy", - "source": "https://github.com/sebastianbergmann/complexity/tree/4.0.1" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.5.0" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2024-07-03T04:49:50+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { - "name": "sebastian/diff", - "version": "6.0.2", + "name": "symfony/filesystem", + "version": "v7.1.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544" + "url": "https://github.com/symfony/filesystem.git", + "reference": "92a91985250c251de9b947a14bb2c9390b1a562c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544", - "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/92a91985250c251de9b947a14bb2c9390b1a562c", + "reference": "92a91985250c251de9b947a14bb2c9390b1a562c", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.2", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8" }, "require-dev": { - "phpunit/phpunit": "^11.0", - "symfony/process": "^4.2 || ^5" + "symfony/process": "^6.4|^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "6.0-dev" - } - }, "autoload": { - "classmap": [ - "src/" + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } ], + "description": "Provides basic utilities for the filesystem", + "homepage": "https://symfony.com", "support": { - "issues": "https://github.com/sebastianbergmann/diff/issues", - "security": "https://github.com/sebastianbergmann/diff/security/policy", - "source": "https://github.com/sebastianbergmann/diff/tree/6.0.2" + "source": "https://github.com/symfony/filesystem/tree/v7.1.2" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2024-07-03T04:53:05+00:00" + "time": "2024-06-28T10:03:55+00:00" }, { - "name": "sebastian/environment", - "version": "7.2.0", + "name": "symfony/finder", + "version": "v7.1.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5" + "url": "https://github.com/symfony/finder.git", + "reference": "fbb0ba67688b780efbc886c1a0a0948dcf7205d6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", - "reference": "855f3ae0ab316bbafe1ba4e16e9f3c078d24a0c5", + "url": "https://api.github.com/repos/symfony/finder/zipball/fbb0ba67688b780efbc886c1a0a0948dcf7205d6", + "reference": "fbb0ba67688b780efbc886c1a0a0948dcf7205d6", "shasum": "" }, "require": { "php": ">=8.2" }, "require-dev": { - "phpunit/phpunit": "^11.0" - }, - "suggest": { - "ext-posix": "*" + "symfony/filesystem": "^6.4|^7.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "7.2-dev" - } - }, "autoload": { - "classmap": [ - "src/" + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "https://github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], + "description": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", "support": { - "issues": "https://github.com/sebastianbergmann/environment/issues", - "security": "https://github.com/sebastianbergmann/environment/security/policy", - "source": "https://github.com/sebastianbergmann/environment/tree/7.2.0" + "source": "https://github.com/symfony/finder/tree/v7.1.1" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2024-07-03T04:54:44+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { - "name": "sebastian/exporter", - "version": "6.1.3", + "name": "symfony/options-resolver", + "version": "v7.1.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "c414673eee9a8f9d51bbf8d61fc9e3ef1e85b20e" + "url": "https://github.com/symfony/options-resolver.git", + "reference": "47aa818121ed3950acd2b58d1d37d08a94f9bf55" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/c414673eee9a8f9d51bbf8d61fc9e3ef1e85b20e", - "reference": "c414673eee9a8f9d51bbf8d61fc9e3ef1e85b20e", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/47aa818121ed3950acd2b58d1d37d08a94f9bf55", + "reference": "47aa818121ed3950acd2b58d1d37d08a94f9bf55", "shasum": "" }, "require": { - "ext-mbstring": "*", "php": ">=8.2", - "sebastian/recursion-context": "^6.0" - }, - "require-dev": { - "phpunit/phpunit": "^11.2" + "symfony/deprecation-contracts": "^2.5|^3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "6.1-dev" - } - }, "autoload": { - "classmap": [ - "src/" + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "https://www.github.com/sebastianbergmann/exporter", + "description": "Provides an improved replacement for the array_replace PHP function", + "homepage": "https://symfony.com", "keywords": [ - "export", - "exporter" + "config", + "configuration", + "options" ], "support": { - "issues": "https://github.com/sebastianbergmann/exporter/issues", - "security": "https://github.com/sebastianbergmann/exporter/security/policy", - "source": "https://github.com/sebastianbergmann/exporter/tree/6.1.3" + "source": "https://github.com/symfony/options-resolver/tree/v7.1.1" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2024-07-03T04:56:19+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { - "name": "sebastian/global-state", - "version": "7.0.2", + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.30.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "3be331570a721f9a4b5917f4209773de17f747d7" + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7", - "reference": "3be331570a721f9a4b5917f4209773de17f747d7", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/64647a7c30b2283f5d49b874d84a18fc22054b7a", + "reference": "64647a7c30b2283f5d49b874d84a18fc22054b7a", "shasum": "" }, "require": { - "php": ">=8.2", - "sebastian/object-reflector": "^4.0", - "sebastian/recursion-context": "^6.0" + "php": ">=7.1" }, - "require-dev": { - "ext-dom": "*", - "phpunit/phpunit": "^11.0" + "suggest": { + "ext-intl": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "7.0-dev" + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { - "classmap": [ - "src/" - ] + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Snapshotting of global state", - "homepage": "https://www.github.com/sebastianbergmann/global-state", + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", "keywords": [ - "global state" + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" ], "support": { - "issues": "https://github.com/sebastianbergmann/global-state/issues", - "security": "https://github.com/sebastianbergmann/global-state/security/policy", - "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.2" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.30.0" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2024-07-03T04:57:36+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { - "name": "sebastian/lines-of-code", - "version": "3.0.1", + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.30.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a" + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d36ad0d782e5756913e42ad87cb2890f4ffe467a", - "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/a95281b0be0d9ab48050ebd988b967875cdb9fdb", + "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb", "shasum": "" }, "require": { - "nikic/php-parser": "^5.0", - "php": ">=8.2" + "php": ">=7.1" }, - "require-dev": { - "phpunit/phpunit": "^11.0" + "suggest": { + "ext-intl": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "3.0-dev" + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, "classmap": [ - "src/" + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Library for counting the lines of code in PHP source code", - "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], "support": { - "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/3.0.1" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.30.0" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2024-07-03T04:58:38+00:00" + "time": "2024-05-31T15:07:36+00:00" }, { - "name": "sebastian/object-enumerator", - "version": "6.0.1", + "name": "symfony/polyfill-php81", + "version": "v1.30.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "f5b498e631a74204185071eb41f33f38d64608aa" + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "3fb075789fb91f9ad9af537c4012d523085bd5af" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aa", - "reference": "f5b498e631a74204185071eb41f33f38d64608aa", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/3fb075789fb91f9ad9af537c4012d523085bd5af", + "reference": "3fb075789fb91f9ad9af537c4012d523085bd5af", "shasum": "" }, "require": { - "php": ">=8.2", - "sebastian/object-reflector": "^4.0", - "sebastian/recursion-context": "^6.0" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" + "php": ">=7.1" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "6.0-dev" + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, "classmap": [ - "src/" + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], "support": { - "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", - "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", - "source": "https://github.com/sebastianbergmann/object-enumerator/tree/6.0.1" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.30.0" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2024-07-03T05:00:13+00:00" + "time": "2024-06-19T12:30:46+00:00" }, { - "name": "sebastian/object-reflector", - "version": "4.0.1", + "name": "symfony/process", + "version": "v7.1.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9" + "url": "https://github.com/symfony/process.git", + "reference": "febf90124323a093c7ee06fdb30e765ca3c20028" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9", - "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9", + "url": "https://api.github.com/repos/symfony/process/zipball/febf90124323a093c7ee06fdb30e765ca3c20028", + "reference": "febf90124323a093c7ee06fdb30e765ca3c20028", "shasum": "" }, "require": { "php": ">=8.2" }, - "require-dev": { - "phpunit/phpunit": "^11.0" - }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "4.0-dev" - } - }, "autoload": { - "classmap": [ - "src/" + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "description": "Executes commands in sub-processes", + "homepage": "https://symfony.com", "support": { - "issues": "https://github.com/sebastianbergmann/object-reflector/issues", - "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", - "source": "https://github.com/sebastianbergmann/object-reflector/tree/4.0.1" + "source": "https://github.com/symfony/process/tree/v7.1.1" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2024-07-03T05:01:32+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { - "name": "sebastian/recursion-context", - "version": "6.0.2", + "name": "symfony/service-contracts", + "version": "v3.5.0", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "694d156164372abbd149a4b85ccda2e4670c0e16" + "url": "https://github.com/symfony/service-contracts.git", + "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/694d156164372abbd149a4b85ccda2e4670c0e16", - "reference": "694d156164372abbd149a4b85ccda2e4670c0e16", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", + "reference": "bd1d9e59a81d8fa4acdcea3f617c581f7475a80f", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" }, - "require-dev": { - "phpunit/phpunit": "^11.0" + "conflict": { + "ext-psr": "<1.1|>=2" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "6.0-dev" + "dev-main": "3.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, "autoload": { - "classmap": [ - "src/" + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + }, + "exclude-from-classmap": [ + "/Test/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { - "name": "Adam Harvey", - "email": "aharvey@php.net" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "https://github.com/sebastianbergmann/recursion-context", + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], "support": { - "issues": "https://github.com/sebastianbergmann/recursion-context/issues", - "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", - "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.2" + "source": "https://github.com/symfony/service-contracts/tree/v3.5.0" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2024-07-03T05:10:34+00:00" + "time": "2024-04-18T09:32:20+00:00" }, { - "name": "sebastian/type", - "version": "5.0.1", + "name": "symfony/stopwatch", + "version": "v7.1.1", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/type.git", - "reference": "fb6a6566f9589e86661291d13eba708cce5eb4aa" + "url": "https://github.com/symfony/stopwatch.git", + "reference": "5b75bb1ac2ba1b9d05c47fc4b3046a625377d23d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/fb6a6566f9589e86661291d13eba708cce5eb4aa", - "reference": "fb6a6566f9589e86661291d13eba708cce5eb4aa", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5b75bb1ac2ba1b9d05c47fc4b3046a625377d23d", + "reference": "5b75bb1ac2ba1b9d05c47fc4b3046a625377d23d", "shasum": "" }, "require": { - "php": ">=8.2" - }, - "require-dev": { - "phpunit/phpunit": "^11.0" + "php": ">=8.2", + "symfony/service-contracts": "^2.5|^3" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "5.0-dev" - } - }, "autoload": { - "classmap": [ - "src/" + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Collection of value objects that represent the types of the PHP type system", - "homepage": "https://github.com/sebastianbergmann/type", + "description": "Provides a way to profile code", + "homepage": "https://symfony.com", "support": { - "issues": "https://github.com/sebastianbergmann/type/issues", - "security": "https://github.com/sebastianbergmann/type/security/policy", - "source": "https://github.com/sebastianbergmann/type/tree/5.0.1" + "source": "https://github.com/symfony/stopwatch/tree/v7.1.1" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2024-07-03T05:11:49+00:00" + "time": "2024-05-31T14:57:53+00:00" }, { - "name": "sebastian/version", - "version": "5.0.1", + "name": "symfony/string", + "version": "v7.1.2", "source": { "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "45c9debb7d039ce9b97de2f749c2cf5832a06ac4" + "url": "https://github.com/symfony/string.git", + "reference": "14221089ac66cf82e3cf3d1c1da65de305587ff8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/45c9debb7d039ce9b97de2f749c2cf5832a06ac4", - "reference": "45c9debb7d039ce9b97de2f749c2cf5832a06ac4", + "url": "https://api.github.com/repos/symfony/string/zipball/14221089ac66cf82e3cf3d1c1da65de305587ff8", + "reference": "14221089ac66cf82e3cf3d1c1da65de305587ff8", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.2", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "5.0-dev" - } + "conflict": { + "symfony/translation-contracts": "<2.5" + }, + "require-dev": { + "symfony/emoji": "^7.1", + "symfony/error-handler": "^6.4|^7.0", + "symfony/http-client": "^6.4|^7.0", + "symfony/intl": "^6.4|^7.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^6.4|^7.0" }, + "type": "library", "autoload": { - "classmap": [ - "src/" + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause" + "MIT" ], "authors": [ { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], "support": { - "issues": "https://github.com/sebastianbergmann/version/issues", - "security": "https://github.com/sebastianbergmann/version/security/policy", - "source": "https://github.com/sebastianbergmann/version/tree/5.0.1" + "source": "https://github.com/symfony/string/tree/v7.1.2" }, "funding": [ { - "url": "https://github.com/sebastianbergmann", + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" } ], - "time": "2024-07-03T05:13:08+00:00" + "time": "2024-06-28T09:27:18+00:00" }, { "name": "theseer/tokenizer", diff --git a/cron/jobs/SettingsJob.php b/cron/jobs/SettingsJob.php index 26c582f..3765154 100755 --- a/cron/jobs/SettingsJob.php +++ b/cron/jobs/SettingsJob.php @@ -1,4 +1,5 @@ getMessage() . "")); + die(Kernel::translateColorsCode("&cE&0&lr&2&lr&3&lo&5&lr: &r&l" . $e->getMessage() . "")); } \ No newline at end of file diff --git a/install/install.php b/install/install.php index 877c9d6..187b3d9 100755 --- a/install/install.php +++ b/install/install.php @@ -1,5 +1,7 @@ getMessage()); + } catch (NoMigrationsFound $e) { + die("No migrations found!"); + } catch (Exception $e) { + die("Failed to migrate the database: " . $e->getMessage()); + } migrateCfg(); settings::update('app', 'name', $app_name); settings::update('app', 'timezone', $app_timezone); @@ -82,9 +92,9 @@ /** * Install functions - * + * * Do not touch those functions please - * + * * If you touch you gay */ function migrateDB() @@ -104,7 +114,7 @@ function migrateDB() $sqlFiles = glob(__DIR__ . '/..//migrate/database/*.sql'); if (count($sqlFiles) > 0) { - usort($sqlFiles, function($a, $b) { + usort($sqlFiles, function ($a, $b) { $aDate = intval(basename($a, '.sql')); $bDate = intval(basename($b, '.sql')); return $aDate - $bDate; @@ -129,7 +139,7 @@ function migrateDB() } } } else { - die("(DB) No migrations found!"); + } } catch (PDOException $e) { die("Failed to migrate the database: " . $e->getMessage() . ""); diff --git a/install/mysql.php b/install/mysql.php index ee0bd93..e0fe762 100755 --- a/install/mysql.php +++ b/install/mysql.php @@ -1,4 +1,5 @@ \ No newline at end of file diff --git a/lang/en_US.php b/lang/en_US.php index c44094b..a6718b7 100755 --- a/lang/en_US.php +++ b/lang/en_US.php @@ -1,10 +1,10 @@ - "Page not found", - "pages_error_500" => "Internal server error", - "pages_error_403" => "Forbidden", - "pages_error_401" => "Unauthorized", - "pages_error_go_back" => "Go home", - ]; -?> \ No newline at end of file + "Page not found", + "pages_error_500" => "Internal server error", + "pages_error_403" => "Forbidden", + "pages_error_401" => "Unauthorized", + "pages_error_go_back" => "Go home", +]; diff --git a/migrate/config/1.php b/migrate/config/1.php index b33f763..eec82ab 100755 --- a/migrate/config/1.php +++ b/migrate/config/1.php @@ -1,4 +1,5 @@ add('/errors/404', function () { /** - * The requirement for each template + * The requirement for each template */ global $renderer; http_response_code(404); @@ -11,7 +11,7 @@ $router->add('/errors/500', function () { /** - * The requirement for each template + * The requirement for each template */ global $renderer; http_response_code(500); @@ -20,7 +20,7 @@ $router->add('/errors/403', function () { /** - * The requirement for each template + * The requirement for each template */ global $renderer; http_response_code(403); @@ -29,7 +29,7 @@ $router->add('/errors/401', function () { /** - * The requirement for each template + * The requirement for each template */ global $renderer; http_response_code(401); diff --git a/routes/views/index.php b/routes/views/index.php index 80c61fc..b42c178 100755 --- a/routes/views/index.php +++ b/routes/views/index.php @@ -1,13 +1,14 @@ -add('/', function() { +$router->add('/', function () { /** - * The requirement for each template + * The requirement for each template */ - global $renderer; + global $renderer; die($renderer->render('index.twig')); -}); \ No newline at end of file +}); diff --git a/tests/EncryptionTest.php b/tests/EncryptionTest.php index 5491321..310d5e3 100755 --- a/tests/EncryptionTest.php +++ b/tests/EncryptionTest.php @@ -9,19 +9,19 @@ class EncryptionTest extends TestCase { /** * The encryption key - * + * * @var string */ public static string $key = "AAAAB3NzaC1yc2EAAAADAQABAAABAQDZHXFFVqeRQk42pViMsxfQhIrQBm7LcmW1sazqkgkCgoOVcW4OiCoaH0P9Zf5HjqdJ9RJocnJz8qKQQUiCFxuxt8qJiHMoqf+Mu8KgOs6ixo0SLiH2QakAZ0Nm46WB+VjXmLHkxZ9tw/f2M9dGI5Ky0M0TvsKSXS0v8crXLBBE3Fa+gao/34Cyqim1ZhCopVIjTtRNSZwx0CzHcYGhegl04+nIksCYg7RH56CTH5j1NZX8enJ7T5lx9sl8YIde6qJu7tD0nsfZFTRxwUzLvfGmFIQ9/96BNThB7aK806T8Tr+amKsPcYEc3Il6LifoPztYS6pYtbwBl3eMm0mchNgJ"; /** * The data to encrypt - * + * * @var string */ public static string $data = "Hello World, this is a unit test for the encryption handler :)!"; /** * The encrypted data - * + * * @var string */ public static string $data_e = "iaatrbFTpenTr5Wlg6atqrRhqrdhsmG3r6q1YrW2t85ovrW4duXNt3HQopXiz9nB3OfUcdCq4LWu0qlsnZZ4"; @@ -38,4 +38,4 @@ public function testEncryption(): void $this->assertEquals(self::$data_e, $encryptedData); } -} \ No newline at end of file +} diff --git a/yarn.lock b/yarn.lock old mode 100644 new mode 100755 From c76907fe109e712af918e14180f6854ef5ce70de Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Thu, 25 Jul 2024 00:13:49 +0200 Subject: [PATCH 11/17] PUSH -> Fix lint! --- .github/workflows/lint.yml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b747f7e..1506a63 100755 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,15 +1,10 @@ name: Lint -on: - push: - branches: - - "develop" - - "1.0-develop" - pull_request: - branches: - - "develop" - - "1.0-develop" +on: [push, pull_request] +permissions: + contents: read + jobs: lint: name: Lint From d180de4869baff49db6983382d259af28d2906f3 Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Thu, 25 Jul 2024 10:45:46 +0200 Subject: [PATCH 12/17] PUSH -> Fix Lint --- .github/workflows/lint.yml | 25 +- .php-cs-fixer.dist.php | 69 +++++ addons/Example/Example.php | 2 - api/System/logs.php | 5 +- api/User/login.php | 3 - app/Cli/Colors.php | 69 +---- app/Cli/Commands/Colors.php | 2 +- app/Cli/Commands/Command.php | 26 +- app/Cli/Commands/Configure.php | 56 ++-- app/Cli/Commands/Down.php | 11 +- app/Cli/Commands/Help.php | 12 +- app/Cli/Commands/Migrate.php | 29 +- app/Cli/Commands/Rebuild.php | 66 ++--- app/Cli/Commands/Up.php | 11 +- app/Cli/Kernel.php | 24 +- app/Database/MySQL.php | 156 +++++----- app/Database/MySQLCache.php | 34 +-- app/Database/Redis/Redis.php | 2 - .../exception/database/MySQLError.php | 7 +- .../exception/migration/NoMigrationsFound.php | 7 +- app/Handlers/ActivityHandler.php | 31 +- app/Handlers/AnnouncementHandler.php | 243 +++++++-------- app/Handlers/CacheHandler.php | 37 +-- app/Handlers/NotificationHandler.php | 138 ++++----- .../AnnouncementNotFoundException.php | 2 +- .../NotificationNotFoundException.php | 2 +- .../interfaces/AnnouncementSocial.php | 2 +- app/Kernel/Debugger.php | 103 +++---- app/Kernel/Encryption.php | 18 +- app/Kernel/Logger.php | 49 ++- app/Kernel/LoggerTypes.php | 2 +- app/Managers/ConfigManager.php | 49 ++- app/Managers/LanguageManager.php | 48 +-- app/Managers/Settings.php | 35 ++- app/Managers/SettingsManager.php | 30 +- app/Managers/SnowFlakeManager.php | 33 ++- .../exception/settings/NoMigrationsFound.php | 7 +- app/Plugins/Events/ActivityEvent.php | 1 - app/Plugins/Events/AnnouncementEvent.php | 1 + app/Plugins/Events/ApplicationEvent.php | 2 +- app/Plugins/Events/ConfigEvent.php | 1 - app/Plugins/Events/CronEvent.php | 1 - app/Plugins/Events/DatabaseEvent.php | 1 + app/Plugins/Events/EncryptionEvent.php | 1 - app/Plugins/Events/ExceptionEvent.php | 1 - app/Plugins/Events/LoggerEvent.php | 3 - app/Plugins/Events/NotificationEvent.php | 3 +- app/Plugins/Events/PermissionEvent.php | 1 - app/Plugins/Events/RendererEvent.php | 1 - app/Plugins/Events/RoleEvent.php | 1 - app/Plugins/Events/RouterEvent.php | 1 - app/Plugins/Events/SettingEvent.php | 2 - app/Plugins/Events/SnowFlakeEvent.php | 1 - app/Plugins/Events/UserEvent.php | 12 +- app/Plugins/PluginsEventHandler.php | 6 - app/Plugins/PluginsManager.php | 6 +- app/Roles/RolesDataHandler.php | 132 ++++----- app/Roles/RolesHelper.php | 11 +- app/Roles/RolesPermissionDataHandler.php | 142 +++++---- app/User/Exceptions/UserException.php | 8 +- app/User/UserDataHandler.php | 155 +++++----- app/User/UserHelper.php | 279 +++++++++--------- commands/core/cache/cacheprocess.php | 10 +- commands/core/cache/cachepurge.php | 10 +- commands/core/encryption/newkey.php | 20 +- composer.json | 2 +- cron/jobs/SettingsJob.php | 6 +- cron/jobs/cacheJob.php | 4 +- cron/runner.php | 19 +- install/install.php | 74 +++-- install/mysql.php | 30 +- lang/en_US.php | 12 +- migrate/config/1.php | 18 +- migrate/config/2.php | 2 +- migrate/config/3.php | 2 +- public/index.php | 79 +++-- routes/api/system.php | 2 +- routes/views/core.php | 16 +- routes/views/index.php | 8 +- tests/EncryptionTest.php | 21 +- 80 files changed, 1194 insertions(+), 1359 deletions(-) create mode 100755 .php-cs-fixer.dist.php diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1506a63..2dc95f2 100755 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,7 +4,7 @@ on: [push, pull_request] permissions: contents: read - + jobs: lint: name: Lint @@ -25,25 +25,4 @@ jobs: run: composer install --no-interaction --no-progress --no-suggest --prefer-dist - name: PHP CS Fixer (APP) - run: vendor/bin/php-cs-fixer fix app --dry-run - - - name: PHP CS Fixer (Tests) - run: vendor/bin/php-cs-fixer fix tests --dry-run - - name: PHP CS Fixer (Routes) - run: vendor/bin/php-cs-fixer fix routes --dry-run - - name: PHP CS Fixer (Lang) - run: vendor/bin/php-cs-fixer fix lang --dry-run - - name: PHP CS Fixer (Cron) - run: vendor/bin/php-cs-fixer fix lang --dry-run - - name: PHP CS Fixer (API) - run: vendor/bin/php-cs-fixer fix api --dry-run - - name: PHP CS Fixer (Addons) - run: vendor/bin/php-cs-fixer fix addons --dry-run - - name: PHP CS Fixer (Commands) - run: vendor/bin/php-cs-fixer fix commands --dry-run - - name: PHP CS Fixer (Install) - run: vendor/bin/php-cs-fixer fix install --dry-run - - name: PHP CS Fixer (Public) - run: vendor/bin/php-cs-fixer fix public --dry-run - - name: PHP CS Fixer (Migrate) - run: vendor/bin/php-cs-fixer fix migrate --dry-run + run: vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php \ No newline at end of file diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100755 index 0000000..70eff4e --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,69 @@ +in(__DIR__) + ->exclude([ + 'vendor', + 'node_modules', + '.github', + '.vscode', + '.git', + 'docs', + 'caches', + 'devtools', + 'logs', + 'themes', + 'app/Handlers/interfaces' + ]) + ->notName(['_ide_helper*']); + +return (new Config()) + ->setRiskyAllowed(true) + ->setFinder($finder) + ->setRules([ + '@Symfony' => true, + '@PSR1' => true, + '@PSR2' => true, + '@PSR12' => true, + 'align_multiline_comment' => ['comment_type' => 'phpdocs_like'], + 'combine_consecutive_unsets' => true, + 'concat_space' => ['spacing' => 'one'], + 'heredoc_to_nowdoc' => true, + 'no_alias_functions' => true, + 'no_unreachable_default_argument_value' => true, + 'no_useless_return' => true, + 'ordered_imports' => [ + 'sort_algorithm' => 'length', + ], + 'phpdoc_align' => [ + 'align' => 'left', + 'tags' => [ + 'param', + 'property', + 'return', + 'throws', + 'type', + 'var', + ], + ], + 'random_api_migration' => true, + 'ternary_to_null_coalescing' => true, + 'yoda_style' => [ + 'equal' => false, + 'identical' => false, + 'less_and_greater' => false, + ], + ]); \ No newline at end of file diff --git a/addons/Example/Example.php b/addons/Example/Example.php index dc81f57..8c3c66c 100755 --- a/addons/Example/Example.php +++ b/addons/Example/Example.php @@ -1,10 +1,8 @@ Logger::getAllSortedByDate(LoggerTypes::OTHER, LoggerLevels::OTHER, 10) + api::OK('Showing you latest logs', [ + 'logs' => Logger::getAllSortedByDate(LoggerTypes::OTHER, LoggerLevels::OTHER, 10), ]); } diff --git a/api/User/login.php b/api/User/login.php index 14ea07c..b3ff88b 100755 --- a/api/User/login.php +++ b/api/User/login.php @@ -1,12 +1,9 @@ tryConnection($host, $port, $username, $password, $database) == true) { echo self::NewLine(); - echo self::translateColorsCode("&fConnection to the database was &asuccessful!&o"); + echo self::translateColorsCode('&fConnection to the database was &asuccessful!&o'); echo self::NewLine(); - echo self::translateColorsCode("&fSaving the configuration...&o"); - cfg::set("database", "host", $host); - cfg::set("database", "port", $port); - cfg::set("database", "username", $username); - cfg::set("database", "password", $password); - cfg::set("database", "name", $database); - echo self::translateColorsCode("&fConfiguration saved &asuccessfully!&o"); + echo self::translateColorsCode('&fSaving the configuration...&o'); + cfg::set('database', 'host', $host); + cfg::set('database', 'port', $port); + cfg::set('database', 'username', $username); + cfg::set('database', 'password', $password); + cfg::set('database', 'name', $database); + echo self::translateColorsCode('&fConfiguration saved &asuccessfully!&o'); } else { - echo self::translateColorsCode("&7Failed to connect to the database. &o&fPlease check the provided information."); + echo self::translateColorsCode('&7Failed to connect to the database. &o&fPlease check the provided information.'); } - } public static function configure(): void { - } } diff --git a/app/Cli/Commands/Down.php b/app/Cli/Commands/Down.php index 6eeb63e..4ffbd7e 100755 --- a/app/Cli/Commands/Down.php +++ b/app/Cli/Commands/Down.php @@ -10,12 +10,13 @@ class Down extends Command public static function execute(bool $isFrameworkCommand = false): void { - echo self::log_info("Marking the application as down..."); - if (cfg::get('app', 'maintenance') == "true" && cfg::get('app', 'maintenance') != "false") { - echo self::translateColorsCode("&aApplication &ris already in maintenance mode!"); + echo self::log_info('Marking the application as down...'); + if (cfg::get('app', 'maintenance') == 'true' && cfg::get('app', 'maintenance') != 'false') { + echo self::translateColorsCode('&aApplication &ris already in maintenance mode!'); + return; } - cfg::set('app', 'maintenance', "true"); - echo self::log_success("Application is now down!"); + cfg::set('app', 'maintenance', 'true'); + echo self::log_success('Application is now down!'); } } diff --git a/app/Cli/Commands/Help.php b/app/Cli/Commands/Help.php index 959a131..b8af13c 100755 --- a/app/Cli/Commands/Help.php +++ b/app/Cli/Commands/Help.php @@ -8,11 +8,11 @@ class Help extends Command public static function execute(bool $isFrameworkCommand = false): void { - echo self::log_info(""); - echo self::log_info("-----------------------"); - echo self::log_info("| Available commands: |"); - echo self::log_info("-----------------------"); - echo self::log_info(""); + echo self::log_info(''); + echo self::log_info('-----------------------'); + echo self::log_info('| Available commands: |'); + echo self::log_info('-----------------------'); + echo self::log_info(''); $commands = scandir(__DIR__); foreach ($commands as $command) { @@ -30,6 +30,6 @@ public static function execute(bool $isFrameworkCommand = false): void echo self::log_info("{$command} > {$reflectionClass->getProperty('description')->getValue()}"); } - echo self::log_info(""); + echo self::log_info(''); } } diff --git a/app/Cli/Commands/Migrate.php b/app/Cli/Commands/Migrate.php index e73d085..cfc0620 100755 --- a/app/Cli/Commands/Migrate.php +++ b/app/Cli/Commands/Migrate.php @@ -2,7 +2,6 @@ namespace MythicalSystemsFramework\Cli\Commands; -use Exception; use MythicalSystemsFramework\Database\MySQL; use MythicalSystemsFramework\Managers\Settings; @@ -12,47 +11,45 @@ class Migrate extends Command public static function execute(bool $isFrameworkCommand = false): void { - echo self::log_info(""); - echo self::log_info("&c1.&7 Migrate the database"); - echo self::log_info("&c2.&7 Migrate the config"); - echo self::log_info("&c3.&7 Exit"); - echo self::log_info(""); + echo self::log_info(''); + echo self::log_info('&c1.&7 Migrate the database'); + echo self::log_info('&c2.&7 Migrate the config'); + echo self::log_info('&c3.&7 Exit'); + echo self::log_info(''); - $option = readline("Select an option: "); + $option = readline('Select an option: '); switch ($option) { case '1': self::db(); break; case '2': - echo self::translateColorsCode("&cThis option is not available yet!&o"); + echo self::translateColorsCode('&cThis option is not available yet!&o'); break; case '3': self::exit(); break; default: - echo "Invalid option selected."; + echo 'Invalid option selected.'; break; } } - public static function db(): void { try { - self::log_info("Migrating the database..."); - self::log_info(""); + self::log_info('Migrating the database...'); + self::log_info(''); MySQL::migrate(true); Settings::migrate(true); - self::log_success("&rDatabase migrated &asuccessfully&r!"); + self::log_success('&rDatabase migrated &asuccessfully&r!'); self::exit(); - } catch (Exception $e) { - die("Failed to migrate the database: " . $e->getMessage() . ""); + } catch (\Exception $e) { + exit('Failed to migrate the database: ' . $e->getMessage() . ''); } } public static function cfg(): void { - } } diff --git a/app/Cli/Commands/Rebuild.php b/app/Cli/Commands/Rebuild.php index e74ea91..b907d96 100755 --- a/app/Cli/Commands/Rebuild.php +++ b/app/Cli/Commands/Rebuild.php @@ -2,25 +2,23 @@ namespace MythicalSystemsFramework\Cli\Commands; -use Exception; use MythicalSystemsFramework\Database\MySQL; -use MythicalSystemsFramework\Managers\ConfigManager as cfg; use MythicalSystemsFramework\Managers\Settings; -use PDO; -use PDOException; +use MythicalSystemsFramework\Managers\ConfigManager as cfg; class Rebuild extends Command { public static string $description = 'A command that can help if you want to rebuild the app!'; + public static function execute(bool $isFrameworkCommand = false): void { - echo self::log_info(""); - echo self::log_info("&c1.&7 Rebuild the database"); - echo self::log_info("&c2.&7 Rebuild the app"); - echo self::log_info("&c3.&7 Exit"); - echo self::log_info(""); + echo self::log_info(''); + echo self::log_info('&c1.&7 Rebuild the database'); + echo self::log_info('&c2.&7 Rebuild the app'); + echo self::log_info('&c3.&7 Exit'); + echo self::log_info(''); - $option = readline("Select an option: "); + $option = readline('Select an option: '); switch ($option) { case '1': @@ -33,7 +31,7 @@ public static function execute(bool $isFrameworkCommand = false): void self::exit(); break; default: - echo "Invalid option selected."; + echo 'Invalid option selected.'; break; } } @@ -42,15 +40,15 @@ public static function db(): void { try { $db = new MySQL(); - if ($db->tryConnection(cfg::get("database", "host"), cfg::get("database", "port"), cfg::get("database", "username"), cfg::get("database", "password"), cfg::get("database", "name")) == true) { - echo self::translateColorsCode("&o&fConnection to the database was &asuccessful!&o"); + if ($db->tryConnection(cfg::get('database', 'host'), cfg::get('database', 'port'), cfg::get('database', 'username'), cfg::get('database', 'password'), cfg::get('database', 'name')) == true) { + echo self::translateColorsCode('&o&fConnection to the database was &asuccessful!&o'); echo self::NewLine(); - echo self::translateColorsCode("&4&lWARNING: &fThis option will wipe the database. &o"); - echo self::translateColorsCode("&4&lWARNING: &fOnly use this function if you know what you are doing &o"); - echo self::translateColorsCode("&4&lWARNING: &fOnce you wipe the database there is no going back! &o"); + echo self::translateColorsCode('&4&lWARNING: &fThis option will wipe the database. &o'); + echo self::translateColorsCode('&4&lWARNING: &fOnly use this function if you know what you are doing &o'); + echo self::translateColorsCode('&4&lWARNING: &fOnce you wipe the database there is no going back! &o'); echo self::translateColorsCode("&4&lWARNING: &fPlease be careful and don't play around with commands! &o"); - echo self::translateColorsCode("&4&lWARNING: &fThere is no other message then this so keep in mind! &o"); - echo self::translateColorsCode("&4&lWARNING: &fDo you really want to wipe the database? (&ey&f/&en&f): "); + echo self::translateColorsCode('&4&lWARNING: &fThere is no other message then this so keep in mind! &o'); + echo self::translateColorsCode('&4&lWARNING: &fDo you really want to wipe the database? (&ey&f/&en&f): '); $confirm = readline(); if (strtolower($confirm) == 'y') { @@ -58,48 +56,48 @@ public static function db(): void $mysql = new MySQL(); $db = $mysql->connectPDO(); - $db->exec("SET FOREIGN_KEY_CHECKS = 0"); - $tables = $db->query("SHOW TABLES")->fetchAll(PDO::FETCH_COLUMN); + $db->exec('SET FOREIGN_KEY_CHECKS = 0'); + $tables = $db->query('SHOW TABLES')->fetchAll(\PDO::FETCH_COLUMN); foreach ($tables as $table) { $db->exec("DROP TABLE IF EXISTS $table"); } - $db->exec("SET FOREIGN_KEY_CHECKS = 1"); + $db->exec('SET FOREIGN_KEY_CHECKS = 1'); echo self::NewLine(); echo self::NewLine(); echo self::NewLine(); echo self::NewLine(); echo self::NewLine(); - echo self::translateColorsCode("&fDatabase wiped!!&o"); + echo self::translateColorsCode('&fDatabase wiped!!&o'); MySQL::migrate(true); Settings::migrate(true); echo self::NewLine(); - echo self::translateColorsCode("&fDatabase rebuilt!&o"); + echo self::translateColorsCode('&fDatabase rebuilt!&o'); echo self::translateColorsCode("&fLet's start by setting up your configuration!&o"); Configure::configure(); - } catch (PDOException $e) { - echo self::translateColorsCode("&fFailed to drop tables: &c" . $e->getMessage() . "&o"); + } catch (\PDOException $e) { + echo self::translateColorsCode('&fFailed to drop tables: &c' . $e->getMessage() . '&o'); echo self::NewLine(); } } else { - self::exit("&fExiting...&o"); + self::exit('&fExiting...&o'); } } else { - self::exit("&cFailed to connect to the database!&o"); + self::exit('&cFailed to connect to the database!&o'); } - } catch (Exception $e) { - self::exit("&cFailed to rebuild the database: &r" . $e->getMessage() . ""); + } catch (\Exception $e) { + self::exit('&cFailed to rebuild the database: &r' . $e->getMessage() . ''); } } public static function app(): void { try { - self::log_info("Rebuilding the app..."); - self::log_info(""); - self::log_success("&rApp rebuilt &asuccessfully&r!"); + self::log_info('Rebuilding the app...'); + self::log_info(''); + self::log_success('&rApp rebuilt &asuccessfully&r!'); self::exit(); - } catch (Exception $e) { - die("Failed to rebuild the app: " . $e->getMessage() . ""); + } catch (\Exception $e) { + exit('Failed to rebuild the app: ' . $e->getMessage() . ''); } } } diff --git a/app/Cli/Commands/Up.php b/app/Cli/Commands/Up.php index c2c93af..bd64b21 100755 --- a/app/Cli/Commands/Up.php +++ b/app/Cli/Commands/Up.php @@ -10,12 +10,13 @@ class Up extends Command public static function execute(bool $isFrameworkCommand = false): void { - echo self::log_info("&rMarking the application as up..."); - if (cfg::get('app', 'maintenance') == "false" && cfg::get('app', 'maintenance') != "true") { - echo self::translateColorsCode("&aApplication &ris already up!"); + echo self::log_info('&rMarking the application as up...'); + if (cfg::get('app', 'maintenance') == 'false' && cfg::get('app', 'maintenance') != 'true') { + echo self::translateColorsCode('&aApplication &ris already up!'); + return; } - cfg::set('app', 'maintenance', "false"); - echo self::log_success("Application is now &aup&r!"); + cfg::set('app', 'maintenance', 'false'); + echo self::log_success('Application is now &aup&r!'); } } diff --git a/app/Cli/Kernel.php b/app/Cli/Kernel.php index e0c5724..200f550 100755 --- a/app/Cli/Kernel.php +++ b/app/Cli/Kernel.php @@ -2,19 +2,15 @@ namespace MythicalSystemsFramework\Cli; -use Exception; -use ReflectionClass; - class Kernel extends Colors { /** * Executes the framework command with the specified command name. * - * @param string $commandName The name of the command to execute. + * @param string $commandName the name of the command to execute * - * @return void - * @throws Exception If the command file cannot be found, the command class does not exist, - * or the command class does not have 'name' or 'description' properties. + * @throws \Exception if the command file cannot be found, the command class does not exist, + * or the command class does not have 'name' or 'description' properties */ public static function executeFrameworkCommand(string $commandName): void { @@ -22,7 +18,7 @@ public static function executeFrameworkCommand(string $commandName): void $commandFile = __DIR__ . "/Commands/$commandName.php"; if (!file_exists($commandFile)) { - throw new Exception("Command not found!"); + throw new \Exception('Command not found!'); } require_once $commandFile; @@ -30,24 +26,22 @@ public static function executeFrameworkCommand(string $commandName): void $commandClass = "MythicalSystemsFramework\\Cli\\Commands\\$commandName"; if (!class_exists($commandClass)) { - throw new Exception("Command not found!"); + throw new \Exception('Command not found!'); } - $reflectionClass = new ReflectionClass($commandClass); + $reflectionClass = new \ReflectionClass($commandClass); if (!$reflectionClass->hasProperty('description')) { - throw new Exception("Command class '$commandClass' does not have 'name' or 'description' properties."); + throw new \Exception("Command class '$commandClass' does not have 'name' or 'description' properties."); } $commandClass::execute(true); - } + /** * Exit the CLI application. * - * @param string $message The message to display before exiting. - * - * @return void + * @param string $message the message to display before exiting */ public static function exit(string $message = '&7Application exited &asuccessfully&7!'): void { diff --git a/app/Database/MySQL.php b/app/Database/MySQL.php index ecee282..59630d4 100755 --- a/app/Database/MySQL.php +++ b/app/Database/MySQL.php @@ -2,60 +2,58 @@ namespace MythicalSystemsFramework\Database; +use PDO; +use mysqli; use MythicalSystemsFramework\Cli\Kernel; -use MythicalSystemsFramework\Database\exception\database\MySQLError; -use MythicalSystemsFramework\Database\exception\migration\NoMigrationsFound; -use MythicalSystemsFramework\Managers\ConfigManager as cfg; use MythicalSystemsFramework\Kernel\Logger; -use MythicalSystemsFramework\Kernel\LoggerLevels; use MythicalSystemsFramework\Kernel\LoggerTypes; -use PDO; -use PDOException; -use mysqli; -use Exception; +use MythicalSystemsFramework\Kernel\LoggerLevels; +use MythicalSystemsFramework\Managers\ConfigManager as cfg; +use MythicalSystemsFramework\Database\exception\database\MySQLError; +use MythicalSystemsFramework\Database\exception\migration\NoMigrationsFound; class MySQL { private static $connection; public static int $migrated_files_count; + /** * Connects to the database server using PDO. * - * @return PDO The PDO object representing the database connection. - * @throws PDOException If the connection to the database fails. + * @return \PDO the PDO object representing the database connection + * + * @throws \PDOException if the connection to the database fails */ - public function connectPDO(): PDO + public function connectPDO(): \PDO { - - $dsn = "mysql:host=" . cfg::get("database", "host") . ";dbname=" . cfg::get("database", "name") . ";port=" . cfg::get("database", "port") . ";charset=utf8mb4"; + $dsn = 'mysql:host=' . cfg::get('database', 'host') . ';dbname=' . cfg::get('database', 'name') . ';port=' . cfg::get('database', 'port') . ';charset=utf8mb4'; try { - $pdo = new PDO($dsn, cfg::get("database", "username"), cfg::get("database", "password")); - $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $pdo = new \PDO($dsn, cfg::get('database', 'username'), cfg::get('database', 'password')); + $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); + return $pdo; - } catch (PDOException $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "Failed to connect to the database!"); - throw new PDOException("Failed to connect to the database: " . $e->getMessage()); + } catch (\PDOException $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, 'Failed to connect to the database!'); + throw new \PDOException('Failed to connect to the database: ' . $e->getMessage()); } } /** * Connects to the database server using MYSQLI. - * - * @return mysqli */ - public function connectMYSQLI(): mysqli + public function connectMYSQLI(): \mysqli { if (!isset(self::$connection)) { - self::$connection = new mysqli( - cfg::get("database", "host"), - cfg::get("database", "username"), - cfg::get("database", "password"), - cfg::get("database", "name"), - cfg::get("database", "port") + self::$connection = new \mysqli( + cfg::get('database', 'host'), + cfg::get('database', 'username'), + cfg::get('database', 'password'), + cfg::get('database', 'name'), + cfg::get('database', 'port') ); if (self::$connection->connect_error) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "Failed to connect to the database!"); + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, 'Failed to connect to the database!'); } } @@ -63,9 +61,7 @@ public function connectMYSQLI(): mysqli } /** - * Close a database connection if open - * - * @return void + * Close a database connection if open. */ public static function closeConnection(): void { @@ -84,18 +80,21 @@ public static function closeConnection(): void * @param string $password The password * @param string $database The database name * - * @return bool True if the connection is successful, false otherwise. - * @throws PDOException If the connection to the database fails. * + * @return bool true if the connection is successful, false otherwise + * + * @throws \PDOException If the connection to the database fails. * */ public function tryConnection(string $host, string|int $port, string $username, string $password, string $database): bool { try { - $dsn = "mysql:host=" . $host . ";dbname=" . $database . ";port=" . $port . ";charset=utf8mb4"; - $pdo = new PDO($dsn, $username, $password); - $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + $dsn = 'mysql:host=' . $host . ';dbname=' . $database . ';port=' . $port . ';charset=utf8mb4'; + $pdo = new \PDO($dsn, $username, $password); + $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); + return true; - } catch (PDOException $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "Failed to execute PDO query: " . $e); + } catch (\PDOException $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, 'Failed to execute PDO query: ' . $e); + return false; } } @@ -105,8 +104,6 @@ public function tryConnection(string $host, string|int $port, string $username, * * @param string $table The table name! * @param string $id The record id! - * - * @return void */ public function requestLock(string $table, string $id): void { @@ -117,22 +114,22 @@ public function requestLock(string $table, string $id): void $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); $stmt = $conn->prepare("UPDATE ? SET `locked` = 'true' WHERE `id` = ?;"); - $stmt->bind_param("si", $table, $id); + $stmt->bind_param('si', $table, $id); $stmt->execute(); $stmt->close(); - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "Failed to lock table: " . $e); + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, 'Failed to lock table: ' . $e); + return; } } + /** * Try to unlock a record. * Unlock a record so you can write and read it! * * @param string $table The table name! * @param string $id The id of the record! - * - * @return void */ public static function requestUnLock(string $table, string $id): void { @@ -143,21 +140,21 @@ public static function requestUnLock(string $table, string $id): void $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); $stmt = $conn->prepare("UPDATE ? SET `locked` = 'false' WHERE `id` = ?;"); - $stmt->bind_param("si", $table, $id); + $stmt->bind_param('si', $table, $id); $stmt->execute(); $stmt->close(); - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "Failed to unlock table: " . $e); + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, 'Failed to unlock table: ' . $e); + return; } } + /** * Get the lock status of a record. * * @param string $table The table name * @param string $id The id of the record - * - * @return bool */ public static function getLock(string $table, string $id): bool { @@ -167,42 +164,45 @@ public static function getLock(string $table, string $id): bool } $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("SELECT `locked` FROM ? WHERE `id` = ?;"); - $stmt->bind_param("si", $table, $id); + $stmt = $conn->prepare('SELECT `locked` FROM ? WHERE `id` = ?;'); + $stmt->bind_param('si', $table, $id); $stmt->execute(); $stmt->close(); - return $stmt->get_result()->fetch_assoc()["locked"]; - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "Failed to get lock status: " . $e); + + return $stmt->get_result()->fetch_assoc()['locked']; + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, 'Failed to get lock status: ' . $e); + return false; } } + /** * Does a table exist in the database? * * @param string $table The table name - * - * @return bool */ public static function doesTableExist(string $table): bool { try { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $conn->query("SELECT * FROM " . mysqli_real_escape_string($conn, $table)); + $conn->query('SELECT * FROM ' . mysqli_real_escape_string($conn, $table)); + return true; - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "Failed to check if table exists: " . $e); + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, 'Failed to check if table exists: ' . $e); + return false; } } + /** * Does a record exist in the database? * * @param string $table Table name * @param string $search The term you want to search for (id) * @param string $term What the value should be (1) - * @return bool */ public static function doesRecordExist(string $table, string $search, string $term): bool { @@ -212,36 +212,35 @@ public static function doesRecordExist(string $table, string $search, string $te } $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("SELECT * FROM ? WHERE ? = ?;"); - $stmt->bind_param("sss", $table, $search, $term); + $stmt = $conn->prepare('SELECT * FROM ? WHERE ? = ?;'); + $stmt->bind_param('sss', $table, $search, $term); $stmt->execute(); $stmt->close(); + return true; - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "Failed to check if record exists: " . $e); + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, 'Failed to check if record exists: ' . $e); + return false; } } /** * Migrate the database. - * - * @return void */ public static function migrate(bool $isCli = false): void { try { - $mysql = new MySQL(); $db = $mysql->connectPDO(); - $db->exec(" + $db->exec(' CREATE TABLE IF NOT EXISTS framework_migrations ( id INT AUTO_INCREMENT PRIMARY KEY, script VARCHAR(255) NOT NULL, executed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ) - "); + '); $sqlFiles = glob(__DIR__ . '/../../migrate/database/*.sql'); @@ -249,6 +248,7 @@ public static function migrate(bool $isCli = false): void usort($sqlFiles, function ($a, $b) { $aDate = intval(basename($a, '.sql')); $bDate = intval(basename($b, '.sql')); + return $aDate - $bDate; }); @@ -257,40 +257,40 @@ public static function migrate(bool $isCli = false): void $fileName = basename($sqlFile); // Get only the file name - $stmt = $db->prepare("SELECT COUNT(*) FROM framework_migrations WHERE script = ?"); + $stmt = $db->prepare('SELECT COUNT(*) FROM framework_migrations WHERE script = ?'); $stmt->execute([$fileName]); $count = $stmt->fetchColumn(); if ($count == 0) { $db->exec($script); - $stmt = $db->prepare("INSERT INTO framework_migrations (script) VALUES (?)"); + $stmt = $db->prepare('INSERT INTO framework_migrations (script) VALUES (?)'); $stmt->execute([$fileName]); if ($isCli == true) { - echo Kernel::translateColorsCode("&fExecuted migration: &e" . $fileName . "&o"); + echo Kernel::translateColorsCode('&fExecuted migration: &e' . $fileName . '&o'); echo Kernel::NewLine(); } } else { if ($isCli == true) { - echo Kernel::translateColorsCode("&fSkipping migration: &e" . $fileName . " &f(&ealready executed&f)&o"); + echo Kernel::translateColorsCode('&fSkipping migration: &e' . $fileName . ' &f(&ealready executed&f)&o'); echo Kernel::NewLine(); } } } } else { if ($isCli == true) { - echo Kernel::translateColorsCode("&cNo migrations found!&o"); + echo Kernel::translateColorsCode('&cNo migrations found!&o'); echo Kernel::NewLine(); } else { throw new NoMigrationsFound(); } } - } catch (PDOException $e) { + } catch (\PDOException $e) { if ($isCli == true) { - echo Kernel::translateColorsCode("&cFailed to migrate the database: " . $e->getMessage() . "&o"); + echo Kernel::translateColorsCode('&cFailed to migrate the database: ' . $e->getMessage() . '&o'); echo Kernel::NewLine(); } else { - throw new MySQLError("Failed to migrate the database: " . $e->getMessage()); + throw new MySQLError('Failed to migrate the database: ' . $e->getMessage()); } } } diff --git a/app/Database/MySQLCache.php b/app/Database/MySQLCache.php index aac2c35..e2816b9 100755 --- a/app/Database/MySQLCache.php +++ b/app/Database/MySQLCache.php @@ -2,8 +2,6 @@ namespace MythicalSystemsFramework\Database; -use Exception; -use MythicalSystems\Api\Api; use MythicalSystemsFramework\Managers\Settings; class MySQLCache extends MySQL @@ -12,28 +10,28 @@ public static function saveCache(string $table_name): void { try { if (self::doesTableExist($table_name) == false) { - throw new Exception("Table does not exist."); + throw new \Exception('Table does not exist.'); } $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $query = "SELECT * FROM " . mysqli_real_escape_string($conn, $table_name); + $query = 'SELECT * FROM ' . mysqli_real_escape_string($conn, $table_name); $result = $conn->query($query); if ($result->num_rows == 0) { - throw new Exception("No data found."); + throw new \Exception('No data found.'); } - /** + /* * Specific table dump settings! * * @requires framework_settings */ - if ($table_name == "framework_settings") { + if ($table_name == 'framework_settings') { /** * Code to export the settings file in a format that MythicalSystemsFramework\Managers\Settings can read! */ - $query = "SELECT scategory FROM " . mysqli_real_escape_string($conn, $table_name); + $query = 'SELECT scategory FROM ' . mysqli_real_escape_string($conn, $table_name); $result = $conn->query($query); if ($result->num_rows > 0) { @@ -50,7 +48,7 @@ public static function saveCache(string $table_name): void if ($category !== 0) { $data[$category] = []; - $query = "SELECT skey, svalue FROM " . mysqli_real_escape_string($conn, $table_name) . " WHERE scategory = '" . mysqli_real_escape_string($conn, $category) . "'"; + $query = 'SELECT skey, svalue FROM ' . mysqli_real_escape_string($conn, $table_name) . " WHERE scategory = '" . mysqli_real_escape_string($conn, $category) . "'"; $result = $conn->query($query); if ($result->num_rows > 0) { @@ -62,24 +60,22 @@ public static function saveCache(string $table_name): void } } } - - } elseif ($table_name == "framework_users") { - + } elseif ($table_name == 'framework_users') { } else { - throw new Exception("Table not supported."); + throw new \Exception('Table not supported.'); } - $cache_info["cache_info"] = [ - "table" => $table_name, - "date_created" => date("Y-m-d H:i:s"), - "date_expire" => date("Y-m-d H:i:s", strtotime("+".$data["caches"]["settings_cache_life"]." seconds")), + $cache_info['cache_info'] = [ + 'table' => $table_name, + 'date_created' => date('Y-m-d H:i:s'), + 'date_expire' => date('Y-m-d H:i:s', strtotime('+' . $data['caches']['settings_cache_life'] . ' seconds')), ]; $data = array_merge($cache_info, $data); $json = json_encode($data, JSON_PRETTY_PRINT); Settings::up(); file_put_contents(Settings::$cache_path . '/' . $table_name . '.json', $json); - } catch (Exception $e) { - throw new Exception("Failed to save cache: " . $e); + } catch (\Exception $e) { + throw new \Exception('Failed to save cache: ' . $e); } } diff --git a/app/Database/Redis/Redis.php b/app/Database/Redis/Redis.php index 59c5082..57545f8 100755 --- a/app/Database/Redis/Redis.php +++ b/app/Database/Redis/Redis.php @@ -6,7 +6,5 @@ class Redis { public static function getConnection() { - - } } diff --git a/app/Database/exception/database/MySQLError.php b/app/Database/exception/database/MySQLError.php index 17213bd..cada530 100755 --- a/app/Database/exception/database/MySQLError.php +++ b/app/Database/exception/database/MySQLError.php @@ -2,12 +2,9 @@ namespace MythicalSystemsFramework\Database\exception\database; -use Exception; -use Throwable; - -class MySQLError extends Exception +class MySQLError extends \Exception { - public function __construct($message = "MySQL Error.", $code = 0, Exception $previous = null) + public function __construct($message = 'MySQL Error.', $code = 0, ?\Exception $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/app/Database/exception/migration/NoMigrationsFound.php b/app/Database/exception/migration/NoMigrationsFound.php index cc79bca..773781c 100755 --- a/app/Database/exception/migration/NoMigrationsFound.php +++ b/app/Database/exception/migration/NoMigrationsFound.php @@ -2,12 +2,9 @@ namespace MythicalSystemsFramework\Database\exception\migration; -use Exception; -use Throwable; - -class NoMigrationsFound extends Exception +class NoMigrationsFound extends \Exception { - public function __construct($message = "No migration not found.", $code = 0, Exception $previous = null) + public function __construct($message = 'No migration not found.', $code = 0, ?\Exception $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/app/Handlers/ActivityHandler.php b/app/Handlers/ActivityHandler.php index 695045c..57492c8 100755 --- a/app/Handlers/ActivityHandler.php +++ b/app/Handlers/ActivityHandler.php @@ -9,11 +9,11 @@ class ActivityHandler /** * Adds a new activity to the database. * - * @param string $userId The user ID. - * @param string $username The username. - * @param string $description The activity description. - * @param string $ipv4 The user ip. - * @param string $action The action. + * @param string $userId the user ID + * @param string $username the username + * @param string $description the activity description + * @param string $ipv4 the user ip + * @param string $action the action */ public static function addActivity(string $userId, string $username, string $description, string $ipv4, string $action): void { @@ -22,8 +22,8 @@ public static function addActivity(string $userId, string $username, string $des $time = date('Y-m-d H:i:s'); - $stmt = $conn->prepare("INSERT INTO framework_users_activities (user_id, username, description, action, ip_address, date) VALUES (?, ?, ?, ?, ?, ?)"); - $stmt->bind_param("ssssss", $userId, $username, $description, $action, $ipv4, $time); + $stmt = $conn->prepare('INSERT INTO framework_users_activities (user_id, username, description, action, ip_address, date) VALUES (?, ?, ?, ?, ?, ?)'); + $stmt->bind_param('ssssss', $userId, $username, $description, $action, $ipv4, $time); $stmt->execute(); $stmt->close(); } @@ -31,15 +31,15 @@ public static function addActivity(string $userId, string $username, string $des /** * Removes all activities for a specific user. * - * @param string $userId The user ID. + * @param string $userId the user ID */ public static function removeUserActivities(string $userId): void { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("DELETE FROM framework_users_activities WHERE user_id = ?"); - $stmt->bind_param("s", $userId); + $stmt = $conn->prepare('DELETE FROM framework_users_activities WHERE user_id = ?'); + $stmt->bind_param('s', $userId); $stmt->execute(); $stmt->close(); } @@ -52,27 +52,28 @@ public static function removeAllActivities(): void $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $conn->query("TRUNCATE TABLE framework_users_activities"); + $conn->query('TRUNCATE TABLE framework_users_activities'); } /** * Gets activities for a specific user. * - * @param string $userId The user ID. + * @param string $userId the user ID * - * @return array The activities for the specified user. + * @return array the activities for the specified user */ public static function getActivities(string $userId): array { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("SELECT * FROM framework_users_activities WHERE user_id = ?"); - $stmt->bind_param("s", $userId); + $stmt = $conn->prepare('SELECT * FROM framework_users_activities WHERE user_id = ?'); + $stmt->bind_param('s', $userId); $stmt->execute(); $result = $stmt->get_result(); $activities = $result->fetch_all(MYSQLI_ASSOC); $stmt->close(); + return $activities; } } diff --git a/app/Handlers/AnnouncementHandler.php b/app/Handlers/AnnouncementHandler.php index 7defb14..b54bc9d 100755 --- a/app/Handlers/AnnouncementHandler.php +++ b/app/Handlers/AnnouncementHandler.php @@ -2,22 +2,17 @@ namespace MythicalSystemsFramework\Handlers; -use MythicalSystemsFramework\Database\MySQL; -use Exception; -use MythicalSystemsFramework\Handlers\exception\AnnouncementNotFoundException; -use MythicalSystemsFramework\Handlers\interfaces\AnnouncementSocial; use MythicalSystemsFramework\Kernel\Logger; +use MythicalSystemsFramework\Database\MySQL; use MythicalSystemsFramework\Kernel\LoggerTypes; use MythicalSystemsFramework\Kernel\LoggerLevels; +use MythicalSystemsFramework\Handlers\interfaces\AnnouncementSocial; +use MythicalSystemsFramework\Handlers\exception\AnnouncementNotFoundException; class AnnouncementHandler implements AnnouncementSocial { /** * Does an announcement exist? - * - * @param int $id - * - * @return bool */ public static function exists(int $id): bool { @@ -25,15 +20,15 @@ public static function exists(int $id): bool $mysql = new MySQL(); $conn = $mysql->connectMYSQLI(); - $stmt = $conn->prepare("SELECT * FROM framework_announcements WHERE id = ?"); - $stmt->bind_param("i", $id); + $stmt = $conn->prepare('SELECT * FROM framework_announcements WHERE id = ?'); + $stmt->bind_param('i', $id); $stmt->execute(); $stmt->close(); - return $stmt->affected_rows > 0; - } catch (Exception $e) { - /** + return $stmt->affected_rows > 0; + } catch (\Exception $e) { + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -41,7 +36,8 @@ public static function exists(int $id): bool * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, "An error occurred while checking if an announcement exists: " . $e->getMessage()); + Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, 'An error occurred while checking if an announcement exists: ' . $e->getMessage()); + return false; } } @@ -49,10 +45,7 @@ public static function exists(int $id): bool /** * Create a new announcement. * - * @param string $title - * @param string $text - * - * @return int The ID of the created announcement. + * @return int the ID of the created announcement */ public static function create(string $title, string $text): int { @@ -60,14 +53,15 @@ public static function create(string $title, string $text): int $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("INSERT INTO framework_announcements (title, text, date) VALUES (?, ?, NOW())"); - $stmt->bind_param("ss", $title, $text); + $stmt = $conn->prepare('INSERT INTO framework_announcements (title, text, date) VALUES (?, ?, NOW())'); + $stmt->bind_param('ss', $title, $text); $stmt->execute(); $announcementID = $stmt->insert_id; $stmt->close(); + return $announcementID; - } catch (Exception $e) { - /** + } catch (\Exception $e) { + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -75,25 +69,20 @@ public static function create(string $title, string $text): int * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, "An error occurred while creating an announcement: " . $e->getMessage()); + Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, 'An error occurred while creating an announcement: ' . $e->getMessage()); + return -1; } } /** * Edit an existing announcement by ID. - * - * @param int $id - * @param string $title - * @param string $text - * - * @return void */ public static function edit(int $id, string $title, string $text): void { try { if (!self::exists($id)) { - /** + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -101,18 +90,18 @@ public static function edit(int $id, string $title, string $text): void * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::WARNING, LoggerTypes::OTHER, "An error occurred while editing an announcement: Announcement not found."); + Logger::log(LoggerLevels::WARNING, LoggerTypes::OTHER, 'An error occurred while editing an announcement: Announcement not found.'); throw new AnnouncementNotFoundException(); } $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("UPDATE framework_announcements SET title = ?, text = ? WHERE id = ?"); - $stmt->bind_param("ssi", $title, $text, $id); + $stmt = $conn->prepare('UPDATE framework_announcements SET title = ?, text = ? WHERE id = ?'); + $stmt->bind_param('ssi', $title, $text, $id); $stmt->execute(); $stmt->close(); - } catch (Exception $e) { - /** + } catch (\Exception $e) { + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -120,22 +109,19 @@ public static function edit(int $id, string $title, string $text): void * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, "An error occurred while editing an announcement: " . $e->getMessage()); - throw new Exception("", $e->getCode(), $e); + Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, 'An error occurred while editing an announcement: ' . $e->getMessage()); + throw new \Exception('', $e->getCode(), $e); } } /** * Delete an announcement by ID. - * - * @param int $id - * @return void */ public static function delete(int $id): void { try { if (!self::exists($id)) { - /** + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -143,18 +129,18 @@ public static function delete(int $id): void * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::WARNING, LoggerTypes::OTHER, "An error occurred while deleting an announcement: Announcement not found."); + Logger::log(LoggerLevels::WARNING, LoggerTypes::OTHER, 'An error occurred while deleting an announcement: Announcement not found.'); throw new AnnouncementNotFoundException(); } $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("DELETE FROM framework_announcements WHERE id = ?"); - $stmt->bind_param("i", $id); + $stmt = $conn->prepare('DELETE FROM framework_announcements WHERE id = ?'); + $stmt->bind_param('i', $id); $stmt->execute(); $stmt->close(); - } catch (Exception $e) { - /** + } catch (\Exception $e) { + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -162,15 +148,13 @@ public static function delete(int $id): void * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, "An error occurred while deleting an announcement: " . $e->getMessage()); - throw new Exception("", $e->getCode(), $e); + Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, 'An error occurred while deleting an announcement: ' . $e->getMessage()); + throw new \Exception('', $e->getCode(), $e); } } /** * Delete all framework_announcements. - * - * @return void */ public static function deleteAll(): void { @@ -178,9 +162,9 @@ public static function deleteAll(): void $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $conn->query("TRUNCATE TABLE framework_announcements"); - } catch (Exception $e) { - /** + $conn->query('TRUNCATE TABLE framework_announcements'); + } catch (\Exception $e) { + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -188,22 +172,19 @@ public static function deleteAll(): void * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, "An error occurred while deleting all announcements: " . $e->getMessage()); - throw new Exception("", $e->getCode(), $e); + Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, 'An error occurred while deleting all announcements: ' . $e->getMessage()); + throw new \Exception('', $e->getCode(), $e); } } /** * Get a single announcement by ID. - * - * @param int $id - * @return array|null */ public static function getOne(int $id): ?array { try { if (!self::exists($id)) { - /** + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -211,21 +192,23 @@ public static function getOne(int $id): ?array * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::WARNING, LoggerTypes::OTHER, "An error occurred while getting an announcement: Announcement not found."); + Logger::log(LoggerLevels::WARNING, LoggerTypes::OTHER, 'An error occurred while getting an announcement: Announcement not found.'); + return []; } $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("SELECT * FROM framework_announcements WHERE id = ?"); - $stmt->bind_param("i", $id); + $stmt = $conn->prepare('SELECT * FROM framework_announcements WHERE id = ?'); + $stmt->bind_param('i', $id); $stmt->execute(); $result = $stmt->get_result(); $announcement = $result->fetch_assoc(); $stmt->close(); + return $announcement ? $announcement : null; - } catch (Exception $e) { - /** + } catch (\Exception $e) { + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -233,28 +216,27 @@ public static function getOne(int $id): ?array * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, "An error occurred while getting an announcement: " . $e->getMessage()); + Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, 'An error occurred while getting an announcement: ' . $e->getMessage()); + return []; } } /** * Get all framework_announcements. - * - * @return array */ public static function getAll(): array { try { - $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $result = $conn->query("SELECT * FROM framework_announcements"); + $result = $conn->query('SELECT * FROM framework_announcements'); $framework_announcements = $result->fetch_all(MYSQLI_ASSOC); + return $framework_announcements; - } catch (Exception $e) { - /** + } catch (\Exception $e) { + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -262,15 +244,14 @@ public static function getAll(): array * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, "An error occurred while getting all announcements: " . $e->getMessage()); + Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, 'An error occurred while getting all announcements: ' . $e->getMessage()); + return []; } } /** * Get all framework_announcements sorted by ID in descending order. - * - * @return array */ public static function getAllSortedById(): array { @@ -278,11 +259,12 @@ public static function getAllSortedById(): array $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $result = $conn->query("SELECT * FROM framework_announcements ORDER BY id DESC"); + $result = $conn->query('SELECT * FROM framework_announcements ORDER BY id DESC'); $framework_announcements = $result->fetch_all(MYSQLI_ASSOC); + return $framework_announcements; - } catch (Exception $e) { - /** + } catch (\Exception $e) { + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -290,15 +272,14 @@ public static function getAllSortedById(): array * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, "An error occurred while getting all announcements sorted by ID: " . $e->getMessage()); + Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, 'An error occurred while getting all announcements sorted by ID: ' . $e->getMessage()); + return []; } } /** * Get all framework_announcements sorted by date in descending order. - * - * @return array */ public static function getAllSortedByDate(): array { @@ -306,11 +287,12 @@ public static function getAllSortedByDate(): array $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $result = $conn->query("SELECT * FROM framework_announcements ORDER BY date DESC"); + $result = $conn->query('SELECT * FROM framework_announcements ORDER BY date DESC'); $framework_announcements = $result->fetch_all(MYSQLI_ASSOC); + return $framework_announcements; - } catch (Exception $e) { - /** + } catch (\Exception $e) { + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -318,25 +300,22 @@ public static function getAllSortedByDate(): array * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, "An error occurred while getting all announcements sorted by date: " . $e->getMessage()); + Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, 'An error occurred while getting all announcements sorted by date: ' . $e->getMessage()); + return []; } } + /** - * Summary of addSocialInteraction - * - * @param string $announcement_id - * @param string $user_uuid - * @param \MythicalSystemsFramework\Handlers\interfaces\AnnouncementSocial $type + * Summary of addSocialInteraction. * * @throws \Exception - * @return void */ public static function addSocialInteraction(string $announcement_id, string $user_uuid, AnnouncementSocial $type): void { try { if (!self::exists($announcement_id)) { - /** + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -344,17 +323,17 @@ public static function addSocialInteraction(string $announcement_id, string $use * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::WARNING, LoggerTypes::OTHER, "An error occurred while adding a social interaction to an announcement: Announcement not found."); + Logger::log(LoggerLevels::WARNING, LoggerTypes::OTHER, 'An error occurred while adding a social interaction to an announcement: Announcement not found.'); throw new AnnouncementNotFoundException(); } $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("INSERT INTO framework_announcements_social (announcement_id, user_uuid, type) VALUES (?, ?, ?)"); - $stmt->bind_param("iss", $announcement_id, $user_uuid, $type); + $stmt = $conn->prepare('INSERT INTO framework_announcements_social (announcement_id, user_uuid, type) VALUES (?, ?, ?)'); + $stmt->bind_param('iss', $announcement_id, $user_uuid, $type); $stmt->execute(); $stmt->close(); - } catch (Exception $e) { - /** + } catch (\Exception $e) { + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -362,26 +341,21 @@ public static function addSocialInteraction(string $announcement_id, string $use * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, "An error occurred while adding a social interaction to an announcement: " . $e->getMessage()); - throw new Exception('' . $e->getMessage()); + Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, 'An error occurred while adding a social interaction to an announcement: ' . $e->getMessage()); + throw new \Exception('' . $e->getMessage()); } } + /** - * Summary of removeSocialInteraction - * - * @param string $announcement_id - * @param string $user_uuid - * @param \MythicalSystemsFramework\Handlers\interfaces\AnnouncementSocial $type + * Summary of removeSocialInteraction. * * @throws \Exception - * @return void */ public static function removeSocialInteraction(string $announcement_id, string $user_uuid, AnnouncementSocial $type): void { - try { if (!self::exists($announcement_id)) { - /** + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -389,17 +363,17 @@ public static function removeSocialInteraction(string $announcement_id, string $ * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::WARNING, LoggerTypes::OTHER, "An error occurred while removing a social interaction from an announcement: Announcement not found."); + Logger::log(LoggerLevels::WARNING, LoggerTypes::OTHER, 'An error occurred while removing a social interaction from an announcement: Announcement not found.'); throw new AnnouncementNotFoundException(); } $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("DELETE FROM framework_announcements_social WHERE announcement_id = ? AND user_uuid = ? AND type = ?"); - $stmt->bind_param("iss", $announcement_id, $user_uuid, $type); + $stmt = $conn->prepare('DELETE FROM framework_announcements_social WHERE announcement_id = ? AND user_uuid = ? AND type = ?'); + $stmt->bind_param('iss', $announcement_id, $user_uuid, $type); $stmt->execute(); $stmt->close(); - } catch (Exception $e) { - /** + } catch (\Exception $e) { + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -407,24 +381,19 @@ public static function removeSocialInteraction(string $announcement_id, string $ * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, "An error occurred while removing a social interaction from an announcement: " . $e->getMessage()); - throw new Exception('' . $e->getMessage()); + Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, 'An error occurred while removing a social interaction from an announcement: ' . $e->getMessage()); + throw new \Exception('' . $e->getMessage()); } } + /** - * Summary of getSocialInteraction - * - * @param string $announcement_id - * @param string $user_uuid - * @param string $type - * - * @return bool + * Summary of getSocialInteraction. */ public static function getSocialInteraction(string $announcement_id, string $user_uuid, string $type): bool { try { if (!self::exists($announcement_id)) { - /** + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -432,7 +401,8 @@ public static function getSocialInteraction(string $announcement_id, string $use * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::WARNING, LoggerTypes::OTHER, "An error occurred while getting a social interaction from an announcement: Announcement not found."); + Logger::log(LoggerLevels::WARNING, LoggerTypes::OTHER, 'An error occurred while getting a social interaction from an announcement: Announcement not found.'); + return false; } $mysqli = new MySQL(); @@ -448,9 +418,8 @@ public static function getSocialInteraction(string $announcement_id, string $use } else { return false; } - - } catch (Exception $e) { - /** + } catch (\Exception $e) { + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -458,23 +427,20 @@ public static function getSocialInteraction(string $announcement_id, string $use * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, "An error occurred while getting a social interaction from an announcement: " . $e->getMessage()); + Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, 'An error occurred while getting a social interaction from an announcement: ' . $e->getMessage()); + return false; } } + /** - * Summary of getTotalSocialInteractions - * - * @param string $announcement_id - * @param string $type - * - * @return int + * Summary of getTotalSocialInteractions. */ public static function getTotalSocialInteractions(string $announcement_id, string $type): int { try { if (!self::exists($announcement_id)) { - /** + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -482,7 +448,8 @@ public static function getTotalSocialInteractions(string $announcement_id, strin * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::WARNING, LoggerTypes::OTHER, "An error occurred while getting the total social interactions from an announcement: Announcement not found."); + Logger::log(LoggerLevels::WARNING, LoggerTypes::OTHER, 'An error occurred while getting the total social interactions from an announcement: Announcement not found.'); + return 0; } $mysqli = new MySQL(); @@ -497,8 +464,8 @@ public static function getTotalSocialInteractions(string $announcement_id, strin } else { return 0; } - } catch (Exception $e) { - /** + } catch (\Exception $e) { + /* * Logger * * Logs something: LEVEL, TYPE, MESSAGE @@ -506,9 +473,9 @@ public static function getTotalSocialInteractions(string $announcement_id, strin * LEVELS: INFO, WARNING, ERROR, CRITICAL, OTHER * TYPE: OTHER, CORE, DATABASE, PLUGIN, LOG, OTHER */ - Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, "An error occurred while getting the total social interactions from an announcement: " . $e->getMessage()); + Logger::log(LoggerLevels::ERROR, LoggerTypes::OTHER, 'An error occurred while getting the total social interactions from an announcement: ' . $e->getMessage()); + return 0; } } - } diff --git a/app/Handlers/CacheHandler.php b/app/Handlers/CacheHandler.php index 40e185c..00fa469 100755 --- a/app/Handlers/CacheHandler.php +++ b/app/Handlers/CacheHandler.php @@ -7,25 +7,23 @@ class CacheHandler { public static $cache_file = __DIR__ . '/../../caches/cache.json'; + /** - * Create the cache file - * - * @return void + * Create the cache file. */ public static function createFile(): void { if (!file_exists(self::$cache_file)) { - file_put_contents(self::$cache_file, "{}"); + file_put_contents(self::$cache_file, '{}'); } } /** * Set a value in the cache with a specified expiration time in seconds. * - * @param string $key The key to store the value under. - * @param mixed $value The value to store in the cache. - * @param int $expirySeconds The number of seconds after which the cache entry will expire. - * @return void + * @param string $key the key to store the value under + * @param mixed $value the value to store in the cache + * @param int $expirySeconds the number of seconds after which the cache entry will expire */ public static function set(string $key, mixed $value, int $expirySeconds): void { @@ -38,24 +36,24 @@ public static function set(string $key, mixed $value, int $expirySeconds): void /** * Get a value from the cache if it exists and is not expired. * - * @param string $key The key of the value to retrieve. - * @return mixed The cached value if it exists and is not expired, or null otherwise. + * @param string $key the key of the value to retrieve + * + * @return mixed the cached value if it exists and is not expired, or null otherwise */ public static function get(string $key): mixed { self::createFile(); $core = new MythicalCoreCache(self::$cache_file); + return $core->get($key); } /** * Update an existing cache entry with a new value and expiration time. * - * @param string $key The key of the cache entry to update. - * @param mixed $value The new value to set for the cache entry. - * @param int $expiryTimestamp The new expiration timestamp for the cache entry. - * - * @return void + * @param string $key the key of the cache entry to update + * @param mixed $value the new value to set for the cache entry + * @param int $expiryTimestamp the new expiration timestamp for the cache entry */ public function update(string $key, mixed $value, int $expiryTimestamp): void { @@ -63,12 +61,11 @@ public function update(string $key, mixed $value, int $expiryTimestamp): void $core = new MythicalCoreCache(self::$cache_file); $core->update($key, $value, $expiryTimestamp); } + /** * Delete a cache entry by key. * - * @param string $key The key of the cache entry to delete. - * - * @return void + * @param string $key the key of the cache entry to delete */ public function delete($key): void { @@ -79,8 +76,6 @@ public function delete($key): void /** * Purge the entire cache, removing all entries. - * - * @return void */ public static function purge(): void { @@ -91,8 +86,6 @@ public static function purge(): void /** * Purge the entire cache, removing all entries. - * - * @return void */ public static function process(): void { diff --git a/app/Handlers/NotificationHandler.php b/app/Handlers/NotificationHandler.php index c6eb354..655e488 100755 --- a/app/Handlers/NotificationHandler.php +++ b/app/Handlers/NotificationHandler.php @@ -2,7 +2,6 @@ namespace MythicalSystemsFramework\Handlers; -use Exception; use MythicalSystemsFramework\Database\MySQL; class NotificationHandler @@ -10,94 +9,89 @@ class NotificationHandler /** * Create a new notification. * - * @param string $user_id The user id. - * @param string $name The notification name. - * @param string $description The notification description. + * @param string $user_id the user id + * @param string $name the notification name + * @param string $description the notification description * - * @return int The id of the created notification. + * @return int the id of the created notification */ public static function create(string $user_id, string $name, string $description): int { try { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("INSERT INTO framework_users_notifications (user_id, name, description, date) VALUES (?, ?, ?, NOW())"); - $stmt->bind_param("sss", $user_id, $name, $description); + $stmt = $conn->prepare('INSERT INTO framework_users_notifications (user_id, name, description, date) VALUES (?, ?, ?, NOW())'); + $stmt->bind_param('sss', $user_id, $name, $description); $stmt->execute(); $notificationID = $stmt->insert_id; $stmt->close(); + return $notificationID; - } catch (Exception $e) { - throw new Exception("" . $e->getMessage()); + } catch (\Exception $e) { + throw new \Exception('' . $e->getMessage()); } } /** * Edit an existing notification by ID. * - * @param int $id The id of the notification to edit. - * @param string $name The new notification name. - * @param string $description The new notification description. - * - * @return void + * @param int $id the id of the notification to edit + * @param string $name the new notification name + * @param string $description the new notification description */ public static function edit(int $id, string $name, string $description): void { try { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("UPDATE framework_users_notifications SET name = ?, description = ? WHERE id = ?"); - $stmt->bind_param("ssi", $name, $description, $id); + $stmt = $conn->prepare('UPDATE framework_users_notifications SET name = ?, description = ? WHERE id = ?'); + $stmt->bind_param('ssi', $name, $description, $id); $stmt->execute(); $stmt->close(); - } catch (Exception $e) { - throw new Exception("" . $e->getMessage()); + } catch (\Exception $e) { + throw new \Exception('' . $e->getMessage()); } } /** * Delete a notification by ID. * - * @param int $id The id of the notification to delete. - * - * @return void + * @param int $id the id of the notification to delete */ public static function delete(int $id): void { try { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("DELETE FROM framework_users_notifications WHERE id = ?"); - $stmt->bind_param("i", $id); + $stmt = $conn->prepare('DELETE FROM framework_users_notifications WHERE id = ?'); + $stmt->bind_param('i', $id); $stmt->execute(); $stmt->close(); - } catch (Exception $e) { - throw new Exception("" . $e->getMessage()); + } catch (\Exception $e) { + throw new \Exception('' . $e->getMessage()); } } /** * Delete all framework_users_notifications. - * - * @return void */ public static function deleteAll(): void { try { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $conn->query("TRUNCATE TABLE framework_users_notifications"); - } catch (Exception $e) { - throw new Exception("" . $e->getMessage()); + $conn->query('TRUNCATE TABLE framework_users_notifications'); + } catch (\Exception $e) { + throw new \Exception('' . $e->getMessage()); } } /** * Get a single notification by ID. * - * @param int $id The id of the notification to retrieve. + * @param int $id the id of the notification to retrieve * - * @return array|null The notification data or null if not found. + * @return array|null the notification data or null if not found */ public static function getOne(int $id): ?array { @@ -107,14 +101,15 @@ public static function getOne(int $id): ?array } $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("SELECT * FROM framework_users_notifications WHERE id = ?"); - $stmt->bind_param("i", $id); + $stmt = $conn->prepare('SELECT * FROM framework_users_notifications WHERE id = ?'); + $stmt->bind_param('i', $id); $stmt->execute(); $result = $stmt->get_result(); $notification = $result->fetch_assoc(); $stmt->close(); + return $notification; - } catch (Exception $e) { + } catch (\Exception $e) { return []; } } @@ -122,20 +117,21 @@ public static function getOne(int $id): ?array /** * Get all framework_users_notifications. * - * @return array All framework_users_notifications. + * @return array all framework_users_notifications */ public static function getAll(): array { try { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $result = $conn->query("SELECT * FROM framework_users_notifications"); + $result = $conn->query('SELECT * FROM framework_users_notifications'); $framework_users_notifications = []; while ($notification = $result->fetch_assoc()) { $framework_users_notifications[] = $notification; } + return $framework_users_notifications; - } catch (Exception $e) { + } catch (\Exception $e) { return []; } } @@ -143,20 +139,21 @@ public static function getAll(): array /** * Get all framework_users_notifications sorted by ID in descending order. * - * @return array Sorted framework_users_notifications. + * @return array sorted framework_users_notifications */ public static function getAllSortedById(): array { try { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $result = $conn->query("SELECT * FROM framework_users_notifications ORDER BY id DESC"); + $result = $conn->query('SELECT * FROM framework_users_notifications ORDER BY id DESC'); $framework_users_notifications = []; while ($notification = $result->fetch_assoc()) { $framework_users_notifications[] = $notification; } + return $framework_users_notifications; - } catch (Exception $e) { + } catch (\Exception $e) { return []; } } @@ -164,20 +161,21 @@ public static function getAllSortedById(): array /** * Get all framework_users_notifications sorted by date in descending order. * - * @return array Sorted framework_users_notifications. + * @return array sorted framework_users_notifications */ public static function getAllSortedByDate(): array { try { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $result = $conn->query("SELECT * FROM framework_users_notifications ORDER BY date DESC"); + $result = $conn->query('SELECT * FROM framework_users_notifications ORDER BY date DESC'); $framework_users_notifications = []; while ($notification = $result->fetch_assoc()) { $framework_users_notifications[] = $notification; } + return $framework_users_notifications; - } catch (Exception $e) { + } catch (\Exception $e) { return []; } } @@ -185,17 +183,17 @@ public static function getAllSortedByDate(): array /** * Get framework_users_notifications filtered by user ID. * - * @param string $user_id The user id to filter by. + * @param string $user_id the user id to filter by * - * @return array Filtered framework_users_notifications. + * @return array filtered framework_users_notifications */ public static function getByUserId(string $user_id): array { try { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("SELECT * FROM framework_users_notifications WHERE user_id = ?"); - $stmt->bind_param("s", $user_id); + $stmt = $conn->prepare('SELECT * FROM framework_users_notifications WHERE user_id = ?'); + $stmt->bind_param('s', $user_id); $stmt->execute(); $result = $stmt->get_result(); $framework_users_notifications = []; @@ -203,30 +201,33 @@ public static function getByUserId(string $user_id): array $framework_users_notifications[] = $notification; } $stmt->close(); + return $framework_users_notifications; - } catch (Exception $e) { + } catch (\Exception $e) { return []; } } + /** * Does a notification exist in the database? * - * @param int $id The id of the notification to check. + * @param int $id the id of the notification to check * - * @return bool True if the notification exists, false if not. + * @return bool true if the notification exists, false if not */ public static function exists(string $id): bool { try { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("SELECT * FROM framework_users_notifications WHERE id = ?"); - $stmt->bind_param("i", $id); + $stmt = $conn->prepare('SELECT * FROM framework_users_notifications WHERE id = ?'); + $stmt->bind_param('i', $id); $stmt->execute(); $result = $stmt->get_result(); $stmt->close(); + return $result->num_rows > 0; - } catch (Exception $e) { + } catch (\Exception $e) { return false; } } @@ -234,48 +235,47 @@ public static function exists(string $id): bool /** * Mark a notification as read. * - * @param string $notification_id The id of the notification to mark as read. - * @param string $user_uuid The user uuid. + * @param string $notification_id the id of the notification to mark as read + * @param string $user_uuid the user uuid * - * @return void - * @throws Exception + * @throws \Exception */ public static function markAsRead(string $notification_id, string $user_uuid): void { try { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("INSERT INTO framework_users_notifications_read (notification_id, user_uuid, date) VALUES (?, ?, NOW())"); - $stmt->bind_param("ss", $notification_id, $user_uuid); + $stmt = $conn->prepare('INSERT INTO framework_users_notifications_read (notification_id, user_uuid, date) VALUES (?, ?, NOW())'); + $stmt->bind_param('ss', $notification_id, $user_uuid); $stmt->execute(); $stmt->close(); - } catch (Exception $e) { - throw new Exception("" . $e->getMessage()); + } catch (\Exception $e) { + throw new \Exception('' . $e->getMessage()); } } + /** * Check if a notification was already read! * * @param string $notification_id The id of the notification * @param string $user_uuid The uuid of the user * - * @throws Exception - * @return bool + * @throws \Exception */ public static function hasAlreadyRead(string $notification_id, string $user_uuid): bool { try { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("SELECT * FROM framework_users_notifications_read WHERE notification_id = ? AND user_uuid = ?"); - $stmt->bind_param("ss", $notification_id, $user_uuid); + $stmt = $conn->prepare('SELECT * FROM framework_users_notifications_read WHERE notification_id = ? AND user_uuid = ?'); + $stmt->bind_param('ss', $notification_id, $user_uuid); $stmt->execute(); $result = $stmt->get_result(); $stmt->close(); + return $result->num_rows > 0; - } catch (Exception $e) { - throw new Exception("" . $e->getMessage()); + } catch (\Exception $e) { + throw new \Exception('' . $e->getMessage()); } } - } diff --git a/app/Handlers/exception/AnnouncementNotFoundException.php b/app/Handlers/exception/AnnouncementNotFoundException.php index acb8a33..8bbf1cf 100755 --- a/app/Handlers/exception/AnnouncementNotFoundException.php +++ b/app/Handlers/exception/AnnouncementNotFoundException.php @@ -4,7 +4,7 @@ class AnnouncementNotFoundException extends \Exception { - public function __construct($message = "Announcement not found.", $code = 0, \Throwable $previous = null) + public function __construct($message = 'Announcement not found.', $code = 0, ?\Throwable $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/app/Handlers/exception/NotificationNotFoundException.php b/app/Handlers/exception/NotificationNotFoundException.php index b514849..004fe36 100755 --- a/app/Handlers/exception/NotificationNotFoundException.php +++ b/app/Handlers/exception/NotificationNotFoundException.php @@ -4,7 +4,7 @@ class NotificationNotFoundException extends \Exception { - public function __construct($message = "Notification not found.", $code = 0, \Exception $previous = null) + public function __construct($message = 'Notification not found.', $code = 0, ?\Exception $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/app/Handlers/interfaces/AnnouncementSocial.php b/app/Handlers/interfaces/AnnouncementSocial.php index bc8a92b..5d13736 100755 --- a/app/Handlers/interfaces/AnnouncementSocial.php +++ b/app/Handlers/interfaces/AnnouncementSocial.php @@ -7,4 +7,4 @@ interface AnnouncementSocial public static const Read = "read"; public static const Like = "like"; public static const Dislike = "dislike"; -} \ No newline at end of file +} diff --git a/app/Kernel/Debugger.php b/app/Kernel/Debugger.php index d43e239..0bb493b 100755 --- a/app/Kernel/Debugger.php +++ b/app/Kernel/Debugger.php @@ -2,29 +2,24 @@ namespace MythicalSystemsFramework\Kernel; -use Exception; - class Debugger { /** - * Display the information + * Display the information. * * @param mixed $input The input to display the info about! * @param bool $collapse This is always false by default - * - * @return void */ public static function display_info($input, $collapse = false): void { - try { $recursive = function ($data, $level = 0) use (&$recursive, $collapse) { global $argv; $isTerminal = isset($argv); - if (!$isTerminal && $level == 0 && !defined("DUMP_DEBUG_SCRIPT")) { - define("DUMP_DEBUG_SCRIPT", true); + if (!$isTerminal && $level == 0 && !defined('DUMP_DEBUG_SCRIPT')) { + define('DUMP_DEBUG_SCRIPT', true); echo '' . "\n"; } - $type = !is_string($data) && is_callable($data) ? "Callable" : ucfirst(gettype($data)); + $type = !is_string($data) && is_callable($data) ? 'Callable' : ucfirst(gettype($data)); $type_data = null; $type_color = null; $type_length = null; switch ($type) { - case "String": - $type_color = "green"; + case 'String': + $type_color = 'green'; $type_length = strlen($data); - $type_data = "\"" . htmlentities($data) . "\""; + $type_data = '"' . htmlentities($data) . '"'; break; - case "Double": - case "Float": - $type = "Float"; - $type_color = "#0099c5"; + case 'Double': + case 'Float': + $type = 'Float'; + $type_color = '#0099c5'; $type_length = strlen($data); $type_data = htmlentities($data); break; - case "Integer": - $type_color = "red"; + case 'Integer': + $type_color = 'red'; $type_length = strlen($data); $type_data = htmlentities($data); break; - case "Boolean": - $type_color = "#92008d"; + case 'Boolean': + $type_color = '#92008d'; $type_length = strlen($data); - $type_data = $data ? "TRUE" : "FALSE"; + $type_data = $data ? 'TRUE' : 'FALSE'; break; - case "NULL": + case 'NULL': $type_length = 0; break; - case "Array": + case 'Array': $type_length = count($data); } - if (in_array($type, array("Object", "Array"))) { + if (in_array($type, ['Object', 'Array'])) { $notEmpty = false; foreach ($data as $key => $value) { @@ -81,69 +76,69 @@ public static function display_info($input, $collapse = false): void $notEmpty = true; if ($isTerminal) { - echo $type . ($type_length !== null ? "(" . $type_length . ")" : "") . "\n"; + echo $type . ($type_length !== null ? '(' . $type_length . ')' : '') . "\n"; } else { - $id = substr(md5(rand() . ":" . $key . ":" . $level), 0, 8); + $id = substr(md5(mt_rand() . ':' . $key . ':' . $level), 0, 8); echo ""; - echo "" . $type . ($type_length !== null ? "(" . $type_length . ")" : "") . ""; - echo ""; - echo " ⤵"; - echo "
"; - echo "
"; + echo "" . $type . ($type_length !== null ? '(' . $type_length . ')' : '') . ''; + echo ''; + echo ' ⤵'; + echo '
'; + echo '
'; } - for ($i = 0; $i <= $level; $i++) { - echo $isTerminal ? "| " : "|        "; + for ($i = 0; $i <= $level; ++$i) { + echo $isTerminal ? '| ' : "|        "; } - echo $isTerminal ? "\n" : "
"; + echo $isTerminal ? "\n" : '
'; } - for ($i = 0; $i <= $level; $i++) { - echo $isTerminal ? "| " : "|        "; + for ($i = 0; $i <= $level; ++$i) { + echo $isTerminal ? '| ' : "|        "; } - echo $isTerminal ? "[" . $key . "] => " : "[" . $key . "] => "; + echo $isTerminal ? '[' . $key . '] => ' : "[" . $key . '] => '; call_user_func($recursive, $value, $level + 1); } if ($notEmpty) { - for ($i = 0; $i <= $level; $i++) { - echo $isTerminal ? "| " : "|        "; + for ($i = 0; $i <= $level; ++$i) { + echo $isTerminal ? '| ' : "|        "; } if (!$isTerminal) { - echo "
"; + echo '
'; } } else { echo $isTerminal ? - $type . ($type_length !== null ? "(" . $type_length . ")" : "") . " " : - "" . $type . ($type_length !== null ? "(" . $type_length . ")" : "") . "  "; + $type . ($type_length !== null ? '(' . $type_length . ')' : '') . ' ' : + "" . $type . ($type_length !== null ? '(' . $type_length . ')' : '') . '  '; } } else { echo $isTerminal ? - $type . ($type_length !== null ? "(" . $type_length . ")" : "") . " " : - "" . $type . ($type_length !== null ? "(" . $type_length . ")" : "") . "  "; + $type . ($type_length !== null ? '(' . $type_length . ')' : '') . ' ' : + "" . $type . ($type_length !== null ? '(' . $type_length . ')' : '') . '  '; if ($type_data != null) { - echo $isTerminal ? $type_data : "" . $type_data . ""; + echo $isTerminal ? $type_data : "" . $type_data . ''; } } - echo $isTerminal ? "\n" : "
"; + echo $isTerminal ? "\n" : '
'; }; call_user_func($recursive, $input); - die(); - } catch (Exception $e) { - die($e->getMessage()); + exit; + } catch (\Exception $e) { + exit($e->getMessage()); } } /** - * Throw an error + * Throw an error. * * @param mixed $renderer The twig renderer * @param string $error_text The error text @@ -166,12 +161,12 @@ public static function throw_error($renderer, $error_text, $error_full_message, global $renderer; http_response_code(500); - die($renderer->render('/errors/debug.twig')); + exit($renderer->render('/errors/debug.twig')); }); - die($router->route()); - } catch (Exception $e) { - die($e->getMessage()); + exit($router->route()); + } catch (\Exception $e) { + exit($e->getMessage()); } } } diff --git a/app/Kernel/Encryption.php b/app/Kernel/Encryption.php index 5fe8f34..ad4a9c7 100755 --- a/app/Kernel/Encryption.php +++ b/app/Kernel/Encryption.php @@ -2,32 +2,24 @@ namespace MythicalSystemsFramework\Kernel; -use MythicalSystems\Utils\EncryptionHandler as core_encryption; use MythicalSystemsFramework\Managers\ConfigManager as cfg; +use MythicalSystems\Utils\EncryptionHandler as core_encryption; class Encryption { /** - * Encrypt the data - * - * @param string $data - * - * @return string + * Encrypt the data. */ public static function encrypt(string $data): string { - return core_encryption::encrypt($data, cfg::get("encryption", "key")); + return core_encryption::encrypt($data, cfg::get('encryption', 'key')); } /** - * Decrypt the data - * - * @param string $data - * - * @return string + * Decrypt the data. */ public static function decrypt(string $data): string { - return core_encryption::decrypt($data, cfg::get("encryption", "key")); + return core_encryption::decrypt($data, cfg::get('encryption', 'key')); } } diff --git a/app/Kernel/Logger.php b/app/Kernel/Logger.php index a363fed..be44fdf 100755 --- a/app/Kernel/Logger.php +++ b/app/Kernel/Logger.php @@ -2,15 +2,12 @@ namespace MythicalSystemsFramework\Kernel; -use Exception; use MythicalSystemsFramework\Database\MySQL; -use MythicalSystemsFramework\Kernel\LoggerTypes; -use MythicalSystemsFramework\Kernel\LoggerLevels; class Logger { /** - * Log something inside the kernel framework_logs + * Log something inside the kernel framework_logs. * * @param LoggerTypes|string $level (INFO, WARNING, ERROR, CRITICAL, OTHER) * @param LoggerLevels|string $type (CORE, DATABASE, PLUGIN, LOG, OTHER, LANGUAGE) @@ -23,13 +20,13 @@ public static function log(LoggerTypes|string $level, LoggerLevels|string $type, $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); if (empty($level) || empty($type)) { - throw new Exception("Both log level and type must be provided"); + throw new \Exception('Both log level and type must be provided'); } - $output = "[" . date("Y-m-d H:i:s") . "] (" . $type . '/' . $level . ") " . $message . ""; + $output = '[' . date('Y-m-d H:i:s') . '] (' . $type . '/' . $level . ') ' . $message . ''; - $stmt = $conn->prepare("INSERT INTO framework_logs (l_type, levels, message, formatted) VALUES (?, ?, ?, ?)"); - $stmt->bind_param("ssss", $type, $level, $message, $output); + $stmt = $conn->prepare('INSERT INTO framework_logs (l_type, levels, message, formatted) VALUES (?, ?, ?, ?)'); + $stmt->bind_param('ssss', $type, $level, $message, $output); $stmt->execute(); $logId = $stmt->insert_id; $stmt->close(); @@ -39,76 +36,67 @@ public static function log(LoggerTypes|string $level, LoggerLevels|string $type, /** * Delete a log by ID. - * - * @param int $id - * @return void */ public static function delete(int $id): void { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("DELETE FROM framework_logs WHERE id = ?"); - $stmt->bind_param("i", $id); + $stmt = $conn->prepare('DELETE FROM framework_logs WHERE id = ?'); + $stmt->bind_param('i', $id); $stmt->execute(); $stmt->close(); } /** * Delete all framework_logs. - * - * @return void */ public static function deleteAll(): void { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $conn->query("TRUNCATE TABLE framework_logs"); + $conn->query('TRUNCATE TABLE framework_logs'); } /** * Get a single log by ID. - * - * @param int $id - * @return array|null */ public static function getOne(int $id): ?array { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $stmt = $conn->prepare("SELECT * FROM framework_logs WHERE id = ?"); - $stmt->bind_param("i", $id); + $stmt = $conn->prepare('SELECT * FROM framework_logs WHERE id = ?'); + $stmt->bind_param('i', $id); $stmt->execute(); $result = $stmt->get_result(); $log = $result->fetch_assoc(); $stmt->close(); + return $log ? $log : null; } /** * Get all framework_logs. - * - * @return array */ public static function getAll(): array { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $result = $conn->query("SELECT * FROM framework_logs"); + $result = $conn->query('SELECT * FROM framework_logs'); $framework_logs = $result->fetch_all(MYSQLI_ASSOC); + return $framework_logs; } /** * Get all framework_logs sorted by ID in descending order. - * - * @return array */ public static function getAllSortedById(): array { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $result = $conn->query("SELECT * FROM framework_logs ORDER BY id DESC"); + $result = $conn->query('SELECT * FROM framework_logs ORDER BY id DESC'); $framework_logs = $result->fetch_all(MYSQLI_ASSOC); + return $framework_logs; } @@ -121,17 +109,18 @@ public static function getAllSortedById(): array * * @return array|null Returns the logs in an array */ - public static function getAllSortedByDate(LoggerTypes|string $level, LoggerLevels|string $type, int $limit = 15): array|null + public static function getAllSortedByDate(LoggerTypes|string $level, LoggerLevels|string $type, int $limit = 15): ?array { $mysqli = new MySQL(); $conn = $mysqli->connectMYSQLI(); - $query = "SELECT * FROM framework_logs WHERE levels = ? AND l_type = ? ORDER BY date DESC LIMIT ?"; + $query = 'SELECT * FROM framework_logs WHERE levels = ? AND l_type = ? ORDER BY date DESC LIMIT ?'; $stmt = $conn->prepare($query); - $stmt->bind_param("ssi", $level, $type, $limit); + $stmt->bind_param('ssi', $level, $type, $limit); $stmt->execute(); $result = $stmt->get_result(); $framework_logs = $result->fetch_all(MYSQLI_ASSOC); $stmt->close(); + return $framework_logs; } } diff --git a/app/Kernel/LoggerTypes.php b/app/Kernel/LoggerTypes.php index fbd654f..be5b68b 100755 --- a/app/Kernel/LoggerTypes.php +++ b/app/Kernel/LoggerTypes.php @@ -9,7 +9,7 @@ interface LoggerTypes public const DATABASE = 'DATABASE'; public const PLUGIN = 'PLUGIN'; public const LOG = 'LOG'; - public const LANGUAGE = "LANGUAGE"; + public const LANGUAGE = 'LANGUAGE'; // Other public const OTHER = 'OTHER'; } diff --git a/app/Managers/ConfigManager.php b/app/Managers/ConfigManager.php index 7114cb3..3500cc7 100755 --- a/app/Managers/ConfigManager.php +++ b/app/Managers/ConfigManager.php @@ -2,12 +2,12 @@ namespace MythicalSystemsFramework\Managers; -use Exception; use MythicalSystems\Helpers\ConfigHelper; class ConfigManager { - private static string $configpath = __DIR__ . "/../../settings.json"; + private static string $configpath = __DIR__ . '/../../settings.json'; + /** * DEPRECATED: Use Settings class instead!! * DEPRECATED: This class is used for the settings.json file! @@ -15,24 +15,22 @@ class ConfigManager * Get value form the config! * * @param string $category The category of the value you want to take from the config - * @param string $value The value you want to take from the config file! - * - * @return string|null */ - public static function get(string $category, string $key): string|null + public static function get(string $category, string $key): ?string { try { if (!file_exists(self::$configpath)) { - die("Config file not found!"); + exit('Config file not found!'); } if (!is_writable(self::$configpath)) { - die("We have no access to the config file!"); + exit('We have no access to the config file!'); } else { $config = new ConfigHelper(self::$configpath); } - } catch (Exception $e) { - die("Failed to init the config class! \n" . $e->__toString()); + } catch (\Exception $e) { + exit("Failed to init the config class! \n" . $e->__toString()); } + return $config->get($category, $key); } @@ -51,16 +49,17 @@ public static function set(string $category, string $key, string $value): bool { try { if (!file_exists(self::$configpath)) { - die("Config file not found!"); + exit('Config file not found!'); } if (!is_writable(self::$configpath)) { - die("We have no access to the config file!"); + exit('We have no access to the config file!'); } else { $config = new ConfigHelper(self::$configpath); } - } catch (Exception $e) { - die("Failed to init the config class! \n" . $e->__toString()); + } catch (\Exception $e) { + exit("Failed to init the config class! \n" . $e->__toString()); } + return $config->set($category, $key, $value); } @@ -73,23 +72,22 @@ public static function set(string $category, string $key, string $value): bool * @param string $category The category of the value you want to add in the config * @param string $key The key of the value you want to add in the config file! * @param string $value The value you want to add in the config file! - * - * @return bool */ public static function add(string $category, string $key, string $value): bool { try { if (!file_exists(self::$configpath)) { - die("Config file not found!"); + exit('Config file not found!'); } if (!is_writable(self::$configpath)) { - die("We have no access to the config file!"); + exit('We have no access to the config file!'); } else { $config = new ConfigHelper(self::$configpath); } - } catch (Exception $e) { - die("Failed to init the config class! \n" . $e->__toString()); + } catch (\Exception $e) { + exit("Failed to init the config class! \n" . $e->__toString()); } + return $config->add($category, $key, $value); } @@ -101,23 +99,22 @@ public static function add(string $category, string $key, string $value): bool * * @param string $category The category of the value you want to remove from the config * @param string $key The key of the value you want to remove from the config file! - * - * @return bool */ public static function remove(string $category, string $key): bool { try { if (!file_exists(self::$configpath)) { - die("Config file not found!"); + exit('Config file not found!'); } if (!is_writable(self::$configpath)) { - die("We have no access to the config file!"); + exit('We have no access to the config file!'); } else { $config = new ConfigHelper(self::$configpath); } - } catch (Exception $e) { - die("Failed to init the config class! \n" . $e->__toString()); + } catch (\Exception $e) { + exit("Failed to init the config class! \n" . $e->__toString()); } + return $config->remove($category, $key); } } diff --git a/app/Managers/LanguageManager.php b/app/Managers/LanguageManager.php index 22180f3..f12b7d8 100755 --- a/app/Managers/LanguageManager.php +++ b/app/Managers/LanguageManager.php @@ -2,17 +2,14 @@ namespace MythicalSystemsFramework\Managers; -use Exception; -use MythicalSystemsFramework\Kernel\Logger as logger; -use MythicalSystemsFramework\Kernel\LoggerLevels; use MythicalSystemsFramework\Kernel\LoggerTypes; +use MythicalSystemsFramework\Kernel\LoggerLevels; +use MythicalSystemsFramework\Kernel\Logger as logger; class LanguageManager { /** - * Get the language from the file - * - * @return mixed + * Get the language from the file. */ public static function getLang(): mixed { @@ -20,51 +17,54 @@ public static function getLang(): mixed $fallback_lang = __DIR__ . '/../../lang/en_US.php'; if (file_exists($fallback_lang)) { $langConfig = SettingsManager::get('app', 'lang'); - if (!$langConfig == "") { + if (!$langConfig == '') { $langFilePath = __DIR__ . '/../../lang/' . $langConfig . '.php'; if (file_exists($langFilePath)) { - return include($langFilePath); + return include $langFilePath; } else { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::LANGUAGE, "Language file is invalid!!"); - return include($fallback_lang); + logger::log(LoggerLevels::CRITICAL, LoggerTypes::LANGUAGE, 'Language file is invalid!!'); + + return include $fallback_lang; } } else { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::LANGUAGE, "Default language file has not been found in the config!!"); - return include($fallback_lang); + logger::log(LoggerLevels::CRITICAL, LoggerTypes::LANGUAGE, 'Default language file has not been found in the config!!'); + + return include $fallback_lang; } } else { - logger::log(LoggerLevels::CRITICAL, LoggerTypes::LANGUAGE, "Fallback language file has not been found!!"); - die("Fallback language file has not been found!! You are missing important files!"); + logger::log(LoggerLevels::CRITICAL, LoggerTypes::LANGUAGE, 'Fallback language file has not been found!!'); + exit('Fallback language file has not been found!! You are missing important files!'); } - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::LANGUAGE, "Error while loading language file: " . $e->getMessage()); - return include($fallback_lang); + } catch (\Exception $e) { + logger::log(LoggerLevels::CRITICAL, LoggerTypes::LANGUAGE, 'Error while loading language file: ' . $e->getMessage()); + + return include $fallback_lang; } } /** - * Get all available languages - * - * @return array + * Get all available languages. */ public static function getAllAvailableLanguages(): array { $langFiles = scandir(__DIR__ . '/../../lang/'); - $langFiles = array_diff($langFiles, array('..', '.')); + $langFiles = array_diff($langFiles, ['..', '.']); + return $langFiles; } /** - * Log translation key not found + * Log translation key not found. * * @param string $key Translation key * @param string $message The alternative message * * @return string The translation key not found message */ - public static function logKeyTranslationNotFound($key, $message = "TRANSLATION_KEY_NOT_FOUND"): string + public static function logKeyTranslationNotFound($key, $message = 'TRANSLATION_KEY_NOT_FOUND'): string { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::LANGUAGE, "Translation key not found: " . $key); + logger::log(LoggerLevels::CRITICAL, LoggerTypes::LANGUAGE, 'Translation key not found: ' . $key); + return $message; } } diff --git a/app/Managers/Settings.php b/app/Managers/Settings.php index c215b7b..62a696c 100755 --- a/app/Managers/Settings.php +++ b/app/Managers/Settings.php @@ -2,11 +2,10 @@ namespace MythicalSystemsFramework\Managers; -use MythicalSystemsFramework\Database\MySQLCache; use MythicalSystemsFramework\Database\MySQL; use MythicalSystemsFramework\Cli\Colors as color; +use MythicalSystemsFramework\Database\MySQLCache; use MythicalSystemsFramework\Managers\exception\settings\NoMigrationsFound; -use Exception; class Settings { @@ -24,45 +23,45 @@ public static function down(): void // No implementation needed for now } - public static function getSetting(string $category, string $name): string|null + public static function getSetting(string $category, string $name): ?string { self::up(); $settings_file = self::$cache_path . '/framework_settings.json'; if (!file_exists($settings_file)) { - MySQLCache::saveCache("framework_settings"); + MySQLCache::saveCache('framework_settings'); } $settings = new \MythicalSystems\Helpers\ConfigHelper($settings_file); self::down(); + return $settings->get($category, $name); } + /** - * Update a setting in the database + * Update a setting in the database. * * @param string $category The name of the category * @param string $name The name of the setting * @param string $value The value you want to replace with! * @param bool $updateCache Update the cache after updating the setting * - * @return void - * @throws Exception + * @throws \Exception */ public static function updateSetting(string $category, string $name, string $value, bool $updateCache = true): void { SettingsManager::update($category, $name, $value); if ($updateCache) { - MySQLCache::saveCache("framework_settings"); + MySQLCache::saveCache('framework_settings'); } } - public static function migrate(bool $isTerminal = false): void { try { $mysql = new MySQL(); $db = $mysql->connectPDO(); - $db->exec("CREATE TABLE IF NOT EXISTS `framework_settings_migrations` (`id` INT NOT NULL AUTO_INCREMENT , `script` TEXT NOT NULL , `executed_at` DATETIME NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB; ALTER TABLE `framework_settings_migrations` CHANGE `executed_at` `executed_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP;"); + $db->exec('CREATE TABLE IF NOT EXISTS `framework_settings_migrations` (`id` INT NOT NULL AUTO_INCREMENT , `script` TEXT NOT NULL , `executed_at` DATETIME NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB; ALTER TABLE `framework_settings_migrations` CHANGE `executed_at` `executed_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP;'); $phpFiles = glob(__DIR__ . '/../../migrate/config/*.php'); if (count($phpFiles) > 0) { sort($phpFiles); @@ -72,32 +71,32 @@ public static function migrate(bool $isTerminal = false): void foreach ($phpFiles as $phpFile) { $fileName = basename($phpFile); - $stmt = $db->prepare("SELECT COUNT(*) FROM framework_settings_migrations WHERE script = ?"); + $stmt = $db->prepare('SELECT COUNT(*) FROM framework_settings_migrations WHERE script = ?'); $stmt->execute([$fileName]); $count = $stmt->fetchColumn(); if ($count == 0) { include $phpFile; - $stmt = $db->prepare("INSERT INTO framework_settings_migrations (script) VALUES (?)"); + $stmt = $db->prepare('INSERT INTO framework_settings_migrations (script) VALUES (?)'); $stmt->execute([$fileName]); - $migratedCount++; // Increment migrated count + ++$migratedCount; // Increment migrated count } } if ($isTerminal) { - echo color::translateColorsCode("&fMigration completed. Migrated &e" . $migratedCount . " &ffiles."); + echo color::translateColorsCode('&fMigration completed. Migrated &e' . $migratedCount . ' &ffiles.'); } } else { if ($isTerminal) { - echo color::translateColorsCode("&fNo migrations found!"); + echo color::translateColorsCode('&fNo migrations found!'); } } - } catch (Exception $e) { + } catch (\Exception $e) { if ($isTerminal) { - echo color::translateColorsCode("&cFailed to migrate the database: &f" . $e->getMessage() . ""); + echo color::translateColorsCode('&cFailed to migrate the database: &f' . $e->getMessage() . ''); } else { - throw new NoMigrationsFound("No migrations found!". $e->getMessage()); + throw new NoMigrationsFound('No migrations found!' . $e->getMessage()); } } } diff --git a/app/Managers/SettingsManager.php b/app/Managers/SettingsManager.php index 51d19c4..03b91b3 100755 --- a/app/Managers/SettingsManager.php +++ b/app/Managers/SettingsManager.php @@ -19,17 +19,18 @@ class SettingsManager * * @return string|null Incase if found then return the value else return null! */ - public static function get(string $category, string $key): string|null + public static function get(string $category, string $key): ?string { if (self::exists($category, $key)) { $mysql = new MySQL(); $conn = $mysql->connectMYSQLI(); - $stmt = $conn->prepare("SELECT `svalue` FROM framework_settings WHERE `skey` = ? AND `scategory` = ?"); - $stmt->bind_param("ss", $key, $category); + $stmt = $conn->prepare('SELECT `svalue` FROM framework_settings WHERE `skey` = ? AND `scategory` = ?'); + $stmt->bind_param('ss', $key, $category); $stmt->execute(); $stmt->bind_result($value); $stmt->fetch(); $stmt->close(); + return $value; } else { return null; @@ -50,10 +51,11 @@ public static function set(string $category, string $key, string $value): bool { $mysql = new MySQL(); $conn = $mysql->connectMYSQLI(); - $stmt = $conn->prepare("INSERT INTO framework_settings (`scategory`, `skey`, `svalue`) VALUES (?, ?, ?)"); - $stmt->bind_param("sss", $category, $key, $value); + $stmt = $conn->prepare('INSERT INTO framework_settings (`scategory`, `skey`, `svalue`) VALUES (?, ?, ?)'); + $stmt->bind_param('sss', $category, $key, $value); $success = $stmt->execute(); $stmt->close(); + return $success; } @@ -71,10 +73,11 @@ public static function delete(string $category, string $key): bool if (self::exists($category, $key)) { $mysql = new MySQL(); $conn = $mysql->connectMYSQLI(); - $stmt = $conn->prepare("DELETE FROM framework_settings WHERE `skey` = ? AND `scategory` = ?"); - $stmt->bind_param("s", $key); + $stmt = $conn->prepare('DELETE FROM framework_settings WHERE `skey` = ? AND `scategory` = ?'); + $stmt->bind_param('s', $key); $success = $stmt->execute(); $stmt->close(); + return $success; } else { return false; @@ -92,7 +95,8 @@ public static function deleteAll(): bool { $mysql = new MySQL(); $conn = $mysql->connectMYSQLI(); - $success = $conn->query("TRUNCATE TABLE framework_settings"); + $success = $conn->query('TRUNCATE TABLE framework_settings'); + return $success; } @@ -112,10 +116,11 @@ public static function update(string $category, string $key, string $value): boo if (self::exists($category, $key)) { $mysql = new MySQL(); $conn = $mysql->connectMYSQLI(); - $stmt = $conn->prepare("UPDATE framework_settings SET `svalue` = ? WHERE `skey` = ? AND `scategory` = ?"); - $stmt->bind_param("sss", $scategory, $value, $key); + $stmt = $conn->prepare('UPDATE framework_settings SET `svalue` = ? WHERE `skey` = ? AND `scategory` = ?'); + $stmt->bind_param('sss', $scategory, $value, $key); $success = $stmt->execute(); $stmt->close(); + return $success; } else { return false; @@ -136,12 +141,13 @@ public static function exists(string $category, string $key): bool { $mysql = new MySQL(); $conn = $mysql->connectMYSQLI(); - $stmt = $conn->prepare("SELECT COUNT(*) FROM framework_settings WHERE `skey` = ? AND `scategory` = ?"); - $stmt->bind_param("ss", $key, $category); + $stmt = $conn->prepare('SELECT COUNT(*) FROM framework_settings WHERE `skey` = ? AND `scategory` = ?'); + $stmt->bind_param('ss', $key, $category); $stmt->execute(); $stmt->bind_result($count); $stmt->fetch(); $stmt->close(); + return $count > 0; } } diff --git a/app/Managers/SnowFlakeManager.php b/app/Managers/SnowFlakeManager.php index c84cf88..3ac49a9 100755 --- a/app/Managers/SnowFlakeManager.php +++ b/app/Managers/SnowFlakeManager.php @@ -7,7 +7,7 @@ class SnowFlakeManager { /** - * Function to generate a unique user ID + * Function to generate a unique user ID. * * @return string The new user id */ @@ -17,7 +17,7 @@ private static function generateUserID(): string } /** - * Function to get the cached user IDs from the database + * Function to get the cached user IDs from the database. * * @return array Array of cached user IDs */ @@ -25,7 +25,7 @@ private static function getCachedUserIDs(): array { $mysql = new MySQL(); $conn = $mysql->connectMYSQLI(); - $query = "SELECT uid FROM framework_users_userids"; + $query = 'SELECT uid FROM framework_users_userids'; $result = $conn->query($query); $userIds = []; @@ -39,7 +39,7 @@ private static function getCachedUserIDs(): array } /** - * Function to save user IDs to the database + * Function to save user IDs to the database. * * @param string $userId Save the user id inside the database * @@ -49,15 +49,16 @@ private static function saveUserIDToDatabase(string $userId): bool { $mysql = new MySQL(); $conn = $mysql->connectMYSQLI(); - $stmt = $conn->prepare("INSERT INTO framework_users_userids (uid, date) VALUES (?, NOW())"); - $stmt->bind_param("s", $userId); + $stmt = $conn->prepare('INSERT INTO framework_users_userids (uid, date) VALUES (?, NOW())'); + $stmt->bind_param('s', $userId); $success = $stmt->execute(); $stmt->close(); + return $success; } /** - * Function to check if a user ID is already used + * Function to check if a user ID is already used. * * @return bool If this is used or not */ @@ -67,7 +68,7 @@ private static function isUserIDUsed(string $userId, array $cachedUserIds): bool } /** - * Function to get a unique user ID + * Function to get a unique user ID. * * @return string The user id */ @@ -83,12 +84,12 @@ public static function getUniqueUserID(): string if (self::saveUserIDToDatabase($newUserId)) { return $newUserId; } else { - return ""; + return ''; } } /** - * Function to delete a user ID from the database + * Function to delete a user ID from the database. * * @param string $userId The user ID to be deleted from the database * @@ -98,15 +99,16 @@ public static function deleteUserFromDatabase(string $userId): bool { $mysql = new MySQL(); $conn = $mysql->connectMYSQLI(); - $stmt = $conn->prepare("DELETE FROM framework_users_userids WHERE uid = ?"); - $stmt->bind_param("s", $userId); + $stmt = $conn->prepare('DELETE FROM framework_users_userids WHERE uid = ?'); + $stmt->bind_param('s', $userId); $success = $stmt->execute(); $stmt->close(); + return $success; } /** - * Function to check if a user ID exists in the database + * Function to check if a user ID exists in the database. * * @param string $userId The user ID to check * @@ -116,12 +118,13 @@ public static function doesUserExistInDatabase(string $userId): bool { $mysql = new MySQL(); $conn = $mysql->connectMYSQLI(); - $stmt = $conn->prepare("SELECT COUNT(*) FROM framework_users_userids WHERE uid = ?"); - $stmt->bind_param("s", $userId); + $stmt = $conn->prepare('SELECT COUNT(*) FROM framework_users_userids WHERE uid = ?'); + $stmt->bind_param('s', $userId); $stmt->execute(); $stmt->bind_result($count); $stmt->fetch(); $stmt->close(); + return $count > 0; } } diff --git a/app/Managers/exception/settings/NoMigrationsFound.php b/app/Managers/exception/settings/NoMigrationsFound.php index bfa8645..8b2389b 100755 --- a/app/Managers/exception/settings/NoMigrationsFound.php +++ b/app/Managers/exception/settings/NoMigrationsFound.php @@ -2,12 +2,9 @@ namespace MythicalSystemsFramework\Managers\exception\settings; -use Exception; -use Throwable; - -class NoMigrationsFound extends Exception +class NoMigrationsFound extends \Exception { - public function __construct($message = "No migration not found.", $code = 0, Exception $previous = null) + public function __construct($message = 'No migration not found.', $code = 0, ?\Exception $previous = null) { parent::__construct($message, $code, $previous); } diff --git a/app/Plugins/Events/ActivityEvent.php b/app/Plugins/Events/ActivityEvent.php index c315585..f2bd819 100755 --- a/app/Plugins/Events/ActivityEvent.php +++ b/app/Plugins/Events/ActivityEvent.php @@ -15,5 +15,4 @@ public static function OnRemoveUserActivities(): void public static function OnRemoveAllActivities(): void { } - } diff --git a/app/Plugins/Events/AnnouncementEvent.php b/app/Plugins/Events/AnnouncementEvent.php index 1755a4a..0b63059 100755 --- a/app/Plugins/Events/AnnouncementEvent.php +++ b/app/Plugins/Events/AnnouncementEvent.php @@ -27,6 +27,7 @@ public static function OnAnnouncementRemoveDisLike(): void public static function OnAnnouncementRemoveLike(): void { } + public static function OnAnnouncementDisLike(): void { } diff --git a/app/Plugins/Events/ApplicationEvent.php b/app/Plugins/Events/ApplicationEvent.php index 2a11639..1374843 100755 --- a/app/Plugins/Events/ApplicationEvent.php +++ b/app/Plugins/Events/ApplicationEvent.php @@ -11,8 +11,8 @@ public static function OnApplicationDown(): void public static function OnApplicationUp(): void { } + public static function OnApplicationStartup(): void { - } } diff --git a/app/Plugins/Events/ConfigEvent.php b/app/Plugins/Events/ConfigEvent.php index 5c113c7..f9b3833 100755 --- a/app/Plugins/Events/ConfigEvent.php +++ b/app/Plugins/Events/ConfigEvent.php @@ -15,5 +15,4 @@ public static function OnConfigRemove(): void public static function OnConfigUpdate(): void { } - } diff --git a/app/Plugins/Events/CronEvent.php b/app/Plugins/Events/CronEvent.php index d231264..53b5cf8 100755 --- a/app/Plugins/Events/CronEvent.php +++ b/app/Plugins/Events/CronEvent.php @@ -7,5 +7,4 @@ class CronEvent public static function OnCronTabRun(): void { } - } diff --git a/app/Plugins/Events/DatabaseEvent.php b/app/Plugins/Events/DatabaseEvent.php index 9c2202b..8a4a349 100755 --- a/app/Plugins/Events/DatabaseEvent.php +++ b/app/Plugins/Events/DatabaseEvent.php @@ -7,6 +7,7 @@ class DatabaseEvent public static function OnDatabaseConnect(): void { } + public static function OnDatabaseMigration(): void { } diff --git a/app/Plugins/Events/EncryptionEvent.php b/app/Plugins/Events/EncryptionEvent.php index 35b31cc..daeb044 100755 --- a/app/Plugins/Events/EncryptionEvent.php +++ b/app/Plugins/Events/EncryptionEvent.php @@ -11,5 +11,4 @@ public static function OnEncrypt(): void public static function OnDecrypt(): void { } - } diff --git a/app/Plugins/Events/ExceptionEvent.php b/app/Plugins/Events/ExceptionEvent.php index 249d521..2929e7c 100755 --- a/app/Plugins/Events/ExceptionEvent.php +++ b/app/Plugins/Events/ExceptionEvent.php @@ -6,6 +6,5 @@ class ExceptionEvent { public static function OnException(): void { - } } diff --git a/app/Plugins/Events/LoggerEvent.php b/app/Plugins/Events/LoggerEvent.php index 3bc4191..2f4b12e 100755 --- a/app/Plugins/Events/LoggerEvent.php +++ b/app/Plugins/Events/LoggerEvent.php @@ -6,16 +6,13 @@ class LoggerEvent { public static function OnLog(): void { - } public static function onLogsPurge(): void { - } public static function onLogDelete(): void { - } } diff --git a/app/Plugins/Events/NotificationEvent.php b/app/Plugins/Events/NotificationEvent.php index 26ecc49..3955395 100755 --- a/app/Plugins/Events/NotificationEvent.php +++ b/app/Plugins/Events/NotificationEvent.php @@ -15,13 +15,12 @@ public static function OnNotificationEdit(): void public static function OnNotificationDelete(): void { } + public static function OnNotificationDeleteAll(): void { - } public static function OnNotificationRead(): void { } - } diff --git a/app/Plugins/Events/PermissionEvent.php b/app/Plugins/Events/PermissionEvent.php index c03a985..f7624ae 100755 --- a/app/Plugins/Events/PermissionEvent.php +++ b/app/Plugins/Events/PermissionEvent.php @@ -15,5 +15,4 @@ public static function OnPermissionDelete(): void public static function OnPermissionUpdate(): void { } - } diff --git a/app/Plugins/Events/RendererEvent.php b/app/Plugins/Events/RendererEvent.php index 6a60902..76740b8 100755 --- a/app/Plugins/Events/RendererEvent.php +++ b/app/Plugins/Events/RendererEvent.php @@ -6,6 +6,5 @@ class RendererEvent { public static function OnRendererLoad(): void { - } } diff --git a/app/Plugins/Events/RoleEvent.php b/app/Plugins/Events/RoleEvent.php index a0a4738..392533c 100755 --- a/app/Plugins/Events/RoleEvent.php +++ b/app/Plugins/Events/RoleEvent.php @@ -15,5 +15,4 @@ public static function OnRoleDelete(): void public static function OnRoleUpdate(): void { } - } diff --git a/app/Plugins/Events/RouterEvent.php b/app/Plugins/Events/RouterEvent.php index 66bce6e..9c31521 100755 --- a/app/Plugins/Events/RouterEvent.php +++ b/app/Plugins/Events/RouterEvent.php @@ -7,5 +7,4 @@ class RouterEvent public static function OnRouterLoad(): void { } - } diff --git a/app/Plugins/Events/SettingEvent.php b/app/Plugins/Events/SettingEvent.php index af5e01f..3fba623 100755 --- a/app/Plugins/Events/SettingEvent.php +++ b/app/Plugins/Events/SettingEvent.php @@ -18,7 +18,5 @@ public static function OnSettingsSet(): void public static function OnSettingMigration(): void { - } - } diff --git a/app/Plugins/Events/SnowFlakeEvent.php b/app/Plugins/Events/SnowFlakeEvent.php index 3b49f79..dbafdcd 100755 --- a/app/Plugins/Events/SnowFlakeEvent.php +++ b/app/Plugins/Events/SnowFlakeEvent.php @@ -7,5 +7,4 @@ class SnowFlakeEvent public static function OnNewUserID(): void { } - } diff --git a/app/Plugins/Events/UserEvent.php b/app/Plugins/Events/UserEvent.php index 47e5e9b..b286997 100755 --- a/app/Plugins/Events/UserEvent.php +++ b/app/Plugins/Events/UserEvent.php @@ -10,8 +10,9 @@ class UserEvent */ public static function onUserLogin(): void { - //This is where you can add your code to run when a user logs in + // This is where you can add your code to run when a user logs in } + /** * Event: OnUserLogOut * Description: Triggered when a user logs out. @@ -19,6 +20,7 @@ public static function onUserLogin(): void public static function OnUserLogOut(): void { } + /** * Event: OnUserBan * Description: Triggered when a user gets banned. @@ -26,6 +28,7 @@ public static function OnUserLogOut(): void public static function OnUserBan(): void { } + /** * Event: OnUserUnBan * Description: Triggered when a user gets unbanned. @@ -33,6 +36,7 @@ public static function OnUserBan(): void public static function OnUserUnBan(): void { } + /** * Event: OnUserDelete * Description: Triggered when a user gets deleted. @@ -40,6 +44,7 @@ public static function OnUserUnBan(): void public static function OnUserDelete(): void { } + /** * Event: OnUserRestore * Description: Triggered when a user gets undeleted. @@ -47,6 +52,7 @@ public static function OnUserDelete(): void public static function OnUserRestore(): void { } + /** * Event: OnUserVerify * Description: Triggered when a user gets verified. @@ -54,6 +60,7 @@ public static function OnUserRestore(): void public static function OnUserVerify(): void { } + /** * Event: OnUserUnVerify * Description: Triggered when a user needs to verify again. @@ -61,6 +68,7 @@ public static function OnUserVerify(): void public static function OnUserUnVerify(): void { } + /** * Event: OnUserLastSeen * Description: Triggered when a user gets last seen. @@ -68,6 +76,7 @@ public static function OnUserUnVerify(): void public static function OnUserLastSeen(): void { } + /** * Event: OnUserRegister * Description: Triggered when a new user registers. @@ -75,6 +84,7 @@ public static function OnUserLastSeen(): void public static function OnUserRegister(): void { } + /** * Event: OnUserUpdate * Description: Triggered when a user gets updated in the database. diff --git a/app/Plugins/PluginsEventHandler.php b/app/Plugins/PluginsEventHandler.php index 4fa552f..81a9949 100755 --- a/app/Plugins/PluginsEventHandler.php +++ b/app/Plugins/PluginsEventHandler.php @@ -2,15 +2,9 @@ namespace MythicalSystemsFramework\Plugins; -use MythicalSystemsFramework\Plugins\Events\SnowFlakeEvent; -use MythicalSystemsFramework\Plugins\Events\UnitTestEvent; -use MythicalSystemsFramework\Plugins\Events\CronEvent; -use MythicalSystemsFramework\Plugins\Events\PageEvent; - class PluginsEventHandler { public static function registerEvents(): void { - } } diff --git a/app/Plugins/PluginsManager.php b/app/Plugins/PluginsManager.php index 9a068b1..ad1575c 100755 --- a/app/Plugins/PluginsManager.php +++ b/app/Plugins/PluginsManager.php @@ -5,9 +5,7 @@ class PluginsManager { /** - * Get all plugins - * - * @return array + * Get all plugins. */ public static function getAllPlugins(): array { @@ -24,8 +22,6 @@ public static function getAllPlugins(): array $pluginConfigFile = $pluginDir . '/MythicalFramework.json'; $plugins[] = $addonDir; - - } return $plugins; diff --git a/app/Roles/RolesDataHandler.php b/app/Roles/RolesDataHandler.php index f0434bb..26ea4c6 100755 --- a/app/Roles/RolesDataHandler.php +++ b/app/Roles/RolesDataHandler.php @@ -2,32 +2,31 @@ namespace MythicalSystemsFramework\Roles; -use Exception; use MythicalSystemsFramework\Kernel\Logger; -use MythicalSystemsFramework\Kernel\LoggerLevels; use MythicalSystemsFramework\Kernel\LoggerTypes; +use MythicalSystemsFramework\Kernel\LoggerLevels; class RolesDataHandler { /** - * Create a user + * Create a user. * * @param string $name The name of the role * @param int $weight The default is set to 1 * * MAKE SURE YOU CHECK THE DOCS FOR THIS FUNCTION + * * @return string|null The role id in a string */ - public static function create(string $name, int $weight = 1): string|null + public static function create(string $name, int $weight = 1): ?string { try { - - //Connect to the database + // Connect to the database $database = new \MythicalSystemsFramework\Database\MySQL(); $mysqli = $database->connectMYSQLI(); - //Check if the role exists - $stmtRole = $mysqli->prepare("SELECT COUNT(*) FROM framework_roles WHERE name = ?"); - $stmtRole->bind_param("s", $name); + // Check if the role exists + $stmtRole = $mysqli->prepare('SELECT COUNT(*) FROM framework_roles WHERE name = ?'); + $stmtRole->bind_param('s', $name); $stmtRole->execute(); $stmtRole->bind_result($count); @@ -35,108 +34,107 @@ public static function create(string $name, int $weight = 1): string|null $stmtRole->close(); if ($count > 0) { - return "ERROR_ROLE_EXISTS"; + return 'ERROR_ROLE_EXISTS'; } else { - //Insert the role into the database - $stmtInsert = $mysqli->prepare("INSERT INTO framework_roles (name, weight) VALUES (?, ?)"); + // Insert the role into the database + $stmtInsert = $mysqli->prepare('INSERT INTO framework_roles (name, weight) VALUES (?, ?)'); - $stmtInsert->bind_param("si", $name, $weight); + $stmtInsert->bind_param('si', $name, $weight); $stmtInsert->execute(); $stmtInsert->close(); return $mysqli->insert_id; } - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/Roles/RolesDataHandler.php) Failed to create role: " . $e->getMessage()); - return "ERROR_DATABASE_INSERT_FAILED"; + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/Roles/RolesDataHandler.php) Failed to create role: ' . $e->getMessage()); + + return 'ERROR_DATABASE_INSERT_FAILED'; } } /** - * Delete a role + * Delete a role. * * @param int $id The role id * * MAKE SURE YOU CHECK THE DOCS FOR THIS FUNCTION - * @return string|null */ - public static function delete(int $id): string|null + public static function delete(int $id): ?string { try { - if (self::roleExists($id) == "ROLE_MISSING") { - return "ROLE_MISSING"; + if (self::roleExists($id) == 'ROLE_MISSING') { + return 'ROLE_MISSING'; } // Connect to the database $database = new \MythicalSystemsFramework\Database\MySQL(); $mysqli = $database->connectMYSQLI(); // Delete the role - $stmtRole = $mysqli->prepare("DELETE FROM framework_roles WHERE id = ?"); - $stmtRole->bind_param("i", $id); + $stmtRole = $mysqli->prepare('DELETE FROM framework_roles WHERE id = ?'); + $stmtRole->bind_param('i', $id); $stmtRole->execute(); $stmtRole->close(); if ($mysqli->affected_rows > 0) { - return "ROLE_DELETED"; + return 'ROLE_DELETED'; } else { - return "ROLE_DELETE_FAILED"; + return 'ROLE_DELETE_FAILED'; } - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/Roles/RolesDataHandler.php) Failed to delete role: " . $e->getMessage()); - return "ERROR_DATABASE_DELETE_FAILED"; + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/Roles/RolesDataHandler.php) Failed to delete role: ' . $e->getMessage()); + + return 'ERROR_DATABASE_DELETE_FAILED'; } } /** - * Update a role + * Update a role. * * @param int $id The role id * @param string $name The name of the role * @param int $weight The default is set to 1 * * MAKE SURE YOU CHECK THE DOCS FOR THIS FUNCTION - * @return string|null */ - public static function update(int $id, string $name, int $weight = 1): string|null + public static function update(int $id, string $name, int $weight = 1): ?string { try { - if (self::roleExists($id) == "ROLE_MISSING") { - return "ROLE_MISSING"; + if (self::roleExists($id) == 'ROLE_MISSING') { + return 'ROLE_MISSING'; } // Connect to the database $database = new \MythicalSystemsFramework\Database\MySQL(); $mysqli = $database->connectMYSQLI(); // Update the role - $stmtRole = $mysqli->prepare("UPDATE framework_roles SET name = ?, weight = ? WHERE id = ?"); - $stmtRole->bind_param("sii", $name, $weight, $id); + $stmtRole = $mysqli->prepare('UPDATE framework_roles SET name = ?, weight = ? WHERE id = ?'); + $stmtRole->bind_param('sii', $name, $weight, $id); $stmtRole->execute(); $stmtRole->close(); if ($mysqli->affected_rows > 0) { - return "ROLE_UPDATED"; + return 'ROLE_UPDATED'; } else { - return "ROLE_UPDATE_FAILED"; + return 'ROLE_UPDATE_FAILED'; } + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/Roles/RolesDataHandler.php) Failed to update role: ' . $e->getMessage()); - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/Roles/RolesDataHandler.php) Failed to update role: " . $e->getMessage()); - return "ERROR_DATABASE_UPDATE_FAILED"; + return 'ERROR_DATABASE_UPDATE_FAILED'; } } /** - * Get a role + * Get a role. * * @param int $id The role id * @param string $data The data you are looking for * * MAKE SURE YOU CHECK THE DOCS FOR THIS FUNCTION - * @return string|null */ - public static function getSpecificRoleInfo(int $id, string $data): string|null + public static function getSpecificRoleInfo(int $id, string $data): ?string { try { - if (self::roleExists($id) == "ROLE_MISSING") { - return "ROLE_MISSING"; + if (self::roleExists($id) == 'ROLE_MISSING') { + return 'ROLE_MISSING'; } // Connect to the database $database = new \MythicalSystemsFramework\Database\MySQL(); @@ -144,25 +142,26 @@ public static function getSpecificRoleInfo(int $id, string $data): string|null // Get the role info $stmtRole = $mysqli->prepare("SELECT $data FROM framework_roles WHERE id = ?"); - $stmtRole->bind_param("i", $id); + $stmtRole->bind_param('i', $id); $stmtRole->execute(); $stmtRole->bind_result($result); $stmtRole->fetch(); $stmtRole->close(); return $result; - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/Roles/RolesDataHandler.php) Failed to get role info: " . $e->getMessage()); - return "ERROR_DATABASE_SELECT_FAILED"; + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/Roles/RolesDataHandler.php) Failed to get role info: ' . $e->getMessage()); + + return 'ERROR_DATABASE_SELECT_FAILED'; } } /** - * Get all roles with name, weight, and id + * Get all roles with name, weight, and id. * * @return array|null An array of roles with name, weight, and id */ - public static function getAllRoles(): array|null + public static function getAllRoles(): ?array { try { // Connect to the database @@ -170,7 +169,7 @@ public static function getAllRoles(): array|null $mysqli = $database->connectMYSQLI(); // Get all roles - $stmtRoles = $mysqli->prepare("SELECT id, name, weight FROM framework_roles"); + $stmtRoles = $mysqli->prepare('SELECT id, name, weight FROM framework_roles'); $stmtRoles->execute(); $stmtRoles->bind_result($id, $name, $weight); @@ -179,26 +178,26 @@ public static function getAllRoles(): array|null $roles[] = [ 'id' => $id, 'name' => $name, - 'weight' => $weight + 'weight' => $weight, ]; } $stmtRoles->close(); return $roles; - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/Roles/RolesDataHandler.php) Failed to get all roles: " . $e->getMessage()); + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/Roles/RolesDataHandler.php) Failed to get all roles: ' . $e->getMessage()); + return null; } } + /** - * This function just looks if the role exists + * This function just looks if the role exists. * * @param int $id The name of the role - * - * @return string|null */ - public static function roleExists(int $id): string|null + public static function roleExists(int $id): ?string { try { // Connect to the database @@ -206,21 +205,22 @@ public static function roleExists(int $id): string|null $mysqli = $database->connectMYSQLI(); // Check if the role exists - $stmtRole = $mysqli->prepare("SELECT COUNT(*) FROM framework_roles WHERE id = ?"); - $stmtRole->bind_param("i", $id); + $stmtRole = $mysqli->prepare('SELECT COUNT(*) FROM framework_roles WHERE id = ?'); + $stmtRole->bind_param('i', $id); $stmtRole->execute(); $stmtRole->bind_result($count); $stmtRole->fetch(); $stmtRole->close(); if ($count > 0) { - return "ROLE_EXISTS"; + return 'ROLE_EXISTS'; } else { - return "ROLE_MISSING"; + return 'ROLE_MISSING'; } - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/Roles/RolesDataHandler.php) Failed to check if role exists: " . $e->getMessage()); - return "ERROR_DATABASE_INSERT_FAILED"; + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/Roles/RolesDataHandler.php) Failed to check if role exists: ' . $e->getMessage()); + + return 'ERROR_DATABASE_INSERT_FAILED'; } } } diff --git a/app/Roles/RolesHelper.php b/app/Roles/RolesHelper.php index d10d4d4..a29ac9d 100755 --- a/app/Roles/RolesHelper.php +++ b/app/Roles/RolesHelper.php @@ -2,22 +2,15 @@ namespace MythicalSystemsFramework\Roles; -use Exception; -use MythicalSystemsFramework\Kernel\Logger; -use MythicalSystemsFramework\User\UserHelper; - class RolesHelper extends RolesDataHandler { /** - * Get the role name from the role id + * Get the role name from the role id. * * @param string $role_id - * - * @return string|null */ public static function getRoleName(int $role_id): ?string { - return self::getSpecificRoleInfo($role_id, "name"); + return self::getSpecificRoleInfo($role_id, 'name'); } - } diff --git a/app/Roles/RolesPermissionDataHandler.php b/app/Roles/RolesPermissionDataHandler.php index 35be23a..4c0aa49 100755 --- a/app/Roles/RolesPermissionDataHandler.php +++ b/app/Roles/RolesPermissionDataHandler.php @@ -2,22 +2,21 @@ namespace MythicalSystemsFramework\Roles; -use Exception; use MythicalSystemsFramework\Kernel\Logger; -use MythicalSystemsFramework\Kernel\LoggerLevels; use MythicalSystemsFramework\Kernel\LoggerTypes; +use MythicalSystemsFramework\Kernel\LoggerLevels; class RolesPermissionDataHandler { /** - * Create a role permission + * Create a role permission. * * @param int $roleId The role id * @param string $permission The permission * * @return string|null The role permission id in a string */ - public static function create(int $roleId, string $permission): string|null + public static function create(int $roleId, string $permission): ?string { try { // Connect to the database @@ -25,65 +24,63 @@ public static function create(int $roleId, string $permission): string|null $mysqli = $database->connectMYSQLI(); // Insert the role permission into the database - $stmtInsert = $mysqli->prepare("INSERT INTO framework_roles_permissions (role_id, permission) VALUES (?, ?)"); - $stmtInsert->bind_param("is", $roleId, $permission); + $stmtInsert = $mysqli->prepare('INSERT INTO framework_roles_permissions (role_id, permission) VALUES (?, ?)'); + $stmtInsert->bind_param('is', $roleId, $permission); $stmtInsert->execute(); $stmtInsert->close(); return $mysqli->insert_id; - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/Roles/RolesPermissionDataHandler.php) Failed to create role permission: " . $e->getMessage()); - return "ERROR_DATABASE_INSERT_FAILED"; + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/Roles/RolesPermissionDataHandler.php) Failed to create role permission: ' . $e->getMessage()); + + return 'ERROR_DATABASE_INSERT_FAILED'; } } /** - * Delete a role permission + * Delete a role permission. * * @param int $id The role permission id - * - * @return string|null */ - public static function delete(int $id): string|null + public static function delete(int $id): ?string { try { - if (self::rolePermissionExists($id) == "ROLE_PERMISSION_MISSING") { - return "ROLE_PERMISSION_MISSING"; + if (self::rolePermissionExists($id) == 'ROLE_PERMISSION_MISSING') { + return 'ROLE_PERMISSION_MISSING'; } // Connect to the database $database = new \MythicalSystemsFramework\Database\MySQL(); $mysqli = $database->connectMYSQLI(); // Delete the role permission - $stmtRole = $mysqli->prepare("DELETE FROM framework_roles_permissions WHERE id = ?"); - $stmtRole->bind_param("i", $id); + $stmtRole = $mysqli->prepare('DELETE FROM framework_roles_permissions WHERE id = ?'); + $stmtRole->bind_param('i', $id); $stmtRole->execute(); $stmtRole->close(); if ($mysqli->affected_rows > 0) { - return "ROLE_PERMISSION_DELETED"; + return 'ROLE_PERMISSION_DELETED'; } else { - return "ROLE_PERMISSION_DELETE_FAILED"; + return 'ROLE_PERMISSION_DELETE_FAILED'; } - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/Roles/RolesPermissionDataHandler.php) Failed to delete role permission: " . $e->getMessage()); - return "ERROR_DATABASE_DELETE_FAILED"; + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/Roles/RolesPermissionDataHandler.php) Failed to delete role permission: ' . $e->getMessage()); + + return 'ERROR_DATABASE_DELETE_FAILED'; } } /** - * Update a role permission + * Update a role permission. * * @param int $id The role permission id * @param string $permission The permission - * - * @return string|null */ - public static function update(int $id, string $permission): string|null + public static function update(int $id, string $permission): ?string { try { - if (self::rolePermissionExists($id) == "ROLE_PERMISSION_MISSING") { - return "ROLE_PERMISSION_MISSING"; + if (self::rolePermissionExists($id) == 'ROLE_PERMISSION_MISSING') { + return 'ROLE_PERMISSION_MISSING'; } // Connect to the database @@ -91,24 +88,25 @@ public static function update(int $id, string $permission): string|null $mysqli = $database->connectMYSQLI(); // Update the role permission - $stmtRole = $mysqli->prepare("UPDATE framework_roles_permissions SET permission = ? WHERE id = ?"); - $stmtRole->bind_param("si", $permission, $id); + $stmtRole = $mysqli->prepare('UPDATE framework_roles_permissions SET permission = ? WHERE id = ?'); + $stmtRole->bind_param('si', $permission, $id); $stmtRole->execute(); $stmtRole->close(); if ($mysqli->affected_rows > 0) { - return "ROLE_PERMISSION_UPDATED"; + return 'ROLE_PERMISSION_UPDATED'; } else { - return "ROLE_PERMISSION_UPDATE_FAILED"; + return 'ROLE_PERMISSION_UPDATE_FAILED'; } - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/Roles/RolesPermissionDataHandler.php) Failed to update role permission: " . $e->getMessage()); - return "ERROR_DATABASE_UPDATE_FAILED"; + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/Roles/RolesPermissionDataHandler.php) Failed to update role permission: ' . $e->getMessage()); + + return 'ERROR_DATABASE_UPDATE_FAILED'; } } /** - * Get all permissions for a role + * Get all permissions for a role. * * @param int $roleId The role id * @@ -122,13 +120,13 @@ public static function getAllPermissionsForRole(int $roleId): ?array $mysqli = $database->connectMYSQLI(); // Check if the role exists - if (self::rolePermissionExists($roleId) == "ROLE_PERMISSION_MISSING") { + if (self::rolePermissionExists($roleId) == 'ROLE_PERMISSION_MISSING') { return null; } // Get all permissions for the role - $stmtRole = $mysqli->prepare("SELECT permission FROM framework_roles_permissions WHERE role_id = ?"); - $stmtRole->bind_param("i", $roleId); + $stmtRole = $mysqli->prepare('SELECT permission FROM framework_roles_permissions WHERE role_id = ?'); + $stmtRole->bind_param('i', $roleId); $stmtRole->execute(); $stmtRole->bind_result($permission); @@ -140,25 +138,24 @@ public static function getAllPermissionsForRole(int $roleId): ?array $stmtRole->close(); return $permissions; - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/Roles/RolesPermissionDataHandler.php) Failed to get permissions for role: " . $e->getMessage()); + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/Roles/RolesPermissionDataHandler.php) Failed to get permissions for role: ' . $e->getMessage()); + return null; } } /** - * Get a role permission + * Get a role permission. * * @param int $id The role permission id * @param string $data The data you are looking for - * - * @return string|null */ - public static function getSpecificRolePermissionInfo(int $id, string $data): string|null + public static function getSpecificRolePermissionInfo(int $id, string $data): ?string { try { - if (self::rolePermissionExists($id) == "ROLE_PERMISSION_MISSING") { - return "ROLE_PERMISSION_MISSING"; + if (self::rolePermissionExists($id) == 'ROLE_PERMISSION_MISSING') { + return 'ROLE_PERMISSION_MISSING'; } // Connect to the database $database = new \MythicalSystemsFramework\Database\MySQL(); @@ -166,27 +163,26 @@ public static function getSpecificRolePermissionInfo(int $id, string $data): str // Get the role permission info $stmtRole = $mysqli->prepare("SELECT $data FROM framework_roles_permissions WHERE id = ?"); - $stmtRole->bind_param("i", $id); + $stmtRole->bind_param('i', $id); $stmtRole->execute(); $stmtRole->bind_result($result); $stmtRole->fetch(); $stmtRole->close(); return $result; - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/Roles/RolesPermissionDataHandler.php) Failed to get role permission info: " . $e->getMessage()); - return "ERROR_DATABASE_SELECT_FAILED"; + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/Roles/RolesPermissionDataHandler.php) Failed to get role permission info: ' . $e->getMessage()); + + return 'ERROR_DATABASE_SELECT_FAILED'; } } /** - * This function checks if the role permission exists + * This function checks if the role permission exists. * * @param int $id The role permission id - * - * @return string|null */ - public static function rolePermissionExists(int $id): string|null + public static function rolePermissionExists(int $id): ?string { try { // Connect to the database @@ -194,33 +190,32 @@ public static function rolePermissionExists(int $id): string|null $mysqli = $database->connectMYSQLI(); // Check if the role permission exists - $stmtRole = $mysqli->prepare("SELECT COUNT(*) FROM framework_roles_permissions WHERE id = ?"); - $stmtRole->bind_param("i", $id); + $stmtRole = $mysqli->prepare('SELECT COUNT(*) FROM framework_roles_permissions WHERE id = ?'); + $stmtRole->bind_param('i', $id); $stmtRole->execute(); $stmtRole->bind_result($count); $stmtRole->fetch(); $stmtRole->close(); if ($count > 0) { - return "ROLE_PERMISSION_EXISTS"; + return 'ROLE_PERMISSION_EXISTS'; } else { - return "ROLE_PERMISSION_MISSING"; + return 'ROLE_PERMISSION_MISSING'; } - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/Roles/RolesPermissionDataHandler.php) Failed to check if role permission exists: " . $e->getMessage()); - return "ERROR_DATABASE_INSERT_FAILED"; + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/Roles/RolesPermissionDataHandler.php) Failed to check if role permission exists: ' . $e->getMessage()); + + return 'ERROR_DATABASE_INSERT_FAILED'; } } /** - * Check if a role has a specific permission + * Check if a role has a specific permission. * * @param int $roleId The role id * @param string $permission The permission - * - * @return string|null */ - public static function doesRoleHavePermission(int $roleId, string $permission): string|null + public static function doesRoleHavePermission(int $roleId, string $permission): ?string { try { // Connect to the database @@ -228,21 +223,22 @@ public static function doesRoleHavePermission(int $roleId, string $permission): $mysqli = $database->connectMYSQLI(); // Check if the role has the permission - $stmtRole = $mysqli->prepare("SELECT COUNT(*) FROM framework_roles_permissions WHERE role_id = ? AND permission = ?"); - $stmtRole->bind_param("is", $roleId, $permission); + $stmtRole = $mysqli->prepare('SELECT COUNT(*) FROM framework_roles_permissions WHERE role_id = ? AND permission = ?'); + $stmtRole->bind_param('is', $roleId, $permission); $stmtRole->execute(); $stmtRole->bind_result($count); $stmtRole->fetch(); $stmtRole->close(); if ($count > 0) { - return "ROLE_HAS_PERMISSION"; + return 'ROLE_HAS_PERMISSION'; } else { - return "ROLE_DOES_NOT_HAVE_PERMISSION"; + return 'ROLE_DOES_NOT_HAVE_PERMISSION'; } - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/Roles/RolesPermissionDataHandler.php) Failed to check role permission: " . $e->getMessage()); - return "ERROR_DATABASE_SELECT_FAILED"; + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/Roles/RolesPermissionDataHandler.php) Failed to check role permission: ' . $e->getMessage()); + + return 'ERROR_DATABASE_SELECT_FAILED'; } } } diff --git a/app/User/Exceptions/UserException.php b/app/User/Exceptions/UserException.php index 013949e..723fec0 100755 --- a/app/User/Exceptions/UserException.php +++ b/app/User/Exceptions/UserException.php @@ -2,15 +2,13 @@ namespace MythicalSystemsFramework\User\Exceptions; -use Exception; -use Throwable; - -class UserException extends Exception +class UserException extends \Exception { - public function __construct($message, $code = 0, Throwable $previous = null) + public function __construct($message, $code = 0, ?\Throwable $previous = null) { parent::__construct($message, $code, $previous); } + public function __toString(): string { return __CLASS__ . ": [{$this->code}]: {$this->message}\n"; diff --git a/app/User/UserDataHandler.php b/app/User/UserDataHandler.php index 4ce0595..bc0f864 100755 --- a/app/User/UserDataHandler.php +++ b/app/User/UserDataHandler.php @@ -10,40 +10,33 @@ namespace MythicalSystemsFramework\User; -use DateTime; -use Exception; -use MythicalSystemsFramework\Kernel\Encryption as enc; -use MythicalSystemsFramework\Kernel\LoggerLevels; +use Gravatar\Gravatar; use MythicalSystemsFramework\Kernel\LoggerTypes; -use MythicalSystemsFramework\Managers\ConfigManager as cfg; -use MythicalSystemsFramework\Managers\SnowFlakeManager; +use MythicalSystemsFramework\Kernel\LoggerLevels; use MythicalSystemsFramework\Kernel\Logger as logger; -use Gravatar\Gravatar; -use MythicalSystems\User\Cookies; -use MythicalSystemsFramework\Roles\RolesDataHandler; -use MythicalSystemsFramework\Roles\RolesPermissionDataHandler; +use MythicalSystemsFramework\Kernel\Encryption as enc; +use MythicalSystemsFramework\Managers\SnowFlakeManager; class UserDataHandler { /** - * Login a user + * Login a user. * - * @param string $email - * @param string $password * @param string $ip * * MAKE SURE YOU CHECK THE DOCS FOR THIS FUNCTION + * * @return string|null The user token */ - public static function login(string $email, string $password, string $ip): string|null + public static function login(string $email, string $password, string $ip): ?string { try { - //Connect to the database + // Connect to the database $database = new \MythicalSystemsFramework\Database\MySQL(); $mysqli = $database->connectMYSQLI(); - //Check if the user exists - $stmt = $mysqli->prepare("SELECT COUNT(*) FROM framework_users WHERE email = ? OR username = ?"); - $stmt->bind_param("ss", $email, $email); + // Check if the user exists + $stmt = $mysqli->prepare('SELECT COUNT(*) FROM framework_users WHERE email = ? OR username = ?'); + $stmt->bind_param('ss', $email, $email); $stmt->execute(); $stmt->bind_result($count); @@ -51,72 +44,71 @@ public static function login(string $email, string $password, string $ip): strin $stmt->close(); if ($count == 0) { - return "ERROR_USER_NOT_FOUND"; + return 'ERROR_USER_NOT_FOUND'; } else { - //Get the user data - $stmt = $mysqli->prepare("SELECT password token FROM framework_users WHERE email = ?"); - $stmt->bind_param("s", $email); + // Get the user data + $stmt = $mysqli->prepare('SELECT password token FROM framework_users WHERE email = ?'); + $stmt->bind_param('s', $email); $stmt->execute(); $stmt->bind_result($db_password, $token); $stmt->fetch(); $stmt->close(); - //Check if the password is correct + // Check if the password is correct if (enc::decrypt($db_password) == $password) { - if (UserHelper::isUserBanned($token) == "USER_BANNED") { - return "ERROR_USER_BANNED"; + if (UserHelper::isUserBanned($token) == 'USER_BANNED') { + return 'ERROR_USER_BANNED'; } - if (UserHelper::isUserDeleted($token) == "USER_DELETED") { - return "ERROR_USER_DELETED"; + if (UserHelper::isUserDeleted($token) == 'USER_DELETED') { + return 'ERROR_USER_DELETED'; } - if (UserHelper::isUserVerified($token) == "USER_NOT_VERIFIED") { - return "ERROR_USER_NOT_VERIFIED"; + if (UserHelper::isUserVerified($token) == 'USER_NOT_VERIFIED') { + return 'ERROR_USER_NOT_VERIFIED'; } - //Update the last ip - $stmt = $mysqli->prepare("UPDATE framework_users SET last_ip = ? WHERE email = ?"); - $stmt->bind_param("ss", $ip, $email); + // Update the last ip + $stmt = $mysqli->prepare('UPDATE framework_users SET last_ip = ? WHERE email = ?'); + $stmt->bind_param('ss', $ip, $email); $stmt->execute(); $stmt->close(); // Update last seen! UserHelper::updateLastSeen($token, $ip); + return $token; } else { - return "ERROR_PASSWORD_INCORRECT"; + return 'ERROR_PASSWORD_INCORRECT'; } } } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserDataHandler.php) Failed to login user: " . $e->getMessage()); - return "ERROR_DATABASE_SELECT_FAILED"; + logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/User/UserDataHandler.php) Failed to login user: ' . $e->getMessage()); + + return 'ERROR_DATABASE_SELECT_FAILED'; } } + /** - * Create a user + * Create a user. * - * @param string $username - * @param string $password - * @param string $email - * @param string $first_name - * @param string $last_name * @param string $ip * * MAKE SURE YOU CHECK THE DOCS FOR THIS FUNCTION + * * @return string|null The user token */ - public static function create(string $username, string $password, string $email, string $first_name, string $last_name, string $ip): string|null + public static function create(string $username, string $password, string $email, string $first_name, string $last_name, string $ip): ?string { try { $username = enc::encrypt($username); $email = enc::encrypt($email); - //Connect to the database + // Connect to the database $database = new \MythicalSystemsFramework\Database\MySQL(); $mysqli = $database->connectMYSQLI(); - //New gravatar instance for avatars! + // New gravatar instance for avatars! $gravatar = new Gravatar([], true); - //Check if the username exists - $stmtUsername = $mysqli->prepare("SELECT COUNT(*) FROM framework_users WHERE username = ?"); - $stmtUsername->bind_param("s", $username); + // Check if the username exists + $stmtUsername = $mysqli->prepare('SELECT COUNT(*) FROM framework_users WHERE username = ?'); + $stmtUsername->bind_param('s', $username); $stmtUsername->execute(); $stmtUsername->bind_result($count); @@ -124,31 +116,31 @@ public static function create(string $username, string $password, string $email, $stmtUsername->close(); if ($count > 0) { - return "ERROR_USERNAME_EXISTS"; + return 'ERROR_USERNAME_EXISTS'; } else { - //Check if the email exists - $stmtEmail = $mysqli->prepare("SELECT COUNT(*) FROM framework_users WHERE email = ?"); - $stmtEmail->bind_param("s", $email); + // Check if the email exists + $stmtEmail = $mysqli->prepare('SELECT COUNT(*) FROM framework_users WHERE email = ?'); + $stmtEmail->bind_param('s', $email); $stmtEmail->execute(); $stmtEmail->bind_result($emailCount); $stmtEmail->fetch(); $stmtEmail->close(); if ($emailCount > 0) { - return "ERROR_EMAIL_EXISTS"; + return 'ERROR_EMAIL_EXISTS'; } else { - //Insert the user into the database - $stmtInsert = $mysqli->prepare("INSERT INTO framework_users (username, first_name, last_name, email, password, avatar, uuid, token, first_ip, last_ip) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"); - //Hash the password + // Insert the user into the database + $stmtInsert = $mysqli->prepare('INSERT INTO framework_users (username, first_name, last_name, email, password, avatar, uuid, token, first_ip, last_ip) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'); + // Hash the password $password = enc::encrypt($password); - //Generate a unic user id! UUID - $uuid = SnowflakeManager::getUniqueUserID(); - $account_token = "mythicalframework_" . base64_encode($uuid . '_' . DateTime::createFromFormat('U.u', microtime(true))->format("Y-m-d H:i:s.u") . rand(1000, 9999) . $ip . enc::encrypt($email)); + // Generate a unic user id! UUID + $uuid = SnowFlakeManager::getUniqueUserID(); + $account_token = 'mythicalframework_' . base64_encode($uuid . '_' . \DateTime::createFromFormat('U.u', microtime(true))->format('Y-m-d H:i:s.u') . mt_rand(1000, 9999) . $ip . enc::encrypt($email)); $avatar_url = $gravatar->avatar(enc::decrypt($email)); $first_name = enc::encrypt($first_name); $last_name = enc::encrypt($last_name); $ip = enc::encrypt($ip); - $stmtInsert->bind_param("ssssssssss", $username, $first_name, $last_name, $email, $password, $avatar_url, $uuid, $account_token, $ip, $ip); + $stmtInsert->bind_param('ssssssssss', $username, $first_name, $last_name, $email, $password, $avatar_url, $uuid, $account_token, $ip, $ip); $stmtInsert->execute(); $stmtInsert->close(); @@ -156,13 +148,14 @@ public static function create(string $username, string $password, string $email, } } } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserDataHandler.php) Failed to create user: " . $e->getMessage()); - return "ERROR_DATABASE_INSERT_FAILED"; + logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/User/UserDataHandler.php) Failed to create user: ' . $e->getMessage()); + + return 'ERROR_DATABASE_INSERT_FAILED'; } } /** - * Get the user data + * Get the user data. * * @param string $account_token The token of the account you want the data for! * @param string $data The data you want to get from the user! @@ -170,19 +163,19 @@ public static function create(string $username, string $password, string $email, * * @return string The user data or null if not found! */ - public static function getSpecificUserData(string $account_token, string $data, bool $encrypted = true): string|null + public static function getSpecificUserData(string $account_token, string $data, bool $encrypted = true): ?string { try { $isAccountValid = UserHelper::isSessionValid($account_token); if (!$isAccountValid) { - return "ERROR_ACCOUNT_NOT_VALID"; + return 'ERROR_ACCOUNT_NOT_VALID'; } - //Connect to the database + // Connect to the database $database = new \MythicalSystemsFramework\Database\MySQL(); $mysqli = $database->connectMYSQLI(); - //Check if the user exists - $stmt = $mysqli->prepare("SELECT * FROM framework_users WHERE token = ?"); - $stmt->bind_param("s", $account_token); + // Check if the user exists + $stmt = $mysqli->prepare('SELECT * FROM framework_users WHERE token = ?'); + $stmt->bind_param('s', $account_token); $stmt->execute(); $result = $stmt->get_result(); $user = $result->fetch_assoc(); @@ -194,16 +187,17 @@ public static function getSpecificUserData(string $account_token, string $data, return $user[$data]; } } else { - return "ERROR_FIELD_NOT_FOUND"; + return 'ERROR_FIELD_NOT_FOUND'; } } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserDataHandler.php) Failed to get user data: " . $e->getMessage()); - return "ERROR_DATABASE_SELECT_FAILED"; + logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/User/UserDataHandler.php) Failed to get user data: ' . $e->getMessage()); + + return 'ERROR_DATABASE_SELECT_FAILED'; } } /** - * Update the user data + * Update the user data. * * @param string $account_token The token of the account you want to update the data for! * @param string $data The data you want to update! @@ -217,24 +211,25 @@ public static function updateSpecificUserData(string $account_token, string $dat try { $isAccountValid = UserHelper::isSessionValid($account_token); if (!$isAccountValid) { - return "ERROR_ACCOUNT_NOT_VALID"; + return 'ERROR_ACCOUNT_NOT_VALID'; } - //Connect to the database + // Connect to the database $database = new \MythicalSystemsFramework\Database\MySQL(); $mysqli = $database->connectMYSQLI(); - //Check if the user exists + // Check if the user exists $stmt = $mysqli->prepare("UPDATE framework_users SET $data = ? WHERE token = ?"); if ($encrypted) { $value = enc::encrypt($value); } - $stmt->bind_param("ss", $value, $account_token); + $stmt->bind_param('ss', $value, $account_token); $stmt->execute(); $stmt->close(); - return "SUCCESS"; + + return 'SUCCESS'; } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserDataHandler.php) Failed to update user: " . $e->getMessage()); - return "ERROR_DATABASE_UPDATE_FAILED"; + logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/User/UserDataHandler.php) Failed to update user: ' . $e->getMessage()); + + return 'ERROR_DATABASE_UPDATE_FAILED'; } } - } diff --git a/app/User/UserHelper.php b/app/User/UserHelper.php index 88290c2..25f6c88 100755 --- a/app/User/UserHelper.php +++ b/app/User/UserHelper.php @@ -6,11 +6,10 @@ namespace MythicalSystemsFramework\User; -use Exception; use MythicalSystems\User\Cookies; use MythicalSystemsFramework\Kernel\Logger; -use MythicalSystemsFramework\Kernel\LoggerLevels; use MythicalSystemsFramework\Kernel\LoggerTypes; +use MythicalSystemsFramework\Kernel\LoggerLevels; use MythicalSystemsFramework\Roles\RolesDataHandler; use MythicalSystemsFramework\Roles\RolesPermissionDataHandler; @@ -19,83 +18,86 @@ class UserHelper extends UserDataHandler /** * This function will ban a user from the system. * - * @param string $account_token The account token of the user you want to ban. + * @param string $account_token the account token of the user you want to ban * - * @return string The response of the ban. + * @return string the response of the ban */ public static function banUser(string $account_token): string { try { if (self::isSessionValid($account_token)) { - $update_user = self::updateSpecificUserData($account_token, "banned", "YES", false); - if ($update_user == "SUCCESS") { - return "USER_BANNED"; + $update_user = self::updateSpecificUserData($account_token, 'banned', 'YES', false); + if ($update_user == 'SUCCESS') { + return 'USER_BANNED'; } else { - return "ERROR_DATABASE_UPDATE_FAILED"; + return 'ERROR_DATABASE_UPDATE_FAILED'; } } else { - return "ERROR_ACCOUNT_NOT_VALID"; + return 'ERROR_ACCOUNT_NOT_VALID'; } } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserHelper.php) Failed to ban user: " . $e->getMessage()); - return "ERROR_DATABASE_UPDATE_FAILED"; + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/User/UserHelper.php) Failed to ban user: ' . $e->getMessage()); + + return 'ERROR_DATABASE_UPDATE_FAILED'; } } /** * This function will unban a user from the system. * - * @param string $account_token The account token of the user you want to unban. + * @param string $account_token the account token of the user you want to unban * - * @return string The response of the unban. + * @return string the response of the unban */ public static function unbanUser(string $account_token): string { try { if (self::isSessionValid($account_token)) { - $update_user = self::updateSpecificUserData($account_token, "banned", "NO", false); - if ($update_user == "SUCCESS") { - return "USER_UNBANNED"; + $update_user = self::updateSpecificUserData($account_token, 'banned', 'NO', false); + if ($update_user == 'SUCCESS') { + return 'USER_UNBANNED'; } else { - return "ERROR_DATABASE_UPDATE_FAILED"; + return 'ERROR_DATABASE_UPDATE_FAILED'; } } else { - return "ERROR_ACCOUNT_NOT_VALID"; + return 'ERROR_ACCOUNT_NOT_VALID'; } } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserHelper.php) Failed to unban user: " . $e->getMessage()); - return "ERROR_DATABASE_UPDATE_FAILED"; + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/User/UserHelper.php) Failed to unban user: ' . $e->getMessage()); + + return 'ERROR_DATABASE_UPDATE_FAILED'; } } /** * This function will check if the user is banned. * - * @param string $account_token The account token of the user you want to check. + * @param string $account_token the account token of the user you want to check * - * @return string If the user is banned or not. + * @return string if the user is banned or not */ public static function isUserBanned(string $account_token): string { try { if (self::isSessionValid($account_token)) { - $ban_state = self::getSpecificUserData($account_token, "banned", false); - if ($ban_state == "NO") { - return "USER_NOT_BANNED"; + $ban_state = self::getSpecificUserData($account_token, 'banned', false); + if ($ban_state == 'NO') { + return 'USER_NOT_BANNED'; } else { - return "USER_BANNED"; + return 'USER_BANNED'; } } else { - return "ERROR_ACCOUNT_NOT_VALID"; + return 'ERROR_ACCOUNT_NOT_VALID'; } } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserHelper.php) Failed to check if user is banned: " . $e->getMessage()); - return "ERROR_DATABASE_SELECT_FAILED"; + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/User/UserHelper.php) Failed to check if user is banned: ' . $e->getMessage()); + + return 'ERROR_DATABASE_SELECT_FAILED'; } } /** - * Check if the user session is valid + * Check if the user session is valid. * * @param string $account_token The token of the account you want the check the session for! * @@ -104,12 +106,12 @@ public static function isUserBanned(string $account_token): string public static function isSessionValid(string $account_token): bool { try { - //Connect to the database + // Connect to the database $database = new \MythicalSystemsFramework\Database\MySQL(); $mysqli = $database->connectMYSQLI(); - //Check if the user exists - $stmt = $mysqli->prepare("SELECT COUNT(*) FROM framework_users WHERE token = ?"); - $stmt->bind_param("s", $account_token); + // Check if the user exists + $stmt = $mysqli->prepare('SELECT COUNT(*) FROM framework_users WHERE token = ?'); + $stmt->bind_param('s', $account_token); $stmt->execute(); $stmt->bind_result($count); @@ -122,260 +124,267 @@ public static function isSessionValid(string $account_token): bool return true; } } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserDataHandler.php) Failed to validate user: " . $e->getMessage()); + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/User/UserDataHandler.php) Failed to validate user: ' . $e->getMessage()); + return false; } } /** - * Log the user out of his account + * Log the user out of his account. * * @return void This functions removes the token header! */ public static function killSession(): void { - //Kill the session + // Kill the session session_destroy(); - setcookie("token", "", time() - 3600); - Cookies::unSetCookie("token"); + setcookie('token', '', time() - 3600); + Cookies::unSetCookie('token'); } /** - * This function will soft delete a user + * This function will soft delete a user. * - * @param string $account_token The account token of the user you want to delete. + * @param string $account_token the account token of the user you want to delete * - * @return string The response of the delete. + * @return string the response of the delete */ public static function deleteUser(string $account_token): string { try { if (self::isSessionValid($account_token)) { - $update_user = self::updateSpecificUserData($account_token, "deleted", "true", false); - if ($update_user == "SUCCESS") { - return "USER_DELETED"; + $update_user = self::updateSpecificUserData($account_token, 'deleted', 'true', false); + if ($update_user == 'SUCCESS') { + return 'USER_DELETED'; } else { - return "ERROR_DATABASE_UPDATE_FAILED"; + return 'ERROR_DATABASE_UPDATE_FAILED'; } } else { - return "ERROR_ACCOUNT_NOT_VALID"; + return 'ERROR_ACCOUNT_NOT_VALID'; } } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserHelper.php) Failed to delete user: " . $e->getMessage()); - return "ERROR_DATABASE_UPDATE_FAILED"; + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/User/UserHelper.php) Failed to delete user: ' . $e->getMessage()); + + return 'ERROR_DATABASE_UPDATE_FAILED'; } } /** - * This function will restore a soft deleted user + * This function will restore a soft deleted user. * - * @param string $account_token The account token of the user you want to restore. + * @param string $account_token the account token of the user you want to restore * - * @return string The response of the restore. + * @return string the response of the restore */ public static function restoreUser(string $account_token): string { try { if (self::isSessionValid($account_token)) { - $update_user = self::updateSpecificUserData($account_token, "deleted", "false", false); - if ($update_user == "SUCCESS") { - return "USER_RESTORED"; + $update_user = self::updateSpecificUserData($account_token, 'deleted', 'false', false); + if ($update_user == 'SUCCESS') { + return 'USER_RESTORED'; } else { - return "ERROR_DATABASE_UPDATE_FAILED"; + return 'ERROR_DATABASE_UPDATE_FAILED'; } } else { - return "ERROR_ACCOUNT_NOT_VALID"; + return 'ERROR_ACCOUNT_NOT_VALID'; } } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserHelper.php) Failed to restore user: " . $e->getMessage()); - return "ERROR_DATABASE_UPDATE_FAILED"; + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/User/UserHelper.php) Failed to restore user: ' . $e->getMessage()); + + return 'ERROR_DATABASE_UPDATE_FAILED'; } } /** - * This function will check if the user is soft deleted + * This function will check if the user is soft deleted. * - * @param string $account_token The account token of the user you want to check. + * @param string $account_token the account token of the user you want to check * - * @return string The response of the check. + * @return string the response of the check */ public static function isUserDeleted(string $account_token): string { try { if (self::isSessionValid($account_token)) { - $delete_state = self::getSpecificUserData($account_token, "deleted", false); - if ($delete_state == "false") { - return "USER_NOT_DELETED"; + $delete_state = self::getSpecificUserData($account_token, 'deleted', false); + if ($delete_state == 'false') { + return 'USER_NOT_DELETED'; } else { - return "USER_DELETED"; + return 'USER_DELETED'; } } else { - return "ERROR_ACCOUNT_NOT_VALID"; + return 'ERROR_ACCOUNT_NOT_VALID'; } } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserHelper.php) Failed to check if user is deleted: " . $e->getMessage()); - return "ERROR_DATABASE_SELECT_FAILED"; + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/User/UserHelper.php) Failed to check if user is deleted: ' . $e->getMessage()); + + return 'ERROR_DATABASE_SELECT_FAILED'; } } /** - * This function will check if the user is verified + * This function will check if the user is verified. * - * @param string $account_token The account token of the user you want to check. + * @param string $account_token the account token of the user you want to check * - * @return string The response of the check. + * @return string the response of the check */ public static function isUserVerified(string $account_token): string { try { if (self::isSessionValid($account_token)) { - $verified_state = self::getSpecificUserData($account_token, "verified", false); - if ($verified_state == "false") { - return "USER_NOT_VERIFIED"; + $verified_state = self::getSpecificUserData($account_token, 'verified', false); + if ($verified_state == 'false') { + return 'USER_NOT_VERIFIED'; } else { - return "USER_VERIFIED"; + return 'USER_VERIFIED'; } } else { - return "ERROR_ACCOUNT_NOT_VALID"; + return 'ERROR_ACCOUNT_NOT_VALID'; } } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserHelper.php) Failed to check if user is verified: " . $e->getMessage()); - return "ERROR_DATABASE_SELECT_FAILED"; + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/User/UserHelper.php) Failed to check if user is verified: ' . $e->getMessage()); + + return 'ERROR_DATABASE_SELECT_FAILED'; } } /** - * This function will verify a user + * This function will verify a user. * - * @param string $account_token The account token of the user you want to verify. + * @param string $account_token the account token of the user you want to verify * - * @return string The response of the verification. + * @return string the response of the verification */ public static function verifyUser(string $account_token): string { try { if (self::isSessionValid($account_token)) { - $update_user = self::updateSpecificUserData($account_token, "verified", "true", false); - if ($update_user == "SUCCESS") { - return "USER_VERIFIED"; + $update_user = self::updateSpecificUserData($account_token, 'verified', 'true', false); + if ($update_user == 'SUCCESS') { + return 'USER_VERIFIED'; } else { - return "ERROR_DATABASE_UPDATE_FAILED"; + return 'ERROR_DATABASE_UPDATE_FAILED'; } } else { - return "ERROR_ACCOUNT_NOT_VALID"; + return 'ERROR_ACCOUNT_NOT_VALID'; } } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserHelper.php) Failed to verify user: " . $e->getMessage()); - return "ERROR_DATABASE_UPDATE_FAILED"; + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/User/UserHelper.php) Failed to verify user: ' . $e->getMessage()); + + return 'ERROR_DATABASE_UPDATE_FAILED'; } } /** - * This function will unverify a user + * This function will unverify a user. * - * @param string $account_token The account token of the user you want to unverify. + * @param string $account_token the account token of the user you want to unverify * - * @return string The response of the unverification. + * @return string the response of the unverification */ public static function unverifyUser(string $account_token): string { try { if (self::isSessionValid($account_token)) { - $update_user = self::updateSpecificUserData($account_token, "verified", "false", false); - if ($update_user == "SUCCESS") { - return "USER_UNVERIFIED"; + $update_user = self::updateSpecificUserData($account_token, 'verified', 'false', false); + if ($update_user == 'SUCCESS') { + return 'USER_UNVERIFIED'; } else { - return "ERROR_DATABASE_UPDATE_FAILED"; + return 'ERROR_DATABASE_UPDATE_FAILED'; } } else { - return "ERROR_ACCOUNT_NOT_VALID"; + return 'ERROR_ACCOUNT_NOT_VALID'; } } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserHelper.php) Failed to unverify user: " . $e->getMessage()); - return "ERROR_DATABASE_UPDATE_FAILED"; + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/User/UserHelper.php) Failed to unverify user: ' . $e->getMessage()); + + return 'ERROR_DATABASE_UPDATE_FAILED'; } } /** - * This function will update the last seen and the last ip of the user - * - * @param string $account_token The account token of the user you want to update. - * @param string $ip The ip of the user. + * This function will update the last seen and the last ip of the user. * - * @return string + * @param string $account_token the account token of the user you want to update + * @param string $ip the ip of the user */ public static function updateLastSeen(string $account_token, string $ip): string { try { if (self::isSessionValid($account_token)) { - $update_user = self::updateSpecificUserData($account_token, "last_seen", date("Y-m-d H:i:s"), false); - if ($update_user == "SUCCESS") { - $update_user = self::updateSpecificUserData($account_token, "last_ip", $ip, false); - if ($update_user == "SUCCESS") { - return "SUCCESS"; + $update_user = self::updateSpecificUserData($account_token, 'last_seen', date('Y-m-d H:i:s'), false); + if ($update_user == 'SUCCESS') { + $update_user = self::updateSpecificUserData($account_token, 'last_ip', $ip, false); + if ($update_user == 'SUCCESS') { + return 'SUCCESS'; } else { - return "ERROR_DATABASE_UPDATE_FAILED"; + return 'ERROR_DATABASE_UPDATE_FAILED'; } } else { - return "ERROR_DATABASE_UPDATE_FAILED"; + return 'ERROR_DATABASE_UPDATE_FAILED'; } } else { - return "ERROR_ACCOUNT_NOT_VALID"; + return 'ERROR_ACCOUNT_NOT_VALID'; } } catch (\Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserHelper.php) Failed to update last seen: " . $e->getMessage()); - return "ERROR_DATABASE_UPDATE_FAILED"; + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/User/UserHelper.php) Failed to update last seen: ' . $e->getMessage()); + + return 'ERROR_DATABASE_UPDATE_FAILED'; } } /** - * This function will return your the role id of a user + * This function will return your the role id of a user. * - * @param string $account_token The account token of the user you want to get the role id from. + * @param string $account_token the account token of the user you want to get the role id from * - * @return string|null The role id of the user or an error. + * @return string|null the role id of the user or an error */ - public static function getUserRoleId($account_token): string|null + public static function getUserRoleId($account_token): ?string { try { if (self::isSessionValid($account_token)) { - $role_id = self::getSpecificUserData($account_token, "role", false); + $role_id = self::getSpecificUserData($account_token, 'role', false); + return $role_id; } else { - return "ERROR_ACCOUNT_NOT_VALID"; + return 'ERROR_ACCOUNT_NOT_VALID'; } - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserHelper.php) Failed to get user role id: " . $e->getMessage()); - return "ERROR_DATABASE_SELECT_FAILED"; + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/User/UserHelper.php) Failed to get user role id: ' . $e->getMessage()); + + return 'ERROR_DATABASE_SELECT_FAILED'; } } /** * Does this user have permission? * - * @param string $account_token The account token. - * @param string $permission The permission name. - * - * @return string|null + * @param string $account_token the account token + * @param string $permission the permission name */ - public static function doesUserHavePermission(string $account_token, string $permission): string|null + public static function doesUserHavePermission(string $account_token, string $permission): ?string { try { - $role_id = UserHelper::getSpecificUserData($account_token, "role", false); + $role_id = UserHelper::getSpecificUserData($account_token, 'role', false); $role_check = RolesDataHandler::roleExists($role_id); - if ($role_check == "ROLE_EXISTS") { + if ($role_check == 'ROLE_EXISTS') { $permission_check = RolesPermissionDataHandler::doesRoleHavePermission($role_id, $permission); - if ($permission_check == "ROLE_HAS_PERMISSION") { - return "USER_HAS_PERMISSION"; + if ($permission_check == 'ROLE_HAS_PERMISSION') { + return 'USER_HAS_PERMISSION'; } else { return $permission_check; } } else { return $role_check; } - } catch (Exception $e) { - Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, "(App/User/UserHelper.php) Failed to get role info: " . $e->getMessage()); - return "ERROR_DATABASE_SELECT_FAILED"; + } catch (\Exception $e) { + Logger::log(LoggerLevels::CRITICAL, LoggerTypes::DATABASE, '(App/User/UserHelper.php) Failed to get role info: ' . $e->getMessage()); + + return 'ERROR_DATABASE_SELECT_FAILED'; } } } diff --git a/commands/core/cache/cacheprocess.php b/commands/core/cache/cacheprocess.php index fb42b00..266d031 100755 --- a/commands/core/cache/cacheprocess.php +++ b/commands/core/cache/cacheprocess.php @@ -1,20 +1,18 @@ getMessage()); + echo color::translateColorsCode('&rProcessed caches!'); + } catch (Exception $e) { + echo color::translateColorsCode('&cFailed to process caches: &r' . $e->getMessage()); } } } diff --git a/commands/core/cache/cachepurge.php b/commands/core/cache/cachepurge.php index d188083..4a691bb 100755 --- a/commands/core/cache/cachepurge.php +++ b/commands/core/cache/cachepurge.php @@ -1,20 +1,18 @@ getMessage()); + echo color::translateColorsCode('&rPurged caches!'); + } catch (Exception $e) { + echo color::translateColorsCode('&cFailed to purge caches: &r' . $e->getMessage()); } } } diff --git a/commands/core/encryption/newkey.php b/commands/core/encryption/newkey.php index 461be47..f7dac84 100755 --- a/commands/core/encryption/newkey.php +++ b/commands/core/encryption/newkey.php @@ -7,27 +7,25 @@ class newkeyCommand { public function execute() { - if (cfg::get("encryption", "key") == "") { + if (cfg::get('encryption', 'key') == '') { $this->generate(); } else { - echo color::translateColorsCode("&4&lWARNING: &fA key already exists. Do you want to generate a new one?&o"); - echo color::translateColorsCode("&4&lWARNING: &fGenerating a new key will make all encrypted data unreadable. &o"); - echo color::translateColorsCode("&4&lWARNING: &fType &ey&f to continue or &en&f to exit:"); + echo color::translateColorsCode('&4&lWARNING: &fA key already exists. Do you want to generate a new one?&o'); + echo color::translateColorsCode('&4&lWARNING: &fGenerating a new key will make all encrypted data unreadable. &o'); + echo color::translateColorsCode('&4&lWARNING: &fType &ey&f to continue or &en&f to exit:'); $confirm = readline(); if (strtolower($confirm) === 'y') { $this->generate(); } else { - die(color::translateColorsCode("&fExiting...&o")); + exit(color::translateColorsCode('&fExiting...&o')); } } } - /** - * - */ + public function generate() { - $key = "mythicalcore_".bin2hex(random_bytes(64 * 32)); - cfg::set("encryption", "key", $key); - echo color::translateColorsCode("&fKey generated successfully!&o"); + $key = 'mythicalcore_' . bin2hex(random_bytes(64 * 32)); + cfg::set('encryption', 'key', $key); + echo color::translateColorsCode('&fKey generated successfully!&o'); } } diff --git a/composer.json b/composer.json index 3de5a65..99441bd 100755 --- a/composer.json +++ b/composer.json @@ -86,7 +86,7 @@ ], "lint": [ "export COMPOSER_ALLOW_SUPERUSER=1", - "vendor/bin/php-cs-fixer fix ." + "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php" ] } } diff --git a/cron/jobs/SettingsJob.php b/cron/jobs/SettingsJob.php index 3765154..b08bb8e 100755 --- a/cron/jobs/SettingsJob.php +++ b/cron/jobs/SettingsJob.php @@ -1,8 +1,6 @@ getMessage()); + exit('Failed to migrate the database: ' . $e->getMessage()); } catch (NoMigrationsFound $e) { - die("No migrations found!"); + exit('No migrations found!'); } catch (Exception $e) { - die("Failed to migrate the database: " . $e->getMessage()); + exit('Failed to migrate the database: ' . $e->getMessage()); } migrateCfg(); settings::update('app', 'name', $app_name); @@ -79,19 +78,19 @@ settings::update('app', 'logo', $settings_app_logo); try { unlink(__DIR__ . '/../FIRST_INSTALL'); - die("OK_DEL_FIRST_INSTALL"); + exit('OK_DEL_FIRST_INSTALL'); } catch (Exception $e) { - die("OK_DEL_FIRST_INSTALL"); + exit('OK_DEL_FIRST_INSTALL'); } } catch (Exception $e) { - die("Failed to migrate the database: " . $e->getMessage()); + exit('Failed to migrate the database: ' . $e->getMessage()); } } catch (Exception $e) { - die("Failed to configure the database: " . $e->getMessage()); + exit('Failed to configure the database: ' . $e->getMessage()); } /** - * Install functions + * Install functions. * * Do not touch those functions please * @@ -103,13 +102,13 @@ function migrateDB() $mysql = new MySQL(); $db = $mysql->connectPDO(); - $db->exec(" + $db->exec(' CREATE TABLE IF NOT EXISTS framework_migrations ( id INT AUTO_INCREMENT PRIMARY KEY, script VARCHAR(255) NOT NULL, executed_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); - "); + '); $sqlFiles = glob(__DIR__ . '/..//migrate/database/*.sql'); @@ -117,6 +116,7 @@ function migrateDB() usort($sqlFiles, function ($a, $b) { $aDate = intval(basename($a, '.sql')); $bDate = intval(basename($b, '.sql')); + return $aDate - $bDate; }); @@ -125,24 +125,23 @@ function migrateDB() $fileName = basename($sqlFile); - $stmt = $db->prepare("SELECT COUNT(*) FROM framework_migrations WHERE script = ?"); + $stmt = $db->prepare('SELECT COUNT(*) FROM framework_migrations WHERE script = ?'); $stmt->execute([$fileName]); $count = $stmt->fetchColumn(); if ($count == 0) { $db->exec($script); - $stmt = $db->prepare("INSERT INTO framework_migrations (script) VALUES (?)"); + $stmt = $db->prepare('INSERT INTO framework_migrations (script) VALUES (?)'); $stmt->execute([$fileName]); } else { return; } } } else { - } } catch (PDOException $e) { - die("Failed to migrate the database: " . $e->getMessage() . ""); + exit('Failed to migrate the database: ' . $e->getMessage() . ''); } } function migrateCfg() @@ -150,7 +149,7 @@ function migrateCfg() try { $mysql = new MySQL(); $db = $mysql->connectPDO(); - $db->exec("CREATE TABLE IF NOT EXISTS `framework_settings_migrations` (`id` INT NOT NULL AUTO_INCREMENT , `script` TEXT NOT NULL , `executed_at` DATETIME NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB; ALTER TABLE `framework_settings_migrations` CHANGE `executed_at` `executed_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP;"); + $db->exec('CREATE TABLE IF NOT EXISTS `framework_settings_migrations` (`id` INT NOT NULL AUTO_INCREMENT , `script` TEXT NOT NULL , `executed_at` DATETIME NOT NULL , PRIMARY KEY (`id`)) ENGINE = InnoDB; ALTER TABLE `framework_settings_migrations` CHANGE `executed_at` `executed_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP;'); $phpFiles = glob(__DIR__ . '/../migrate/config/*.php'); if (count($phpFiles) > 0) { @@ -159,29 +158,28 @@ function migrateCfg() foreach ($phpFiles as $phpFile) { $fileName = basename($phpFile); - $stmt = $db->prepare("SELECT COUNT(*) FROM framework_settings_migrations WHERE script = ?"); + $stmt = $db->prepare('SELECT COUNT(*) FROM framework_settings_migrations WHERE script = ?'); $stmt->execute([$fileName]); $count = $stmt->fetchColumn(); if ($count == 0) { include $phpFile; - $stmt = $db->prepare("INSERT INTO framework_settings_migrations (script) VALUES (?)"); + $stmt = $db->prepare('INSERT INTO framework_settings_migrations (script) VALUES (?)'); $stmt->execute([$fileName]); } } } else { - die("(CFG) No migrations found!"); + exit('(CFG) No migrations found!'); } } catch (PDOException $e) { - die("Failed to migrate the database: " . $e->getMessage() . ""); + exit('Failed to migrate the database: ' . $e->getMessage() . ''); } } - - function generateKey(): string { - $key = "mythicalcore_" . bin2hex(random_bytes(64 * 32)); + $key = 'mythicalcore_' . bin2hex(random_bytes(64 * 32)); + return $key; } diff --git a/install/mysql.php b/install/mysql.php index e0fe762..4516d13 100755 --- a/install/mysql.php +++ b/install/mysql.php @@ -4,14 +4,14 @@ ini_set('display_startup_errors', 0); error_reporting(null); if ( - isset($_GET['host']) && - !$_GET['host'] == null && - isset($_GET['port']) && - !$_GET['port'] == null && - isset($_GET['username']) && - !$_GET['username'] == null && - isset($_GET['name']) && - !$_GET['name'] == null + isset($_GET['host']) + && !$_GET['host'] == null + && isset($_GET['port']) + && !$_GET['port'] == null + && isset($_GET['username']) + && !$_GET['username'] == null + && isset($_GET['name']) + && !$_GET['name'] == null ) { $hostname = $_GET['host']; $port = (int) $_GET['port']; @@ -25,30 +25,30 @@ try { $fp = fsockopen($hostname, $port, $errCode, $errStr, $waitTimeoutInSeconds); } catch (Exception $e) { - die($e->getMessage()); + exit($e->getMessage()); } if ($fp) { $conn = new mysqli($hostname, $username, $password, $name, $port); if ($conn->connect_error) { - die($conn->connect_error); + exit($conn->connect_error); } else { echo 'OK'; } $conn->close(); } else { - die('Failed to ping: ' . $hostname . ':' . $port); + exit('Failed to ping: ' . $hostname . ':' . $port); } - die(); + exit; } else { - die('Please provide an valid ipv4/ipv6!'); + exit('Please provide an valid ipv4/ipv6!'); } } catch (Exception $e) { - die($e->getMessage()); + exit($e->getMessage()); } } else { - die('You are missing the required connection details'); + exit('You are missing the required connection details'); } function isValidIP($ip) diff --git a/lang/en_US.php b/lang/en_US.php index a6718b7..1f1eae2 100755 --- a/lang/en_US.php +++ b/lang/en_US.php @@ -1,10 +1,10 @@ "Page not found", - "pages_error_500" => "Internal server error", - "pages_error_403" => "Forbidden", - "pages_error_401" => "Unauthorized", - "pages_error_go_back" => "Go home", + // FILE: /errors/*.twig + 'pages_error_404' => 'Page not found', + 'pages_error_500' => 'Internal server error', + 'pages_error_403' => 'Forbidden', + 'pages_error_401' => 'Unauthorized', + 'pages_error_go_back' => 'Go home', ]; diff --git a/migrate/config/1.php b/migrate/config/1.php index eec82ab..34b9428 100755 --- a/migrate/config/1.php +++ b/migrate/config/1.php @@ -2,12 +2,12 @@ use MythicalSystemsFramework\Managers\SettingsManager as settings; -settings::set("app", "name", "MythicalSystems"); -settings::set("app", "logo", "https://avatars.githubusercontent.com/u/117385445"); -settings::set("app", "timezone", "Europe/Bucharest"); -settings::set("app", "theme", "default"); -settings::set("app", "lang", "en_US"); -settings::set("app", "maintenance", "false"); -settings::set("seo", "title", "MythicalSystems"); -settings::set("seo", "description", "MythicalSystems is a framework for building web applications."); -settings::set("seo", "keywords", "MythicalSystems, web applications, framework"); +settings::set('app', 'name', 'MythicalSystems'); +settings::set('app', 'logo', 'https://avatars.githubusercontent.com/u/117385445'); +settings::set('app', 'timezone', 'Europe/Bucharest'); +settings::set('app', 'theme', 'default'); +settings::set('app', 'lang', 'en_US'); +settings::set('app', 'maintenance', 'false'); +settings::set('seo', 'title', 'MythicalSystems'); +settings::set('seo', 'description', 'MythicalSystems is a framework for building web applications.'); +settings::set('seo', 'keywords', 'MythicalSystems, web applications, framework'); diff --git a/migrate/config/2.php b/migrate/config/2.php index d90cd6f..661e8b7 100755 --- a/migrate/config/2.php +++ b/migrate/config/2.php @@ -2,4 +2,4 @@ use MythicalSystemsFramework\Managers\SettingsManager as settings; -settings::set("caches", "max_query_last_time", "600"); +settings::set('caches', 'max_query_last_time', '600'); diff --git a/migrate/config/3.php b/migrate/config/3.php index 1216d0b..3775098 100755 --- a/migrate/config/3.php +++ b/migrate/config/3.php @@ -2,4 +2,4 @@ use MythicalSystemsFramework\Managers\SettingsManager as settings; -settings::set("caches", "settings_cache_life", "3600"); +settings::set('caches', 'settings_cache_life', '3600'); diff --git a/public/index.php b/public/index.php index e6f6c5b..b277935 100755 --- a/public/index.php +++ b/public/index.php @@ -1,79 +1,73 @@ composer install --no-dev --optimize-autoloader". Please run that and refresh the page'); + exit('Hello, it looks like you did not run: "composer install --no-dev --optimize-autoloader". Please run that and refresh the page'); } } catch (Exception $e) { - die('Hello, it looks like you did not run: composer install --no-dev --optimize-autoloader Please run that and refresh'); + exit('Hello, it looks like you did not run: composer install --no-dev --optimize-autoloader Please run that and refresh'); } -use MythicalSystems\Api\ResponseHandler as rsp; -use MythicalSystems\Api\Api as api; -use MythicalSystemsFramework\Database\MySQLCache; -use MythicalSystemsFramework\Managers\SettingsManager as setting; -use MythicalSystemsFramework\Managers\ConfigManager as cfg; -use MythicalSystemsFramework\Managers\LanguageManager; -use MythicalSystemsFramework\Managers\Settings; use Twig\Environment; use Twig\Loader\FilesystemLoader; +use MythicalSystems\Api\Api as api; +use MythicalSystems\Api\ResponseHandler as rsp; +use MythicalSystemsFramework\Managers\Settings; +use MythicalSystemsFramework\Managers\LanguageManager; +use MythicalSystemsFramework\Managers\ConfigManager as cfg; +use MythicalSystemsFramework\Managers\SettingsManager as setting; -$router = new \Router\Router(); - +$router = new Router\Router(); -/** +/* * Check if the app is installed */ if (file_exists(__DIR__ . '/../FIRST_INSTALL')) { $router->add('/', function () { - include(__DIR__ . '/../install/index.php'); + include __DIR__ . '/../install/index.php'; }); - $router->add('/mysql', function () { - include(__DIR__ . '/../install/mysql.php'); + include __DIR__ . '/../install/mysql.php'; }); $router->add('/install', function () { - include(__DIR__ . '/../install/install.php'); + include __DIR__ . '/../install/install.php'; }); $router->add('/(.*)', function () { header('location: /'); }); $router->route(); - die(); + exit; } - -if (cfg::get("encryption", "key") == "") { - die("We are sorry but you are missing the encryption key!"); +if (cfg::get('encryption', 'key') == '') { + exit('We are sorry but you are missing the encryption key!'); } if (!is_writable(__DIR__)) { - die("We have no access to the framework directory!"); + exit('We have no access to the framework directory!'); } if (!is_writable(__DIR__ . '/../caches')) { - die("We have no access to the cache directory!"); + exit('We have no access to the cache directory!'); } date_default_timezone_set(setting::get('app', 'timezone')); define('DIR_TEMPLATE', __DIR__ . '/../themes/' . setting::get('app', 'theme')); define('DIR_CACHE', __DIR__ . '/../caches'); define('TIMEZONE', setting::get('app', 'timezone')); -/** +/* * Load the template engine */ if (!is_dir(DIR_TEMPLATE)) { - die("The theme directory does not exist!"); + exit('The theme directory does not exist!'); } if (!is_dir(DIR_CACHE)) { @@ -83,42 +77,43 @@ $renderer = new Environment($loader, [ 'cache' => DIR_CACHE, 'auto_reload' => true, - 'debug' => true + 'debug' => true, ]); -/** +/* * Add global functions to the renderer * * This will allow the renderer to get the settings and cfg values * */ -/** +/* * Add the settings function to the renderer */ -$renderer->addFunction(new \Twig\TwigFunction('setting', function ($section, $key) { +$renderer->addFunction(new Twig\TwigFunction('setting', function ($section, $key) { return setting::get($section, $key); })); -/** +/* * Add the cfg function to the renderer */ -$renderer->addFunction(new \Twig\TwigFunction('cfg', function ($section, $key) { +$renderer->addFunction(new Twig\TwigFunction('cfg', function ($section, $key) { return cfg::get($section, $key); })); -/** +/* * Add the language function to the renderer */ -$renderer->addFunction(new \Twig\TwigFunction('lang', function ($key) { +$renderer->addFunction(new Twig\TwigFunction('lang', function ($key) { $translations = LanguageManager::getLang(); - return isset($translations[$key]) ? $translations[$key] : LanguageManager::logKeyTranslationNotFound($key); + + return $translations[$key] ?? LanguageManager::logKeyTranslationNotFound($key); })); $renderer->addGlobal('php_version', phpversion()); -$renderer->addGlobal('page_name', "Home"); +$renderer->addGlobal('page_name', 'Home'); define('VIEW_ENGINE', $renderer); /** - * Load the routes + * Load the routes. */ $routesAPIDirectory = __DIR__ . '/../routes/api/'; $iterator2 = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($routesAPIDirectory)); @@ -135,7 +130,7 @@ $router->add('/api/(.*)', function () { api::init(); - rsp::NotFound("The api route does not exist!", null); + rsp::NotFound('The api route does not exist!', null); }); $routesViewDirectory = __DIR__ . '/../routes/views/'; @@ -148,17 +143,17 @@ include $phpViewFile->getPathname(); } catch (Exception $ex) { http_response_code(500); - die('Failed to start app: ' . $ex->getMessage()); + exit('Failed to start app: ' . $ex->getMessage()); } } $router->add('/(.*)', function () { global $renderer; http_response_code(404); - die($renderer->render('/errors/404.twig')); + exit($renderer->render('/errors/404.twig')); }); try { $router->route(); } catch (Exception $e) { - die('Failed to start app: ' . $e->getMessage()); + exit('Failed to start app: ' . $e->getMessage()); } diff --git a/routes/api/system.php b/routes/api/system.php index 406e877..07abd4e 100755 --- a/routes/api/system.php +++ b/routes/api/system.php @@ -1,5 +1,5 @@ add('/api/system/logs', function () { - include(__DIR__ . '/../../api/System/logs.php'); + include __DIR__ . '/../../api/System/logs.php'; }); diff --git a/routes/views/core.php b/routes/views/core.php index cb6e4a3..468049a 100755 --- a/routes/views/core.php +++ b/routes/views/core.php @@ -1,37 +1,37 @@ add('/errors/404', function () { - /** + /* * The requirement for each template */ global $renderer; http_response_code(404); - die($renderer->render('/errors/404.twig')); + exit($renderer->render('/errors/404.twig')); }); $router->add('/errors/500', function () { - /** + /* * The requirement for each template */ global $renderer; http_response_code(500); - die($renderer->render('/errors/500.twig')); + exit($renderer->render('/errors/500.twig')); }); $router->add('/errors/403', function () { - /** + /* * The requirement for each template */ global $renderer; http_response_code(403); - die($renderer->render('/errors/403.twig')); + exit($renderer->render('/errors/403.twig')); }); $router->add('/errors/401', function () { - /** + /* * The requirement for each template */ global $renderer; http_response_code(401); - die($renderer->render('/errors/401.twig')); + exit($renderer->render('/errors/401.twig')); }); diff --git a/routes/views/index.php b/routes/views/index.php index b42c178..5bd2275 100755 --- a/routes/views/index.php +++ b/routes/views/index.php @@ -1,14 +1,10 @@ add('/', function () { - /** + /* * The requirement for each template */ global $renderer; - die($renderer->render('index.twig')); + exit($renderer->render('index.twig')); }); diff --git a/tests/EncryptionTest.php b/tests/EncryptionTest.php index 310d5e3..ee2f49e 100755 --- a/tests/EncryptionTest.php +++ b/tests/EncryptionTest.php @@ -2,29 +2,23 @@ namespace MythicalSystemsFramework\Tests; -use MythicalSystems\Utils\EncryptionHandler; use PHPUnit\Framework\TestCase; +use MythicalSystems\Utils\EncryptionHandler; class EncryptionTest extends TestCase { /** - * The encryption key - * - * @var string + * The encryption key. */ - public static string $key = "AAAAB3NzaC1yc2EAAAADAQABAAABAQDZHXFFVqeRQk42pViMsxfQhIrQBm7LcmW1sazqkgkCgoOVcW4OiCoaH0P9Zf5HjqdJ9RJocnJz8qKQQUiCFxuxt8qJiHMoqf+Mu8KgOs6ixo0SLiH2QakAZ0Nm46WB+VjXmLHkxZ9tw/f2M9dGI5Ky0M0TvsKSXS0v8crXLBBE3Fa+gao/34Cyqim1ZhCopVIjTtRNSZwx0CzHcYGhegl04+nIksCYg7RH56CTH5j1NZX8enJ7T5lx9sl8YIde6qJu7tD0nsfZFTRxwUzLvfGmFIQ9/96BNThB7aK806T8Tr+amKsPcYEc3Il6LifoPztYS6pYtbwBl3eMm0mchNgJ"; + public static string $key = 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDZHXFFVqeRQk42pViMsxfQhIrQBm7LcmW1sazqkgkCgoOVcW4OiCoaH0P9Zf5HjqdJ9RJocnJz8qKQQUiCFxuxt8qJiHMoqf+Mu8KgOs6ixo0SLiH2QakAZ0Nm46WB+VjXmLHkxZ9tw/f2M9dGI5Ky0M0TvsKSXS0v8crXLBBE3Fa+gao/34Cyqim1ZhCopVIjTtRNSZwx0CzHcYGhegl04+nIksCYg7RH56CTH5j1NZX8enJ7T5lx9sl8YIde6qJu7tD0nsfZFTRxwUzLvfGmFIQ9/96BNThB7aK806T8Tr+amKsPcYEc3Il6LifoPztYS6pYtbwBl3eMm0mchNgJ'; /** - * The data to encrypt - * - * @var string + * The data to encrypt. */ - public static string $data = "Hello World, this is a unit test for the encryption handler :)!"; + public static string $data = 'Hello World, this is a unit test for the encryption handler :)!'; /** - * The encrypted data - * - * @var string + * The encrypted data. */ - public static string $data_e = "iaatrbFTpenTr5Wlg6atqrRhqrdhsmG3r6q1YrW2t85ovrW4duXNt3HQopXiz9nB3OfUcdCq4LWu0qlsnZZ4"; + public static string $data_e = 'iaatrbFTpenTr5Wlg6atqrRhqrdhsmG3r6q1YrW2t85ovrW4duXNt3HQopXiz9nB3OfUcdCq4LWu0qlsnZZ4'; public function testDecryption(): void { @@ -37,5 +31,4 @@ public function testEncryption(): void $encryptedData = EncryptionHandler::encrypt(self::$data, self::$key); $this->assertEquals(self::$data_e, $encryptedData); } - } From 9bc0575cb17a7fe8ee21964466be57f5bcb2885b Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Thu, 25 Jul 2024 11:07:15 +0200 Subject: [PATCH 13/17] PUSH -> Add formatting -> Add editorconfig for ppl that use other editors -> Added some templates :) --- .editorconfig | 17 ++++++ .github/ISSUE_TEMPLATE/bug-report.yml | 63 ++++++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 11 ++++ .github/ISSUE_TEMPLATE/feature-request.yml | 32 +++++++++++ .prettierrc.json | 9 ++++ 5 files changed, 132 insertions(+) create mode 100755 .editorconfig create mode 100755 .github/ISSUE_TEMPLATE/bug-report.yml create mode 100755 .github/ISSUE_TEMPLATE/config.yml create mode 100755 .github/ISSUE_TEMPLATE/feature-request.yml create mode 100755 .prettierrc.json diff --git a/.editorconfig b/.editorconfig new file mode 100755 index 0000000..07be57a --- /dev/null +++ b/.editorconfig @@ -0,0 +1,17 @@ +root = true + +[*] +indent_style = space +indent_size = 4 +tab_width = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.md] +trim_trailing_whitespace = false + +[*.{md,nix,yml,yaml}] +indent_size = 2 +tab_width = 2 \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100755 index 0000000..b19b444 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,63 @@ +name: Bug Report +description: Something isn't working quite right in the software. +labels: [not confirmed] +body: +- type: markdown + attributes: + value: | + Bug reports should only be used for reporting issues with how the software works. For assistance installing this software, as well as debugging issues with dependencies, please use our [Discord server](https://discord.mythicalsystems.xyz). + +- type: textarea + attributes: + label: Current Behavior + description: Please provide a clear & concise description of the issue. + validations: + required: true + +- type: textarea + attributes: + label: Expected Behavior + description: Please describe what you expected to happen. + validations: + required: true + +- type: textarea + attributes: + label: Steps to Reproduce + description: Please be as detailed as possible when providing steps to reproduce, failure to provide steps will result in this issue being closed. + validations: + required: true + +- type: input + id: framework-version + attributes: + label: Framework Version + description: Version number of your Framework (latest is not a version) + placeholder: 1.0.0 + validations: + required: true + +- type: textarea + id: panel-logs + attributes: + label: Error Logs + description: | + Run the following command to collect logs on your system. + + Panel: `cd /var/www/framework && php framework logs` + placeholder: "https://api.mythicalsystems.xyz/logs/123456&plain" + render: bash + validations: + required: false + +- type: checkboxes + attributes: + label: Is there an existing issue for this? + description: Please [search here](https://github.com/mythicalltd/framework/issues) to see if an issue already exists for your problem. + options: + - label: I have searched the existing issues before opening this issue. + required: true + - label: I have provided all relevant details. + required: true + - label: I have checked in the Discord server and believe this is a bug with the framework, and not a configuration issue with my specific system. + required: true \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100755 index 0000000..8b5f7ca --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,11 @@ +blank_issues_enabled: true +contact_links: + - name: Installation Help + url: https://discord.mythicalsystems.xyz + about: Please visit our Discord for help with your installation. + - name: General Question + url: https://discord.mythicalsystems.xyz + about: Please visit our Discord for general questions about MythicalFramework. + - name: Developer Documentation + url: https://docs.mythicalsystems.xyz + about: Please visit our documentation for help with developing on MythicalFramework. \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100755 index 0000000..e2c2364 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,32 @@ +name: Feature Request +description: Suggest a new feature or improvement for the software. +labels: [feature request] +body: +- type: checkboxes + attributes: + label: Is there an existing feature request for this? + description: Please [search here](https://github.com/mythicalltd/framework/issues?q=is%3Aissue) to see if someone else has already suggested this. + options: + - label: I have searched the existing issues before opening this feature request. + required: true + +- type: textarea + attributes: + label: Describe the feature you would like to see. + description: "A clear & concise description of the feature you'd like to have added, and what issues it would solve." + validations: + required: true + +- type: textarea + attributes: + label: Describe the solution you'd like. + description: "You must explain how you'd like to see this feature implemented. Technical implementation details are not necessary, rather an idea of how you'd like to see this feature used." + validations: + required: true + +- type: textarea + attributes: + label: Additional context to this request. + description: "Add any other context or screenshots about the feature request." + validations: + required: false \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100755 index 0000000..d89fb94 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,9 @@ +{ + "printWidth": 120, + "tabWidth": 4, + "useTabs": false, + "semi": true, + "singleQuote": true, + "jsxSingleQuote": true, + "endOfLine": "lf" +} From e665005ff8ae8b2bfc7c971f6a7589db5fdb9d8f Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Thu, 25 Jul 2024 11:53:11 +0200 Subject: [PATCH 14/17] PUSH -> Finish migrating the old command system :) --- app/Cli/Commands/Cache.php | 89 ++++++++++++++++++++++++++++ app/Cli/Commands/Colors.php | 2 +- app/Cli/Commands/Configure.php | 35 ++++++----- app/Cli/Commands/Migrate.php | 15 ++++- app/Cli/Commands/Rebuild.php | 24 ++++---- app/Database/MySQL.php | 4 +- app/Database/MySQLCache.php | 18 ++++-- app/Managers/Settings.php | 6 +- commands/core/cache/cacheprocess.php | 18 ------ commands/core/cache/cachepurge.php | 18 ------ commands/core/encryption/newkey.php | 31 ---------- composer.lock | 36 ++++++----- 12 files changed, 174 insertions(+), 122 deletions(-) create mode 100755 app/Cli/Commands/Cache.php delete mode 100755 commands/core/cache/cacheprocess.php delete mode 100755 commands/core/cache/cachepurge.php delete mode 100755 commands/core/encryption/newkey.php diff --git a/app/Cli/Commands/Cache.php b/app/Cli/Commands/Cache.php new file mode 100755 index 0000000..8924b49 --- /dev/null +++ b/app/Cli/Commands/Cache.php @@ -0,0 +1,89 @@ +getMessage()); + } + } + + public static function process(): void + { + echo self::translateColorsCode('Please wait while we process your &ccaches&r.&o'); + try { + CacheWorker::process(); + echo self::translateColorsCode('&rProcessed caches!'); + } catch (\Exception $e) { + echo self::translateColorsCode('&cFailed to process caches: &r' . $e->getMessage()); + } + } + + public static function create(): void + { + echo self::translateColorsCode('Please wait while we create your &ccaches&r.&o'); + $table = readline('Enter the name of the table you want to cache: '); + $status = MySQLCache::saveCache($table); + switch ($status) { + case 'ERROR_TABLE_DOES_NOT_EXIST': + self::exit('&cTable not found!&o'); + break; + case 'ERROR_NO_DATA_FOUND_IN_TABLE': + self::exit('&cNo data found in table!&o'); + break; + case 'ERROR_TABLE_NOT_SUPPORTED': + self::exit('&cTable does not support cache!&o'); + break; + case 'ERROR_MYSQL_ERROR': + self::exit('&cThere was an error while trying to connect to the mysql server :(&o'); + break; + case 'OK': + self::exit('&rCreated &acaches&r!&o'); + break; + default: + break; + } + } +} diff --git a/app/Cli/Commands/Colors.php b/app/Cli/Commands/Colors.php index 4f406bd..7363481 100755 --- a/app/Cli/Commands/Colors.php +++ b/app/Cli/Commands/Colors.php @@ -8,7 +8,7 @@ class Colors extends Command public static function execute(bool $isFrameworkCommand = false): void { - $colors = 'Colors: &0Black&r, &1Dark Blue&r, &2Dark Green&r, &3Dark Aqua&r, &4Dark Red&r, &5Dark Purple&r, &6Gold&r, &7Gray&r, &8Dark Gray&r, &9Blue&r, &aGreen&r, &bAqua&r, &cRed&r, &dLight Purple&r, &eYellow&r, &fWhite&r, &rReset&r, &lBold&r, &nUnderline&r, &mStrikethrough&r'; + $colors = 'Colors: &0Black&r, &1Dark Blue&r, &2Dark Green&r, &3Dark Aqua&r, &4Dark Red&r, &5Dark Purple&r, &6Gold&r, &7Gray&r, &8Dark Gray&r, &9Blue&r, &aGreen&r, &bAqua&r, &cRed&r, &dLight Purple&r, &eYellow&r, &rWhite&r, &rReset&r, &lBold&r, &nUnderline&r, &mStrikethrough&r'; echo self::translateColorsCode($colors); echo PHP_EOL; echo str_replace('&r', '', $colors); diff --git a/app/Cli/Commands/Configure.php b/app/Cli/Commands/Configure.php index ec33b4e..afa635b 100755 --- a/app/Cli/Commands/Configure.php +++ b/app/Cli/Commands/Configure.php @@ -38,7 +38,7 @@ public static function execute(bool $isFrameworkCommand = false): void public static function dbconfigure(): void { if (cfg::get('database', 'password') !== null) { - echo self::translateColorsCode('&fDatabase configuration already exists. &oWould you like to overwrite it? &8[&aY&8/&cN&8]&f: '); + echo self::translateColorsCode('&rDatabase configuration already exists. &oWould you like to overwrite it? &8[&aY&8/&cN&8]&r: '); $overwrite = readline(); if (strtolower($overwrite) !== 'y') { return; @@ -47,15 +47,15 @@ public static function dbconfigure(): void $defaultHost = '127.0.0.1'; $defaultPort = '3306'; $db = new MySQL(); - echo self::translateColorsCode("&fEnter the host of the database &8[&e$defaultHost&8]&f: "); + echo self::translateColorsCode("&rEnter the host of the database &8[&e$defaultHost&8]&r: "); $host = readline() ?: $defaultHost; - echo self::translateColorsCode("&fEnter the port of the database &8[&e$defaultPort&8]&f: "); + echo self::translateColorsCode("&rEnter the port of the database &8[&e$defaultPort&8]&r: "); $port = readline() ?: $defaultPort; - echo self::translateColorsCode('&fEnter the username: '); + echo self::translateColorsCode('&rEnter the username: '); $username = readline(); - echo self::translateColorsCode('&fEnter the password: '); + echo self::translateColorsCode('&rEnter the password: '); $password = readline(); - echo self::translateColorsCode('&fEnter the database name: '); + echo self::translateColorsCode('&rEnter the database name: '); $database = readline(); // Perform validation if (empty($username) || empty($password) || empty($database)) { @@ -69,29 +69,34 @@ public static function dbconfigure(): void // Use the provided information echo self::NewLine(); - echo self::translateColorsCode("&fHost: &e$host&o"); - echo self::translateColorsCode("&fPort: &e$port&o"); - echo self::translateColorsCode("&fUsername: &e$username&o"); - echo self::translateColorsCode("&fPassword: &e$hiddenPassword&o"); - echo self::translateColorsCode("&fDatabase: &e$database&o"); + echo self::translateColorsCode("&rHost: &e$host&o"); + echo self::translateColorsCode("&rPort: &e$port&o"); + echo self::translateColorsCode("&rUsername: &e$username&o"); + echo self::translateColorsCode("&rPassword: &e$hiddenPassword&o"); + echo self::translateColorsCode("&rDatabase: &e$database&o"); if ($db->tryConnection($host, $port, $username, $password, $database) == true) { echo self::NewLine(); - echo self::translateColorsCode('&fConnection to the database was &asuccessful!&o'); + echo self::translateColorsCode('&rConnection to the database was &asuccessful!&o'); echo self::NewLine(); - echo self::translateColorsCode('&fSaving the configuration...&o'); + echo self::translateColorsCode('&rSaving the configuration...&o'); cfg::set('database', 'host', $host); cfg::set('database', 'port', $port); cfg::set('database', 'username', $username); cfg::set('database', 'password', $password); cfg::set('database', 'name', $database); - echo self::translateColorsCode('&fConfiguration saved &asuccessfully!&o'); + echo self::translateColorsCode('&rGenerating an encryption key for database...!&o'); + $key = 'mythicalcore_' . bin2hex(random_bytes(64 * 128)); + cfg::set('encryption', 'key', $key); + echo self::translateColorsCode('&rKey generated &asuccessfully&r!&o'); + echo self::translateColorsCode('&rConfiguration saved &asuccessfully&r!&o'); } else { - echo self::translateColorsCode('&7Failed to connect to the database. &o&fPlease check the provided information.'); + echo self::translateColorsCode('&7Failed to connect to the database. &o&rPlease check the provided information.'); } } public static function configure(): void { + self::exit('This feature is not implemented yet.'); } } diff --git a/app/Cli/Commands/Migrate.php b/app/Cli/Commands/Migrate.php index cfc0620..7727062 100755 --- a/app/Cli/Commands/Migrate.php +++ b/app/Cli/Commands/Migrate.php @@ -24,7 +24,7 @@ public static function execute(bool $isFrameworkCommand = false): void self::db(); break; case '2': - echo self::translateColorsCode('&cThis option is not available yet!&o'); + self::cfg(); break; case '3': self::exit(); @@ -38,11 +38,11 @@ public static function execute(bool $isFrameworkCommand = false): void public static function db(): void { try { - self::log_info('Migrating the database...'); + self::log_info('Migrating the database...&o'); self::log_info(''); MySQL::migrate(true); Settings::migrate(true); - self::log_success('&rDatabase migrated &asuccessfully&r!'); + self::log_success('&rDatabase migrated &asuccessfully&r!&o'); self::exit(); } catch (\Exception $e) { exit('Failed to migrate the database: ' . $e->getMessage() . ''); @@ -51,5 +51,14 @@ public static function db(): void public static function cfg(): void { + try { + self::log_info('Migrating the config...&o'); + self::log_info(''); + Settings::migrate(true); + self::log_success('&rConfig migrated &asuccessfully&r!&o'); + self::exit(); + } catch (\Exception $e) { + exit('Failed to migrate the config: ' . $e->getMessage() . ''); + } } } diff --git a/app/Cli/Commands/Rebuild.php b/app/Cli/Commands/Rebuild.php index b907d96..16ace96 100755 --- a/app/Cli/Commands/Rebuild.php +++ b/app/Cli/Commands/Rebuild.php @@ -41,14 +41,14 @@ public static function db(): void try { $db = new MySQL(); if ($db->tryConnection(cfg::get('database', 'host'), cfg::get('database', 'port'), cfg::get('database', 'username'), cfg::get('database', 'password'), cfg::get('database', 'name')) == true) { - echo self::translateColorsCode('&o&fConnection to the database was &asuccessful!&o'); + echo self::translateColorsCode('&o&rConnection to the database was &asuccessful!&o'); echo self::NewLine(); - echo self::translateColorsCode('&4&lWARNING: &fThis option will wipe the database. &o'); - echo self::translateColorsCode('&4&lWARNING: &fOnly use this function if you know what you are doing &o'); - echo self::translateColorsCode('&4&lWARNING: &fOnce you wipe the database there is no going back! &o'); - echo self::translateColorsCode("&4&lWARNING: &fPlease be careful and don't play around with commands! &o"); - echo self::translateColorsCode('&4&lWARNING: &fThere is no other message then this so keep in mind! &o'); - echo self::translateColorsCode('&4&lWARNING: &fDo you really want to wipe the database? (&ey&f/&en&f): '); + echo self::translateColorsCode('&4&lWARNING: &rThis option will wipe the database. &o'); + echo self::translateColorsCode('&4&lWARNING: &rOnly use this function if you know what you are doing &o'); + echo self::translateColorsCode('&4&lWARNING: &rOnce you wipe the database there is no going back! &o'); + echo self::translateColorsCode("&4&lWARNING: &rPlease be careful and don't play around with commands! &o"); + echo self::translateColorsCode('&4&lWARNING: &rThere is no other message then this so keep in mind! &o'); + echo self::translateColorsCode('&4&lWARNING: &rDo you really want to wipe the database? (&ey&r/&en&r): '); $confirm = readline(); if (strtolower($confirm) == 'y') { @@ -67,19 +67,19 @@ public static function db(): void echo self::NewLine(); echo self::NewLine(); echo self::NewLine(); - echo self::translateColorsCode('&fDatabase wiped!!&o'); + echo self::translateColorsCode('&rDatabase wiped!!&o'); MySQL::migrate(true); Settings::migrate(true); echo self::NewLine(); - echo self::translateColorsCode('&fDatabase rebuilt!&o'); - echo self::translateColorsCode("&fLet's start by setting up your configuration!&o"); + echo self::translateColorsCode('&rDatabase rebuilt!&o'); + echo self::translateColorsCode("&rLet's start by setting up your configuration!&o"); Configure::configure(); } catch (\PDOException $e) { - echo self::translateColorsCode('&fFailed to drop tables: &c' . $e->getMessage() . '&o'); + echo self::translateColorsCode('&rFailed to drop tables: &c' . $e->getMessage() . '&o'); echo self::NewLine(); } } else { - self::exit('&fExiting...&o'); + self::exit('&rExiting...&o'); } } else { self::exit('&cFailed to connect to the database!&o'); diff --git a/app/Database/MySQL.php b/app/Database/MySQL.php index 59630d4..48641bc 100755 --- a/app/Database/MySQL.php +++ b/app/Database/MySQL.php @@ -267,12 +267,12 @@ public static function migrate(bool $isCli = false): void $stmt = $db->prepare('INSERT INTO framework_migrations (script) VALUES (?)'); $stmt->execute([$fileName]); if ($isCli == true) { - echo Kernel::translateColorsCode('&fExecuted migration: &e' . $fileName . '&o'); + echo Kernel::translateColorsCode('&rExecuted migration: &e' . $fileName . '&o'); echo Kernel::NewLine(); } } else { if ($isCli == true) { - echo Kernel::translateColorsCode('&fSkipping migration: &e' . $fileName . ' &f(&ealready executed&f)&o'); + echo Kernel::translateColorsCode('&rSkipping migration: &e' . $fileName . ' &r(&ealready executed&r)&o'); echo Kernel::NewLine(); } } diff --git a/app/Database/MySQLCache.php b/app/Database/MySQLCache.php index e2816b9..fe5e728 100755 --- a/app/Database/MySQLCache.php +++ b/app/Database/MySQLCache.php @@ -6,11 +6,16 @@ class MySQLCache extends MySQL { - public static function saveCache(string $table_name): void + /** + * Summary of saveCache. + * + * @param string $table_name The name of the table + */ + public static function saveCache(string $table_name): string { try { if (self::doesTableExist($table_name) == false) { - throw new \Exception('Table does not exist.'); + return 'ERROR_TABLE_DOES_NOT_EXIST'; } $mysqli = new MySQL(); @@ -19,7 +24,7 @@ public static function saveCache(string $table_name): void $result = $conn->query($query); if ($result->num_rows == 0) { - throw new \Exception('No data found.'); + return 'ERROR_NO_DATA_FOUND_IN_TABLE'; } /* @@ -61,8 +66,9 @@ public static function saveCache(string $table_name): void } } } elseif ($table_name == 'framework_users') { + // TODO: ADD SUPPORT FOR DUMP USERS IN CACHE! } else { - throw new \Exception('Table not supported.'); + return 'ERROR_TABLE_NOT_SUPPORTED'; } $cache_info['cache_info'] = [ @@ -74,8 +80,10 @@ public static function saveCache(string $table_name): void $json = json_encode($data, JSON_PRETTY_PRINT); Settings::up(); file_put_contents(Settings::$cache_path . '/' . $table_name . '.json', $json); + + return 'OK'; } catch (\Exception $e) { - throw new \Exception('Failed to save cache: ' . $e); + return 'ERROR_MYSQL_ERROR'; } } diff --git a/app/Managers/Settings.php b/app/Managers/Settings.php index 62a696c..248e754 100755 --- a/app/Managers/Settings.php +++ b/app/Managers/Settings.php @@ -85,16 +85,16 @@ public static function migrate(bool $isTerminal = false): void } } if ($isTerminal) { - echo color::translateColorsCode('&fMigration completed. Migrated &e' . $migratedCount . ' &ffiles.'); + echo color::translateColorsCode('&rMigration completed. &oMigrated &e' . $migratedCount . ' &rfiles.&o'); } } else { if ($isTerminal) { - echo color::translateColorsCode('&fNo migrations found!'); + echo color::translateColorsCode('&rNo migrations found!'); } } } catch (\Exception $e) { if ($isTerminal) { - echo color::translateColorsCode('&cFailed to migrate the database: &f' . $e->getMessage() . ''); + echo color::translateColorsCode('&cFailed to migrate the database: &r' . $e->getMessage() . ''); } else { throw new NoMigrationsFound('No migrations found!' . $e->getMessage()); } diff --git a/commands/core/cache/cacheprocess.php b/commands/core/cache/cacheprocess.php deleted file mode 100755 index 266d031..0000000 --- a/commands/core/cache/cacheprocess.php +++ /dev/null @@ -1,18 +0,0 @@ -getMessage()); - } - } -} diff --git a/commands/core/cache/cachepurge.php b/commands/core/cache/cachepurge.php deleted file mode 100755 index 4a691bb..0000000 --- a/commands/core/cache/cachepurge.php +++ /dev/null @@ -1,18 +0,0 @@ -getMessage()); - } - } -} diff --git a/commands/core/encryption/newkey.php b/commands/core/encryption/newkey.php deleted file mode 100755 index f7dac84..0000000 --- a/commands/core/encryption/newkey.php +++ /dev/null @@ -1,31 +0,0 @@ -generate(); - } else { - echo color::translateColorsCode('&4&lWARNING: &fA key already exists. Do you want to generate a new one?&o'); - echo color::translateColorsCode('&4&lWARNING: &fGenerating a new key will make all encrypted data unreadable. &o'); - echo color::translateColorsCode('&4&lWARNING: &fType &ey&f to continue or &en&f to exit:'); - $confirm = readline(); - if (strtolower($confirm) === 'y') { - $this->generate(); - } else { - exit(color::translateColorsCode('&fExiting...&o')); - } - } - } - - public function generate() - { - $key = 'mythicalcore_' . bin2hex(random_bytes(64 * 32)); - cfg::set('encryption', 'key', $key); - echo color::translateColorsCode('&fKey generated successfully!&o'); - } -} diff --git a/composer.lock b/composer.lock index 91c4005..b2f45b1 100755 --- a/composer.lock +++ b/composer.lock @@ -595,30 +595,38 @@ }, { "name": "composer/pcre", - "version": "3.1.4", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "04229f163664973f68f38f6f73d917799168ef24" + "reference": "ea4ab6f9580a4fd221e0418f2c357cdd39102a90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/04229f163664973f68f38f6f73d917799168ef24", - "reference": "04229f163664973f68f38f6f73d917799168ef24", + "url": "https://api.github.com/repos/composer/pcre/zipball/ea4ab6f9580a4fd221e0418f2c357cdd39102a90", + "reference": "ea4ab6f9580a4fd221e0418f2c357cdd39102a90", "shasum": "" }, "require": { "php": "^7.4 || ^8.0" }, + "conflict": { + "phpstan/phpstan": "<1.11.8" + }, "require-dev": { - "phpstan/phpstan": "^1.3", + "phpstan/phpstan": "^1.11.8", "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^5" + "phpunit/phpunit": "^8 || ^9" }, "type": "library", "extra": { "branch-alias": { "dev-main": "3.x-dev" + }, + "phpstan": { + "includes": [ + "extension.neon" + ] } }, "autoload": { @@ -646,7 +654,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/3.1.4" + "source": "https://github.com/composer/pcre/tree/3.2.0" }, "funding": [ { @@ -662,7 +670,7 @@ "type": "tidelift" } ], - "time": "2024-05-27T13:40:54+00:00" + "time": "2024-07-25T09:36:02+00:00" }, { "name": "composer/semver", @@ -921,16 +929,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.59.3", + "version": "v3.60.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29" + "reference": "e595e4e070d17c5d42ed8c4206f630fcc5f401a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/30ba9ecc2b0e5205e578fe29973c15653d9bfd29", - "reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/e595e4e070d17c5d42ed8c4206f630fcc5f401a4", + "reference": "e595e4e070d17c5d42ed8c4206f630fcc5f401a4", "shasum": "" }, "require": { @@ -1012,7 +1020,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.59.3" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.60.0" }, "funding": [ { @@ -1020,7 +1028,7 @@ "type": "github" } ], - "time": "2024-06-16T14:17:03+00:00" + "time": "2024-07-25T09:26:51+00:00" }, { "name": "myclabs/deep-copy", From 5ec048a22a2c47be5380d402cfac0a5a6fb5005c Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Thu, 25 Jul 2024 12:07:49 +0200 Subject: [PATCH 15/17] PUSH -> Added a script so you can count how many lines of code the app has :) --- FIRST_INSTALL | 0 composer.json | 3 ++- devtools/count_php_lines.bash | 36 +++++++++++++++++++++++++++++++++++ settings.json | 0 4 files changed, 38 insertions(+), 1 deletion(-) mode change 100755 => 100644 FIRST_INSTALL create mode 100755 devtools/count_php_lines.bash mode change 100755 => 100644 settings.json diff --git a/FIRST_INSTALL b/FIRST_INSTALL old mode 100755 new mode 100644 diff --git a/composer.json b/composer.json index 99441bd..950658f 100755 --- a/composer.json +++ b/composer.json @@ -65,7 +65,8 @@ "bash devtools/push.bash", "git push origin develop", "composer run tests", - "composer run lint" + "composer run lint", + "bash devtools/count_php_lines.bash" ], "pull": [ "export COMPOSER_ALLOW_SUPERUSER=1", diff --git a/devtools/count_php_lines.bash b/devtools/count_php_lines.bash new file mode 100755 index 0000000..0d26394 --- /dev/null +++ b/devtools/count_php_lines.bash @@ -0,0 +1,36 @@ +#!/bin/bash + +# Set the directory to search for PHP files +directory="./" + +# Initialize the line count +line_count=0 + +apt install bc -y >> /dev/null 2>&1 + +# Function to recursively count lines of code in PHP files +count_lines() { + local dir="$1" + local files=$(find "$dir" -type f -name "*.php" ! -path "*/node_modules/*" ! -path "*/vendor/*") + + for file in $files; do + # Count the lines of code in the file and add it to the line count + lines=$(wc -l < "$file") + line_count=$((line_count + lines)) + done +} + +# Call the function to count lines of code +count_lines "$directory" + +# Format the line count +if (( line_count >= 1000000 )); then + formatted_count=$(printf "%.2fM" "$(bc -l <<< "$line_count/1000000")") +elif (( line_count >= 1000 )); then + formatted_count=$(printf "%.2fK" "$(bc -l <<< "$line_count/1000")") +else + formatted_count=$line_count +fi + +# Print the total line count +echo "Total lines of code: $formatted_count" diff --git a/settings.json b/settings.json old mode 100755 new mode 100644 From 99fd7ca9ad9fc4bf639fc496ce6d906164e8a213 Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Thu, 25 Jul 2024 12:36:21 +0200 Subject: [PATCH 16/17] PUSH -> Update readme --- .github/README.md | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/README.md b/.github/README.md index 27b8f3b..6f706a7 100755 --- a/.github/README.md +++ b/.github/README.md @@ -1,17 +1,16 @@ -# Framework +# MythicalFramework -The core framework for our projects ;) +One of the best frameworks to start learning php <3 -For devs that want to modify the frontend using tailwind css make sure you build the frontend first :) +## Support +Donations: +- [GitHub](https://github.com/sponsors/nayskutzu/) +- [PayPal](https://paypal.me/nayskutzu) +- [Discord](https://discord.mythicalsystems.xyz) (Joining the server also helps <3) +- [Star](https://github.com/MythicalLTD/Framework) (Consider staring this repo!) -```bash -# Clean old build files -composer run frontend:clear -# Download the dependency's (Requires NodeJS) -composer run frontend:install:dependency -# Build the new frontend -composer run frontend:build +## Repository Activity -# Or you can also use watch to watch the changes live! -composer run frontend:watch -``` +![Alt](https://repobeats.axiom.co/api/embed/c403f00d546911a7f80a4e9ace2628c2ab760b04.svg "Repobeats analytics image") + +*Copyright MythicalSystems LTDĀ® 2020-2024* \ No newline at end of file From ce01f6c12fe4993a676f6b05eeb0e75c58145ce0 Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Tue, 6 Aug 2024 23:55:43 +0200 Subject: [PATCH 17/17] PUSH -> Update packages :) -> Finish caches -> Removed ol settings profiler --- FIRST_INSTALL | 0 ...tingsManager.php => DBSettingsManager.php} | 30 +----- app/Managers/LanguageManager.php | 2 +- app/Managers/Settings.php | 2 +- composer.lock | 96 +++++++++---------- install/install.php | 2 +- migrate/config/1.php | 2 +- migrate/config/2.php | 2 +- migrate/config/3.php | 2 +- public/index.php | 11 ++- settings.json | 0 11 files changed, 61 insertions(+), 88 deletions(-) mode change 100644 => 100755 FIRST_INSTALL rename app/Managers/{SettingsManager.php => DBSettingsManager.php} (80%) mode change 100644 => 100755 settings.json diff --git a/FIRST_INSTALL b/FIRST_INSTALL old mode 100644 new mode 100755 diff --git a/app/Managers/SettingsManager.php b/app/Managers/DBSettingsManager.php similarity index 80% rename from app/Managers/SettingsManager.php rename to app/Managers/DBSettingsManager.php index 03b91b3..e2f6f9f 100755 --- a/app/Managers/SettingsManager.php +++ b/app/Managers/DBSettingsManager.php @@ -7,36 +7,8 @@ /** * DEPRECATED: Use Settings class instead!! */ -class SettingsManager +class DBSettingsManager { - /** - * DEPRECATED: Use Settings class instead!! - * - * Get a setting from the database! - * - * @param string $category The category of the setting you want to get! - * @param string $key The key of the setting you want to get! - * - * @return string|null Incase if found then return the value else return null! - */ - public static function get(string $category, string $key): ?string - { - if (self::exists($category, $key)) { - $mysql = new MySQL(); - $conn = $mysql->connectMYSQLI(); - $stmt = $conn->prepare('SELECT `svalue` FROM framework_settings WHERE `skey` = ? AND `scategory` = ?'); - $stmt->bind_param('ss', $key, $category); - $stmt->execute(); - $stmt->bind_result($value); - $stmt->fetch(); - $stmt->close(); - - return $value; - } else { - return null; - } - } - /** * DEPRECATED: Use Settings class instead!! * Set a setting in the database! diff --git a/app/Managers/LanguageManager.php b/app/Managers/LanguageManager.php index f12b7d8..7cd537b 100755 --- a/app/Managers/LanguageManager.php +++ b/app/Managers/LanguageManager.php @@ -16,7 +16,7 @@ public static function getLang(): mixed try { $fallback_lang = __DIR__ . '/../../lang/en_US.php'; if (file_exists($fallback_lang)) { - $langConfig = SettingsManager::get('app', 'lang'); + $langConfig = Settings::getSetting('app', 'lang'); if (!$langConfig == '') { $langFilePath = __DIR__ . '/../../lang/' . $langConfig . '.php'; if (file_exists($langFilePath)) { diff --git a/app/Managers/Settings.php b/app/Managers/Settings.php index 248e754..a66310b 100755 --- a/app/Managers/Settings.php +++ b/app/Managers/Settings.php @@ -50,7 +50,7 @@ public static function getSetting(string $category, string $name): ?string */ public static function updateSetting(string $category, string $name, string $value, bool $updateCache = true): void { - SettingsManager::update($category, $name, $value); + DBSettingsManager::update($category, $name, $value); if ($updateCache) { MySQLCache::saveCache('framework_settings'); } diff --git a/composer.lock b/composer.lock index b2f45b1..b7135c8 100755 --- a/composer.lock +++ b/composer.lock @@ -929,16 +929,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.60.0", + "version": "v3.61.1", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "e595e4e070d17c5d42ed8c4206f630fcc5f401a4" + "reference": "94a87189f55814e6cabca2d9a33b06de384a2ab8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/e595e4e070d17c5d42ed8c4206f630fcc5f401a4", - "reference": "e595e4e070d17c5d42ed8c4206f630fcc5f401a4", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/94a87189f55814e6cabca2d9a33b06de384a2ab8", + "reference": "94a87189f55814e6cabca2d9a33b06de384a2ab8", "shasum": "" }, "require": { @@ -1020,7 +1020,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.60.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.61.1" }, "funding": [ { @@ -1028,7 +1028,7 @@ "type": "github" } ], - "time": "2024-07-25T09:26:51+00:00" + "time": "2024-07-31T14:33:15+00:00" }, { "name": "myclabs/deep-copy", @@ -1591,16 +1591,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.2.8", + "version": "11.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "a7a29e8d3113806f18f99d670f580a30e8ffff39" + "reference": "a8dce73a8938dfec7ac0daa91bdbcaae7d7188a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a7a29e8d3113806f18f99d670f580a30e8ffff39", - "reference": "a7a29e8d3113806f18f99d670f580a30e8ffff39", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a8dce73a8938dfec7ac0daa91bdbcaae7d7188a3", + "reference": "a8dce73a8938dfec7ac0daa91bdbcaae7d7188a3", "shasum": "" }, "require": { @@ -1639,7 +1639,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "11.2-dev" + "dev-main": "11.3-dev" } }, "autoload": { @@ -1671,7 +1671,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.2.8" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.3.0" }, "funding": [ { @@ -1687,7 +1687,7 @@ "type": "tidelift" } ], - "time": "2024-07-18T14:56:37+00:00" + "time": "2024-08-02T03:56:43+00:00" }, { "name": "psr/container", @@ -2216,31 +2216,31 @@ }, { "name": "react/socket", - "version": "v1.15.0", + "version": "v1.16.0", "source": { "type": "git", "url": "https://github.com/reactphp/socket.git", - "reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038" + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/socket/zipball/216d3aec0b87f04a40ca04f481e6af01bdd1d038", - "reference": "216d3aec0b87f04a40ca04f481e6af01bdd1d038", + "url": "https://api.github.com/repos/reactphp/socket/zipball/23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", + "reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", "shasum": "" }, "require": { "evenement/evenement": "^3.0 || ^2.0 || ^1.0", "php": ">=5.3.0", - "react/dns": "^1.11", + "react/dns": "^1.13", "react/event-loop": "^1.2", - "react/promise": "^3 || ^2.6 || ^1.2.1", - "react/stream": "^1.2" + "react/promise": "^3.2 || ^2.6 || ^1.2.1", + "react/stream": "^1.4" }, "require-dev": { "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", - "react/async": "^4 || ^3 || ^2", + "react/async": "^4.3 || ^3.3 || ^2", "react/promise-stream": "^1.4", - "react/promise-timer": "^1.10" + "react/promise-timer": "^1.11" }, "type": "library", "autoload": { @@ -2284,7 +2284,7 @@ ], "support": { "issues": "https://github.com/reactphp/socket/issues", - "source": "https://github.com/reactphp/socket/tree/v1.15.0" + "source": "https://github.com/reactphp/socket/tree/v1.16.0" }, "funding": [ { @@ -2292,7 +2292,7 @@ "type": "open_collective" } ], - "time": "2023-12-15T11:02:10+00:00" + "time": "2024-07-26T10:38:09+00:00" }, { "name": "react/stream", @@ -3297,16 +3297,16 @@ }, { "name": "symfony/console", - "version": "v7.1.2", + "version": "v7.1.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "0aa29ca177f432ab68533432db0de059f39c92ae" + "reference": "cb1dcb30ebc7005c29864ee78adb47b5fb7c3cd9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0aa29ca177f432ab68533432db0de059f39c92ae", - "reference": "0aa29ca177f432ab68533432db0de059f39c92ae", + "url": "https://api.github.com/repos/symfony/console/zipball/cb1dcb30ebc7005c29864ee78adb47b5fb7c3cd9", + "reference": "cb1dcb30ebc7005c29864ee78adb47b5fb7c3cd9", "shasum": "" }, "require": { @@ -3370,7 +3370,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.1.2" + "source": "https://github.com/symfony/console/tree/v7.1.3" }, "funding": [ { @@ -3386,7 +3386,7 @@ "type": "tidelift" } ], - "time": "2024-06-28T10:03:55+00:00" + "time": "2024-07-26T12:41:01+00:00" }, { "name": "symfony/event-dispatcher", @@ -3612,16 +3612,16 @@ }, { "name": "symfony/finder", - "version": "v7.1.1", + "version": "v7.1.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "fbb0ba67688b780efbc886c1a0a0948dcf7205d6" + "reference": "717c6329886f32dc65e27461f80f2a465412fdca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/fbb0ba67688b780efbc886c1a0a0948dcf7205d6", - "reference": "fbb0ba67688b780efbc886c1a0a0948dcf7205d6", + "url": "https://api.github.com/repos/symfony/finder/zipball/717c6329886f32dc65e27461f80f2a465412fdca", + "reference": "717c6329886f32dc65e27461f80f2a465412fdca", "shasum": "" }, "require": { @@ -3656,7 +3656,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.1.1" + "source": "https://github.com/symfony/finder/tree/v7.1.3" }, "funding": [ { @@ -3672,7 +3672,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-07-24T07:08:44+00:00" }, { "name": "symfony/options-resolver", @@ -3978,16 +3978,16 @@ }, { "name": "symfony/process", - "version": "v7.1.1", + "version": "v7.1.3", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "febf90124323a093c7ee06fdb30e765ca3c20028" + "reference": "7f2f542c668ad6c313dc4a5e9c3321f733197eca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/febf90124323a093c7ee06fdb30e765ca3c20028", - "reference": "febf90124323a093c7ee06fdb30e765ca3c20028", + "url": "https://api.github.com/repos/symfony/process/zipball/7f2f542c668ad6c313dc4a5e9c3321f733197eca", + "reference": "7f2f542c668ad6c313dc4a5e9c3321f733197eca", "shasum": "" }, "require": { @@ -4019,7 +4019,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.1.1" + "source": "https://github.com/symfony/process/tree/v7.1.3" }, "funding": [ { @@ -4035,7 +4035,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-07-26T12:44:47+00:00" }, { "name": "symfony/service-contracts", @@ -4184,16 +4184,16 @@ }, { "name": "symfony/string", - "version": "v7.1.2", + "version": "v7.1.3", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "14221089ac66cf82e3cf3d1c1da65de305587ff8" + "reference": "ea272a882be7f20cad58d5d78c215001617b7f07" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/14221089ac66cf82e3cf3d1c1da65de305587ff8", - "reference": "14221089ac66cf82e3cf3d1c1da65de305587ff8", + "url": "https://api.github.com/repos/symfony/string/zipball/ea272a882be7f20cad58d5d78c215001617b7f07", + "reference": "ea272a882be7f20cad58d5d78c215001617b7f07", "shasum": "" }, "require": { @@ -4251,7 +4251,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v7.1.2" + "source": "https://github.com/symfony/string/tree/v7.1.3" }, "funding": [ { @@ -4267,7 +4267,7 @@ "type": "tidelift" } ], - "time": "2024-06-28T09:27:18+00:00" + "time": "2024-07-22T10:25:37+00:00" }, { "name": "theseer/tokenizer", diff --git a/install/install.php b/install/install.php index db5201b..3959452 100755 --- a/install/install.php +++ b/install/install.php @@ -2,8 +2,8 @@ use MythicalSystemsFramework\Database\MySQL; use MythicalSystemsFramework\Managers\ConfigManager; -use MythicalSystemsFramework\Managers\SettingsManager as settings; use MythicalSystemsFramework\Database\exception\database\MySQLError; +use MythicalSystemsFramework\Managers\DBSettingsManager as settings; use MythicalSystemsFramework\Database\exception\migration\NoMigrationsFound; ini_set('display_errors', 0); diff --git a/migrate/config/1.php b/migrate/config/1.php index 34b9428..146b658 100755 --- a/migrate/config/1.php +++ b/migrate/config/1.php @@ -1,6 +1,6 @@ addFunction(new Twig\TwigFunction('setting', function ($section, $key) { - return setting::get($section, $key); + return Settings::getSetting($section, $key); })); /* * Add the cfg function to the renderer diff --git a/settings.json b/settings.json old mode 100644 new mode 100755