2 Commits
1.0.0 ... 1.0.2

Author SHA1 Message Date
Gregory Letellier
ae19bba912 beautify, gestion charset mysql 2023-11-14 16:49:10 +01:00
Gregory Letellier
2ae0f14b99 passage en mode composer sur le gitea 2023-11-14 14:47:21 +01:00
6 changed files with 66 additions and 17 deletions

View File

@@ -2,6 +2,5 @@
<ruleset> <ruleset>
<rule ref="PSR12"/> <rule ref="PSR12"/>
<file>src/</file> <file>src/</file>
<file>console</file>
<arg name="colors"/> <arg name="colors"/>
</ruleset> </ruleset>

View File

@@ -5,7 +5,7 @@
"license": "MIT", "license": "MIT",
"require": { "require": {
"php": "~8.1", "php": "~8.1",
"kletellier/pdowrapper": "dev-master", "kletellier/pdowrapper": "^1.0",
"symfony/http-kernel": "^6.3", "symfony/http-kernel": "^6.3",
"bramus/router": "~1.6", "bramus/router": "~1.6",
"filp/whoops": "^2.15", "filp/whoops": "^2.15",
@@ -15,8 +15,8 @@
}, },
"repositories": [ "repositories": [
{ {
"type": "git", "type": "composer",
"url": "https://git.kletellier.xyz/greg/PdoWrapper.git" "url": "https://git.kletellier.xyz/api/packages/greg/composer"
} }
], ],
"require-dev": { "require-dev": {

View File

@@ -0,0 +1,24 @@
<?php
namespace Kletellier\MiniWeb\Commands;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class TestCommand extends Command
{
protected static $defaultName = 'app:test';
protected static $defaultDescription = 'Test.';
protected function configure(): void
{
$this->setHelp('Test');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$output->writeln("test");
return Command::SUCCESS;
}
}

16
src/Controllers/Home.php Normal file
View File

@@ -0,0 +1,16 @@
<?php
namespace Kletellier\MiniWeb\Controllers;
use Kletellier\MiniWeb\Core\Controllers\Controller;
use DateTimeZone;
class Home extends Controller
{
public function index()
{
$date = new \DateTime('now', new DateTimeZone("Europe/Paris"));
$html = $this->renderView("index", ["date" => $date->format("d/m/Y H:i:s")]);
$this->render($html);
}
}

View File

@@ -77,6 +77,12 @@ class Application
$conn["DATABASE"] = $this->_root . DIRECTORY_SEPARATOR . "databases" . DIRECTORY_SEPARATOR . $conn["DATABASE"]; $conn["DATABASE"] = $this->_root . DIRECTORY_SEPARATOR . "databases" . DIRECTORY_SEPARATOR . $conn["DATABASE"];
} }
} }
if ($conn["TYPE"] == "mysql") {
$charset = isset($_ENV[$this->getKey("CHARSET", $key)]) ? $_ENV[$this->getKey("CHARSET", $key)] : null;
if ($charset !== null) {
$conn["CHARSET"] = $charset;
}
}
$ret[$connection] = $conn; $ret[$connection] = $conn;
} }
} }

View File

@@ -7,11 +7,13 @@ class Container
private static $instance; private static $instance;
private array $container; private array $container;
private function __construct() { private function __construct()
{
$this->container = []; $this->container = [];
} }
public static function getInstance() { public static function getInstance()
{
if (self::$instance === null) { if (self::$instance === null) {
self::$instance = new self(); self::$instance = new self();
} }
@@ -19,11 +21,13 @@ class Container
return self::$instance; return self::$instance;
} }
public function setValue($key, $value) { public function setValue($key, $value)
{
$this->container[$key] = $value; $this->container[$key] = $value;
} }
public function getValue($key) { public function getValue($key)
{
return isset($this->container[$key]) ? $this->container[$key] : null; return isset($this->container[$key]) ? $this->container[$key] : null;
} }