From 06bdf2c9c2cb3efbbd69175fc1b5f7407df21dd4 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 19 Oct 2024 18:40:14 +0300 Subject: [PATCH] create Action class --- app.php | 29 +++++++++++++++++++++-------- src/Action.php | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 src/Action.php diff --git a/app.php b/app.php index bad2cd4..a47309c 100644 --- a/app.php +++ b/app.php @@ -4,15 +4,9 @@ declare(strict_types=1); require __DIR__ . '/vendor/autoload.php'; +use App\Action; use App\Configuration\Configuration; - -$configuration = (new Configuration()) - ->set('param', 123) -; - -dd($configuration->getCastingType('param', 'string')->getAsCasting()); - -exit(); +use App\Casting\MapperType; \define('RED', "\033[0;31m"); \define('GREEN', "\033[1;32m"); @@ -20,6 +14,25 @@ exit(); \define('LITE_CYAN', "\e[96m"); \define('NC', "\033[0m"); +try { + + $configuration = (new Configuration()) + ->set('base_url', \getenv('gitea_instance_base_url')) + ->set('access_token', \getenv('gitea_access_token')) + ->set('owner', \getenv('gitea_owner')) + ->set('owner', \getenv('gitea_owner')) + ->set('repository', \getenv('gitea_repository')) + ->set('package_registry', \getenv('gitea_package_registry')) + ; + + (new Action($configuration))->run(); + +} catch (Exception) { + // echo 'Error: ' . $e->getMessage() . "\n" . 'Trace: ' . $e->getTraceAsString(); +} + + + function sendRequest ($method = 'GET', $endpoint = '', $data = []): array { if (!\extension_loaded('curl')) { diff --git a/src/Action.php b/src/Action.php new file mode 100644 index 0000000..dc2712a --- /dev/null +++ b/src/Action.php @@ -0,0 +1,37 @@ +configuration = $configuration; + + return $this; + } + + public function run(): void + { + $this->checkExtensions(); + $this->checkConfiguration(); + + // $this->configuration->getCastingType('param', MapperType::STRING)->getAsCasting() + } + + private function checkExtensions(): void + { + + } + + private function checkConfiguration(): void + { + + } +}