create Action class

This commit is contained in:
Your Name
2024-10-19 18:40:14 +03:00
parent b9541200da
commit 06bdf2c9c2
2 changed files with 58 additions and 8 deletions

29
app.php
View File

@@ -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')) {

37
src/Action.php Normal file
View File

@@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace App;
use App\Configuration\Configuration;
final class Action
{
private Configuration $configuration;
public function __construct(Configuration $configuration)
{
$this->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
{
}
}