diff --git a/.php-version b/.php-version new file mode 100644 index 0000000..223a939 --- /dev/null +++ b/.php-version @@ -0,0 +1 @@ +8.3 \ No newline at end of file diff --git a/composer.lock b/composer.lock index c50f566..e61e046 100644 --- a/composer.lock +++ b/composer.lock @@ -3125,16 +3125,16 @@ }, { "name": "symfony/flex", - "version": "v2.7.0", + "version": "v2.7.1", "source": { "type": "git", "url": "https://github.com/symfony/flex.git", - "reference": "5d743b3b78fabe9f3146586d77b0a1f9292851fc" + "reference": "4ae50d368415a06820739e54d38a4a29d6df9155" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/flex/zipball/5d743b3b78fabe9f3146586d77b0a1f9292851fc", - "reference": "5d743b3b78fabe9f3146586d77b0a1f9292851fc", + "url": "https://api.github.com/repos/symfony/flex/zipball/4ae50d368415a06820739e54d38a4a29d6df9155", + "reference": "4ae50d368415a06820739e54d38a4a29d6df9155", "shasum": "" }, "require": { @@ -3173,7 +3173,7 @@ "description": "Composer plugin for Symfony", "support": { "issues": "https://github.com/symfony/flex/issues", - "source": "https://github.com/symfony/flex/tree/v2.7.0" + "source": "https://github.com/symfony/flex/tree/v2.7.1" }, "funding": [ { @@ -3189,7 +3189,7 @@ "type": "tidelift" } ], - "time": "2025-05-23T11:41:40+00:00" + "time": "2025-05-28T14:22:54+00:00" }, { "name": "symfony/form", @@ -6623,16 +6623,16 @@ }, { "name": "symfony/var-exporter", - "version": "v6.4.21", + "version": "v6.4.22", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "717e7544aa99752c54ecba5c0e17459c48317472" + "reference": "f28cf841f5654955c9f88ceaf4b9dc29571988a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/717e7544aa99752c54ecba5c0e17459c48317472", - "reference": "717e7544aa99752c54ecba5c0e17459c48317472", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/f28cf841f5654955c9f88ceaf4b9dc29571988a9", + "reference": "f28cf841f5654955c9f88ceaf4b9dc29571988a9", "shasum": "" }, "require": { @@ -6680,7 +6680,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v6.4.21" + "source": "https://github.com/symfony/var-exporter/tree/v6.4.22" }, "funding": [ { @@ -6696,7 +6696,7 @@ "type": "tidelift" } ], - "time": "2025-04-27T21:06:26+00:00" + "time": "2025-05-14T13:00:13+00:00" }, { "name": "symfony/web-link", @@ -9145,16 +9145,16 @@ }, { "name": "symfony/phpunit-bridge", - "version": "v7.2.6", + "version": "v7.3.0", "source": { "type": "git", "url": "https://github.com/symfony/phpunit-bridge.git", - "reference": "6106ae85a0e3ed509d339b7f924788c9cc4e7cfb" + "reference": "2eabda563921f21cbce1d1e3247b3c36568905e6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/6106ae85a0e3ed509d339b7f924788c9cc4e7cfb", - "reference": "6106ae85a0e3ed509d339b7f924788c9cc4e7cfb", + "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/2eabda563921f21cbce1d1e3247b3c36568905e6", + "reference": "2eabda563921f21cbce1d1e3247b3c36568905e6", "shasum": "" }, "require": { @@ -9207,7 +9207,7 @@ "description": "Provides utilities for PHPUnit, especially user deprecation notices management", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/phpunit-bridge/tree/v7.2.6" + "source": "https://github.com/symfony/phpunit-bridge/tree/v7.3.0" }, "funding": [ { @@ -9223,7 +9223,7 @@ "type": "tidelift" } ], - "time": "2025-04-09T08:35:42+00:00" + "time": "2025-05-23T07:26:30+00:00" }, { "name": "symfony/web-profiler-bundle", @@ -9356,7 +9356,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": [], "prefer-stable": true, "prefer-lowest": false, "platform": { @@ -9364,6 +9364,6 @@ "ext-ctype": "*", "ext-iconv": "*" }, - "platform-dev": {}, + "platform-dev": [], "plugin-api-version": "2.6.0" } diff --git a/migrations/Version20250528130332.php b/migrations/Version20250528130332.php deleted file mode 100644 index 4344444..0000000 --- a/migrations/Version20250528130332.php +++ /dev/null @@ -1,50 +0,0 @@ -addSql(<<<'SQL' - CREATE TABLE emoji (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, nom VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, force DOUBLE PRECISION NOT NULL, robustesse DOUBLE PRECISION NOT NULL, intelligence DOUBLE PRECISION NOT NULL, vitesse DOUBLE PRECISION NOT NULL, nb_combat_gagne INTEGER NOT NULL, rarete INTEGER NOT NULL) - SQL); - $this->addSql(<<<'SQL' - CREATE TABLE messenger_messages (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, body CLOB NOT NULL, headers CLOB NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL, available_at DATETIME NOT NULL, delivered_at DATETIME DEFAULT NULL) - SQL); - $this->addSql(<<<'SQL' - CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name) - SQL); - $this->addSql(<<<'SQL' - CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at) - SQL); - $this->addSql(<<<'SQL' - CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at) - SQL); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql(<<<'SQL' - DROP TABLE emoji - SQL); - $this->addSql(<<<'SQL' - DROP TABLE messenger_messages - SQL); - } -} diff --git a/src/Controller/EmojiController.php b/src/Controller/EmojiController.php index 2658eb8..c846229 100644 --- a/src/Controller/EmojiController.php +++ b/src/Controller/EmojiController.php @@ -11,6 +11,7 @@ class EmojiController extends AbstractController #[Route('/emoji', name: 'app_emoji')] public function index(): Response { + $this->testToMove(); return $this->render('emoji/index.html.twig', [ 'controller_name' => 'EmojiController', ]); @@ -20,32 +21,35 @@ class EmojiController extends AbstractController return new Emoji(); } + #[Route('/emoji/fight', name: 'fight_emoji')] public function fightEmoji(Emoji $emoji1, Emoji $emoji2): Emoji { - $aleatoire = random_int(1,4); - $valEmoji1 = [$emoji1.getForce(),$emoji1.getRobustesse(),$emoji1.getIntelligence(),$emoji1.getVitesse()]; - $valEmoji2 = [$emoji2.getForce(),$emoji2.getRobustesse(),$emoji2.getIntelligence(),$emoji2.getVitesse()]; - $difference = $valEmoji1 - $valEmoji2; + $aleatoire = random_int(0,3); + $valEmoji1 = [$emoji1->getForce(),$emoji1->getRobustesse(),$emoji1->getIntelligence(),$emoji1->getVitesse()]; + $valEmoji2 = [$emoji2->getForce(),$emoji2->getRobustesse(),$emoji2->getIntelligence(),$emoji2->getVitesse()]; + $difference = $valEmoji1[$aleatoire] - $valEmoji2[$aleatoire]; if($difference > 0){ - $emoji1.wonFight(); + $emoji1->wonFight(); return $emoji1; } else { - $emoji2.wonFight(); + $emoji2->wonFight(); return $emoji2; } } - public function TestToMove(){ + public function testToMove(){ $e = new Emoji(); - $e.setForce(5); - $e.setIntelligence(2); - $e.setRobustesse(3); - $e.setVitesse(4); - $e.setNom("ROBERT"); + $e->setNom("ROBERT"); + $e->setForce(5); + $e->setIntelligence(2); + $e->setRobustesse(3); + $e->setVitesse(4); $e2 = new Emoji(); - $e2.setNom("BIBOP"); - $e2.setForce(1); - $e2.setIntelligence(1); - $e2.setRobustesse(1); - $e2.setVitesse(1); + $e2->setNom("BIBOP"); + $e2->setForce(42); + $e2->setIntelligence(1); + $e2->setRobustesse(1); + $e2->setVitesse(1); + $vic = $this->fightEmoji($e,$e2); + echo $vic->getNom(); } } diff --git a/src/Entity/Emoji.php b/src/Entity/Emoji.php index 4998996..95d29b7 100644 --- a/src/Entity/Emoji.php +++ b/src/Entity/Emoji.php @@ -131,7 +131,7 @@ class Emoji } public function wonFight() : self{ - $this->NbCombatsGagne = $this->NbCombatsGagne + 1; + $this->nbCombatGagne = $this->nbCombatGagne + 1; $this->force += 1; $this->robustesse += 1; $this->intelligence += 1; diff --git a/symfony.lock b/symfony.lock index 6eda14c..4a0d895 100644 --- a/symfony.lock +++ b/symfony.lock @@ -1,4 +1,13 @@ { + "doctrine/deprecations": { + "version": "1.1", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "1.0", + "ref": "87424683adc81d7dc305eefec1fced883084aab9" + } + }, "doctrine/doctrine-bundle": { "version": "2.13", "recipe": {