antoine.perederii 1 year ago
commit dddd9b7dbb

@ -230,184 +230,466 @@
-- END; -- END;
-- $$ LANGUAGE plpgsql; -- $$ LANGUAGE plpgsql;
-- ? 10 - Vérifier que léquipe des Spurs a été meilleure à domicile quà lextérieur pendant la saison 2021. -- -- ? 10 - Vérifier que léquipe des Spurs a été meilleure à domicile quà lextérieur pendant la saison 2021.
SELECT isBestAtHome(id, '2021') AS best_at_home -- SELECT isBestAtHome(id, '2021') AS best_at_home
FROM Team -- FROM Team
WHERE abbreviation = 'SAS'; -- WHERE abbreviation = 'SAS';
-- ? 11 - Ecrire une fonction bestAtHome qui retourne une table avec les équipes (ids, abbréviations, noms et villes) -- -- ? 11 - Ecrire une fonction bestAtHome qui retourne une table avec les équipes (ids, abbréviations, noms et villes)
-- ? qui ont gagné au moins autant de matchs à domicile quà lextérieur lors de la saison passée en paramètre. -- -- ? qui ont gagné au moins autant de matchs à domicile quà lextérieur lors de la saison passée en paramètre.
CREATE OR REPLACE FUNCTION BestAtHome(GameSeason Game.season%TYPE) -- CREATE OR REPLACE FUNCTION BestAtHome(GameSeason Game.season%TYPE)
RETURNS TABLE(id Team.id%TYPE, abbreviation Team.abbreviation%TYPE, nom Team.nickname%TYPE, ville Team.city%TYPE) AS $$ -- RETURNS TABLE(id Team.id%TYPE, abbreviation Team.abbreviation%TYPE, nom Team.nickname%TYPE, ville Team.city%TYPE) AS $$
BEGIN -- BEGIN
RETURN QUERY SELECT DISTINCT t.id, t.abbreviation, t.nickname, t.city -- RETURN QUERY SELECT DISTINCT t.id, t.abbreviation, t.nickname, t.city
FROM Team t -- FROM Team t
WHERE isBestAtHome(t.id, GameSeason) = 1; -- WHERE isBestAtHome(t.id, GameSeason) = 1;
END; -- END;
$$ LANGUAGE plpgsql; -- $$ LANGUAGE plpgsql;
-- ? 12 - Quelles équipes ont gagné au moins autant de matchs à domicile quà lextérieur en 2021? -- -- ? 12 - Quelles équipes ont gagné au moins autant de matchs à domicile quà lextérieur en 2021?
SELECT BestAtHome(2021); -- SELECT BestAtHome(2021);
-- ? 13 - Ecrire une fonction qui retourne un booléen indiquant si une équipe donnée à gagner au moins autant de matchs à -- -- ? 13 - Ecrire une fonction qui retourne un booléen indiquant si une équipe donnée à gagner au moins autant de matchs à
-- ? domiciles quà lextérieur pendant au moins n saisons consécutives, où n est un paramètre de la fonction. -- -- ? domiciles quà lextérieur pendant au moins n saisons consécutives, où n est un paramètre de la fonction.
-- ? Cette fonction devra lever une exception personnalisée si n nest pas une valeur possible. -- -- ? Cette fonction devra lever une exception personnalisée si n nest pas une valeur possible.
CREATE OR REPLACE FUNCTION isBestAtHomeDuring(teamID Team.id%TYPE, n integer) RETURNS integer AS $$ -- CREATE OR REPLACE FUNCTION isBestAtHomeDuring(teamID Team.id%TYPE, n integer) RETURNS integer AS $$
DECLARE -- DECLARE
home_wins integer; -- home_wins integer;
away_wins integer; -- away_wins integer;
consecutive_seasons integer; -- consecutive_seasons integer;
BEGIN -- BEGIN
-- Vérifier que n est une valeur valide (n doit être supérieur ou égal à 1) -- -- Vérifier que n est une valeur valide (n doit être supérieur ou égal à 1)
IF n < 1 THEN -- IF n < 1 THEN
RAISE EXCEPTION 'La valeur de n doit être d''au moins 1.'; -- RAISE EXCEPTION 'La valeur de n doit être d''au moins 1.';
END IF; -- END IF;
-- Compter le nombre de saisons
SELECT COUNT(DISTINCT season) INTO consecutive_seasons
FROM Game
WHERE idHomeTeam = teamID OR idVisitorTeam = teamID;
-- Vérifier si l'équipe a gagné au moins autant de matchs à domicile qu'à l'extérieur pour n saisons consécutives
FOR i IN 1..consecutive_seasons - n + 1 LOOP
SELECT COUNT(*) INTO home_wins
FROM Game
WHERE season BETWEEN i AND i + n - 1
AND idHomeTeam = teamID
AND ptsHome > ptsAway;
SELECT COUNT(*) INTO away_wins
FROM Game
WHERE season BETWEEN i AND i + n - 1
AND idVisitorTeam = teamID
AND ptsAway > ptsHome;
IF home_wins >= away_wins THEN
RETURN 1;
END IF;
END LOOP;
RETURN 0; -- -- Compter le nombre de saisons
END; -- SELECT COUNT(DISTINCT season) INTO consecutive_seasons
$$ LANGUAGE plpgsql; -- FROM Game
-- WHERE idHomeTeam = teamID OR idVisitorTeam = teamID;
-- -- Vérifier si l'équipe a gagné au moins autant de matchs à domicile qu'à l'extérieur pour n saisons consécutives
-- FOR i IN 1..consecutive_seasons - n + 1 LOOP
-- SELECT COUNT(*) INTO home_wins
-- FROM Game
-- WHERE season BETWEEN i AND i + n - 1
-- AND idHomeTeam = teamID
-- AND ptsHome > ptsAway;
-- SELECT COUNT(*) INTO away_wins
-- FROM Game
-- WHERE season BETWEEN i AND i + n - 1
-- AND idVisitorTeam = teamID
-- AND ptsAway > ptsHome;
-- IF home_wins >= away_wins THEN
-- RETURN 1;
-- END IF;
-- END LOOP;
-- RETURN 0;
-- END;
-- $$ LANGUAGE plpgsql;
SELECT isBestAtHomeDuring('1610612737', 1) AS best_at_home_during_one_seasons;
-- ? 14 - Y a til des équipes qui ont gagné au moins autant de matchs à domicile quà lextérieur -- SELECT isBestAtHomeDuring('1610612737', 1) AS best_at_home_during_one_seasons;
-- ? pendant 2 saisons consécutives ? Pendant 3 saisons consécutives ?
SELECT isBestAtHomeDuring('1610612737', 2) AS best_at_home_during_two_seasons; -- -- ? 14 - Y a til des équipes qui ont gagné au moins autant de matchs à domicile quà lextérieur
-- -- ? pendant 2 saisons consécutives ? Pendant 3 saisons consécutives ?
SELECT isBestAtHomeDuring('1610612737', 3) AS best_at_home_during_three_seasons; -- SELECT isBestAtHomeDuring('1610612737', 2) AS best_at_home_during_two_seasons;
-- SELECT isBestAtHomeDuring('1610612737', 3) AS best_at_home_during_three_seasons;
-- ? 15 - Écrire une fonction qui calcule lid de léquipe ayant le meilleur pourcentage moyen de paniers
-- ? à 3 points dune saison donnée.
CREATE OR REPLACE FUNCTION idTeam3Points(GameSeason numeric) RETURNS character varying AS $$ -- -- ? 15 - Écrire une fonction qui calcule lid de léquipe ayant le meilleur pourcentage moyen de paniers
DECLARE -- -- ? à 3 points dune saison donnée.
bestTeamID character varying;
BEGIN
SELECT INTO bestTeamID gd.idTeam
FROM GameDetail gd, Game g
WHERE gd.idGame = g.id AND g.season = GameSeason
GROUP BY gd.idTeam
ORDER BY AVG(gd.threePointsPrctage) DESC
LIMIT 1;
RETURN bestTeamID; -- CREATE OR REPLACE FUNCTION idTeam3Points(GameSeason numeric) RETURNS character varying AS $$
END; -- DECLARE
$$ LANGUAGE plpgsql; -- bestTeamID character varying;
-- BEGIN
-- SELECT INTO bestTeamID gd.idTeam
-- FROM GameDetail gd, Game g
-- WHERE gd.idGame = g.id AND g.season = GameSeason
-- GROUP BY gd.idTeam
-- ORDER BY AVG(gd.threePointsPrctage) DESC
-- LIMIT 1;
-- RETURN bestTeamID;
-- END;
-- $$ LANGUAGE plpgsql;
-- ? 16 - Utiliser cette fonction pour afficher la meilleure équipe (abbréviation, nom et ville) de la saison 2021 en pourcentage moyen de paniers à 3 points -- -- ? 16 - Utiliser cette fonction pour afficher la meilleure équipe (abbréviation, nom et ville) de la saison 2021 en pourcentage moyen de paniers à 3 points
SELECT abbreviation, nickname, city -- SELECT abbreviation, nickname, city
FROM Team -- FROM Team
WHERE id = idTeam3Points('2021'); -- WHERE id = idTeam3Points('2021');
-- ! charge infiniment -- -- ! charge infiniment
-- ? 17 - Écrire une fonction qui calcule combien de paniers à trois points ont été marqué par un joueur donné, pendant une saison donnée. -- -- ? 17 - Écrire une fonction qui calcule combien de paniers à trois points ont été marqué par un joueur donné, pendant une saison donnée.
CREATE OR REPLACE FUNCTION count3pointsbyplayer(idP character varying, GameSeason numeric) RETURNS numeric AS $$ -- CREATE OR REPLACE FUNCTION count3pointsbyplayer(idP character varying, GameSeason numeric) RETURNS numeric AS $$
DECLARE -- DECLARE
totalThreePoints numeric; -- totalThreePoints numeric;
BEGIN -- BEGIN
SELECT SUM(gd.threePointsMade) -- SELECT SUM(gd.threePointsMade)
INTO totalThreePoints -- INTO totalThreePoints
FROM GameDetail gd -- FROM GameDetail gd
JOIN Game g ON gd.idGame = g.id -- JOIN Game g ON gd.idGame = g.id
WHERE gd.idPlayer = idP AND g.season = GameSeason; -- WHERE gd.idPlayer = idP AND g.season = GameSeason;
RETURN totalThreePoints; -- RETURN totalThreePoints;
END; -- END;
$$ LANGUAGE plpgsql; -- $$ LANGUAGE plpgsql;
SELECT count3pointsbyplayer('203932', '2021'); -- SELECT count3pointsbyplayer('203932', '2021');
-- ? 18 - Écrire une fonction qui calcule lid du joueur ayant marqué le plus de paniers à trois points pendant une saison donnée. -- -- ? 18 - Écrire une fonction qui calcule lid du joueur ayant marqué le plus de paniers à trois points pendant une saison donnée.
CREATE OR REPLACE FUNCTION idPlayerMost3Points(GameSeason Game.season%TYPE) RETURNS Player.id%TYPE AS $$ -- CREATE OR REPLACE FUNCTION idPlayerMost3Points(GameSeason Game.season%TYPE) RETURNS Player.id%TYPE AS $$
-- DECLARE
-- best_player_id Player.id%TYPE;
-- BEGIN
-- SELECT gd.idPlayer INTO best_player_id
-- FROM GameDetail gd
-- JOIN Game g ON gd.idGame = g.id
-- WHERE g.season = GameSeason
-- GROUP BY gd.idPlayer
-- ORDER BY SUM(gd.threePointsMade) DESC
-- LIMIT 1;
-- RETURN best_player_id;
-- END;
-- $$ LANGUAGE plpgsql;
-- SELECT idPlayerMost3Points('2021');
-- -- ? 19 - En utilisant les fonctions précédement créées, écrire un bloc anonyme qui affiche pour chaque saison, par ordre chronologique,
-- -- ? le nom du joueur ayant marqué le plus de paniers à trois points ainsi que le nombres de paniers à trois points marqués.
-- DO $$
-- DECLARE
-- season_value Game.season%TYPE;
-- player_id Player.id%TYPE;
-- total_3_points numeric;
-- BEGIN
-- FOR season_value IN (SELECT DISTINCT season FROM Game ORDER BY season) LOOP
-- player_id := idPlayerMost3Points(season_value);
-- total_3_points := count3PointsByPlayer(player_id, season_value);
-- RAISE NOTICE 'Saison %: Joueur ID %, Nombre de paniers à trois points : %', season_value, player_id, total_3_points;
-- END LOOP;
-- END;
-- $$;
-- -- ? 20 - Ce calcul est très long. Pour effectuer un calcul plus efficace, nous allons créer une table supplémentaire permettant de stocker des statistiques.
-- -- ? Créer la table Stats(season, player, threePoints) contenant le nombre de paniers à trois points marqués par chaque joueur pendant une saison et
-- -- ? la remplir avec les données contenues dans GameDetail.
-- -- ? △! Penser à éliminer les valeurs NULL.
-- CREATE TABLE Stats (
-- season numeric,
-- player varchar(10),
-- threePoints numeric
-- );
-- -- Insertion des données de GameDetail dans la table Stats
-- INSERT INTO Stats (season, player, threePoints)
-- SELECT g.season, gd.idPlayer, SUM(gd.threePointsMade)
-- FROM GameDetail gd, Game g
-- WHERE gd.idGame = g.id AND gd.threePointsMade IS NOT NULL
-- GROUP BY g.season, gd.idPlayer;
-- ? 21 - Utiliser la table Stats pour refaire le calcul de la question 19.
SELECT s.season, s.player, s.threePoints
FROM Stats s
WHERE s.threePoints >= ALL(SELECT threePoints FROM Stats s2 WHERE s2.season = s.season);
-- ? 22 - Écrire une fonction qui calcule la différence #rebonds offensifs - #rebonds défensifs
-- ? pour un joueur et une saison donnée.
-- ! △! aux valeurs nulles !
CREATE OR REPLACE FUNCTION reboundsDifference(idP Player.id%TYPE, GameSeason Game.season%TYPE) RETURNS integer AS $$
DECLARE DECLARE
best_player_id Player.id%TYPE; offensiveRebounds integer;
defensiveRebounds integer;
BEGIN BEGIN
SELECT gd.idPlayer INTO best_player_id SELECT SUM(gd.offensiveRebounds) INTO offensiveRebounds
FROM GameDetail gd FROM GameDetail gd, Game g
JOIN Game g ON gd.idGame = g.id WHERE gd.idGame = g.id AND gd.idPlayer = idP AND g.season = GameSeason;
WHERE g.season = GameSeason
GROUP BY gd.idPlayer SELECT SUM(gd.defensiveRebounds) INTO defensiveRebounds
ORDER BY SUM(gd.threePointsMade) DESC FROM GameDetail gd, Game g
LIMIT 1; WHERE gd.idGame = g.id AND gd.idPlayer = idP AND g.season = GameSeason;
RETURN best_player_id; RETURN offensiveRebounds - defensiveRebounds;
END; END;
$$ LANGUAGE plpgsql; $$ LANGUAGE plpgsql;
SELECT idPlayerMost3Points('2021'); SELECT reboundsDifference('203932', '2021');
-- CREATE FUNCTION
-- reboundsdifference
-- --------------------
-- -165
-- (1 row)
-- ? 23 - Ajouter une colonne reboundsRatio à la table Stats.
ALTER TABLE Stats ADD reboundsRatio integer;
-- ? 19 - En utilisant les fonctions précédement créées, écrire un bloc anonyme qui affiche pour chaque saison, par ordre chronologique, -- ? 24 - Écrire un bloc anonyme permettant de remplir la colonne reboundsRatio.
-- ? le nom du joueur ayant marqué le plus de paniers à trois points ainsi que le nombres de paniers à trois points marqués.
DO $$ DO $$
DECLARE DECLARE
season_value Game.season%TYPE; SaisonS Game.season%TYPE;
player_id Player.id%TYPE; PlayerId Player.id%TYPE;
total_3_points numeric; rebondsDifference integer;
BEGIN BEGIN
FOR season_value IN (SELECT DISTINCT season FROM Game ORDER BY season) LOOP FOR SaisonS IN (SELECT DISTINCT season FROM Game ORDER BY season) LOOP
player_id := idPlayerMost3Points(season_value); FOR PlayerId IN (SELECT DISTINCT p.id
total_3_points := count3PointsByPlayer(player_id, season_value); FROM Player p, Game g, GameDetail gd
RAISE NOTICE 'Saison %: Joueur ID %, Nombre de paniers à trois points : %', season_value, player_id, total_3_points; WHERE p.id = gd.idPlayer AND g.id = gd.idGame AND g.season = SaisonS) LOOP
rebondsDifference := reboundsDifference(PlayerId, SaisonS);
UPDATE Stats SET reboundsRatio = rebondsDifference WHERE season = SaisonS AND player = PlayerId;
END LOOP;
END LOOP; END LOOP;
END; END;
$$; $$;
-- ? 25 - Afficher (sur une seule ligne) le joueur ayant réalisé pendant une saison le plus grand et celui
-- ? ayant réalisé le plus petit ratio de rebonds.
-- ? 20 - Ce calcul est très long. Pour effectuer un calcul plus efficace, nous allons créer une table supplémentaire permettant de stocker des statistiques. SELECT DISTINCT s1.player, s1.season, s1.reboundsRatio, s2.player, s2.season, s2.reboundsRatio
-- ? Créer la table Stats(season, player, threePoints) contenant le nombre de paniers à trois points marqués par chaque joueur pendant une saison et FROM Stats s1, Stats s2
-- ? la remplir avec les données contenues dans GameDetail. WHERE s1.reboundsRatio >= ALL(SELECT reboundsRatio FROM Stats)
-- ? △! Penser à éliminer les valeurs NULL. AND s2.reboundsRatio <= ALL(SELECT reboundsRatio FROM Stats);
CREATE TABLE Stats ( -- player | season | reboundsratio | player | season | reboundsratio
season numeric, -- --------+--------+---------------+--------+--------+---------------
player varchar(10), -- 203500 | 2017 | 61 | 708 | 2003 | -834
threePoints numeric -- (1 row)
);
-- ? 26 - Écrire une fonction qui calcule le pourcentage de joueur non américains jouant dans une
-- ? équipe donnée.
CREATE OR REPLACE FUNCTION PercPlayerNoAmerican(TeamId Team.id%TYPE) RETURNS numeric AS $$
DECLARE
nbPlayerNoAmerican integer;
nbPlayerAmerican numeric;
nbPlayerTotal numeric;
PercPlayerNoAmerican numeric(6,4);
BEGIN
SELECT count(p.id) INTO nbPlayerAmerican
FROM Player p, GameDetail gd, Team t
WHERE t.id = gd.idTeam AND t.id = TeamId AND gd.idPlayer = p.id AND p.country = 'USA';
-- Insertion des données de GameDetail dans la table Stats SELECT count(p.id) INTO nbPlayerNoAmerican
INSERT INTO Stats (season, player, threePoints) FROM Player p, GameDetail gd, Team t
SELECT g.season, gd.idPlayer, SUM(gd.threePointsMade) WHERE t.id = gd.idTeam AND t.id = TeamId AND gd.idPlayer = p.id AND p.country != 'USA';
FROM GameDetail gd, Game g
WHERE gd.idGame = g.id AND gd.threePointsMade IS NOT NULL nbPlayerTotal := nbPlayerAmerican + nbPlayerNoAmerican;
GROUP BY g.season, gd.idPlayer; PercPlayerNoAmerican := nbPlayerNoAmerican / nbPlayerTotal;
RETURN PercPlayerNoAmerican * 100;
END;
$$ LANGUAGE plpgsql;
SELECT PercPlayerNoAmerican('1610612737');
-- psql:requetesTP4-5-6.sql:499: NOTICE: type reference team.id%TYPE converted to character varying
-- CREATE FUNCTION
-- percplayernoamerican
-- ----------------------
-- 19.3500
-- (1 row)
-- ? 27 - Afficher le pourcentage de joueurs étrangers dans chaque équipe au format suivant :
-- ? abbreviation | nickname | city | foreigner
-- ? --------------+---------------+---------------+-----------
-- ? ATL | Hawks | Atlanta | 0.12
SELECT t.abbreviation, t.nickname, t.city, PercPlayerNoAmerican(t.id) AS foreigner
FROM Team t
ORDER BY foreigner DESC;
-- abbreviation | nickname | city | foreigner
-- --------------+---------------+---------------+-----------
-- SAS | Spurs | San Antonio | 39.1200
-- DAL | Mavericks | Dallas | 32.0000
-- TOR | Raptors | Toronto | 31.2100
-- UTA | Jazz | Utah | 29.1500
-- MIL | Bucks | Milwaukee | 25.8700
-- DEN | Nuggets | Denver | 25.3100
-- PHX | Suns | Phoenix | 24.9900
-- CLE | Cavaliers | Cleveland | 22.5100
-- ORL | Magic | Orlando | 21.8200
-- OKC | Thunder | Oklahoma City | 21.2400
-- MIN | Timberwolves | Minnesota | 21.1400
-- GSW | Warriors | Golden State | 20.3500
-- ATL | Hawks | Atlanta | 19.3500
-- HOU | Rockets | Houston | 18.8400
-- CHI | Bulls | Chicago | 18.5200
-- SAC | Kings | Sacramento | 18.1400
-- MEM | Grizzlies | Memphis | 17.8000
-- LAL | Lakers | Los Angeles | 16.1600
-- PHI | 76ers | Philadelphia | 16.0500
-- BKN | Nets | Brooklyn | 15.6600
-- WAS | Wizards | Washington | 15.4400
-- NOP | Pelicans | New Orleans | 15.1100
-- NYK | Knicks | New York | 14.2300
-- POR | Trail Blazers | Portland | 14.1600
-- CHA | Hornets | Charlotte | 14.1100
-- BOS | Celtics | Boston | 13.4700
-- DET | Pistons | Detroit | 12.3300
-- MIA | Heat | Miami | 11.2500
-- LAC | Clippers | Los Angeles | 10.6000
-- IND | Pacers | Indiana | 9.9200
-- (30 rows)
-- ! pas le meme score !!?
-- ? 28 - Dans quelle conférence, y a til le plus de joueurs étrangers?
SELECT t.conference, PercPlayerNoAmerican(t.id) AS foreigner
FROM Team t
ORDER BY foreigner DESC;
-- conference | foreigner
-- ------------+-----------
-- W | 39.1200
-- W | 32.0000
-- E | 31.2100
-- W | 29.1500
-- E | 25.8700
-- W | 25.3100
-- W | 24.9900
-- E | 22.5100
-- E | 21.8200
-- W | 21.2400
-- W | 21.1400
-- W | 20.3500
-- E | 19.3500
-- W | 18.8400
-- E | 18.5200
-- W | 18.1400
-- W | 17.8000
-- W | 16.1600
-- E | 16.0500
-- E | 15.6600
-- E | 15.4400
-- W | 15.1100
-- E | 14.2300
-- W | 14.1600
-- E | 14.1100
-- E | 13.4700
-- E | 12.3300
-- E | 11.2500
-- W | 10.6000
-- E | 9.9200
-- (30 rows)
-- ? 29 - Écrire une fonction qui calcule le total de points marqués par un joueur donné.
CREATE OR REPLACE FUNCTION totalPointsByPlayer(idP Player.id%TYPE) RETURNS integer AS $$
DECLARE
totalPoints integer;
BEGIN
SELECT SUM(gd.points) INTO totalPoints
FROM GameDetail gd
WHERE gd.idPlayer = idP;
RETURN totalPoints;
END;
$$ LANGUAGE plpgsql;
SELECT totalPointsByPlayer('203932');
-- totalpointsbyplayer
-- ---------------------
-- 7263
-- (1 row)
-- ? 30 - Calculer le nombre de points moyens marqués par un joueur par pays. Ordonner les résultats
-- ? de façon à avoir les meilleurs pays en premier.
SELECT p.country, AVG(totalPointsByPlayer(p.id)) AS average_points
FROM Player p
GROUP BY p.country
ORDER BY average_points DESC;
-- country | average_points
-- ----------------------------------+------------------------
-- U.S. Virgin Islands | 13782.0000000000000000
-- Bahamas | 7640.0000000000000000
-- Cameroon | 6941.3333333333333333
-- Switzerland | 6214.0000000000000000
-- Democratic Republic of the Congo | 5333.0000000000000000
-- Spain | 5275.5000000000000000
-- Italy | 5257.3333333333333333
-- Turkey | 5235.5555555555555556
-- Germany | 5180.5454545454545455
-- Montenegro | 5139.6000000000000000
-- Slovenia | 4555.7777777777777778
-- Finland | 4270.0000000000000000
-- Bahams | 4195.0000000000000000
-- Haiti | 4188.5000000000000000
-- Dominican Republic | 4027.8000000000000000
-- Venezuela | 3935.0000000000000000
-- Serbia and Montenegro | 3877.0000000000000000
-- New Zealand | 3793.0000000000000000
-- Argentina | 3746.3636363636363636
-- Lithuania | 3579.8000000000000000
-- UK | 3133.8571428571428571
-- Poland | 3108.0000000000000000
-- Australia | 3050.7777777777777778
-- Greece | 2990.3333333333333333
-- Bosnia & Herzgovina | 2936.0000000000000000
-- France | 2909.4193548387096774
-- Brazil | 2814.3846153846153846
-- Sweden | 2641.5000000000000000
-- Serbia | 2550.9285714285714286
-- Canada | 2503.3428571428571429
-- China | 2305.0000000000000000
-- Netherlands | 2235.5000000000000000
-- Latvia | 2225.8000000000000000
-- Puerto Rico | 2104.3333333333333333
-- Israel | 2038.3333333333333333
-- Croatia | 2004.5714285714285714
-- USA | 1948.3770794824399261
-- Georgia | 1901.6000000000000000
-- Czech Republic | 1661.3333333333333333
-- Russia | 1602.4000000000000000
-- Bosnia | 1558.0000000000000000
-- Ukraine | 1331.0000000000000000
-- Belize | 1232.0000000000000000
-- St. Vincent & Grenadines | 1214.0000000000000000
-- Mexico | 1088.3333333333333333
-- Egypt | 1062.0000000000000000
-- Mali | 1030.0000000000000000
-- Macedonia | 842.0000000000000000
-- Congo | 836.5000000000000000
-- Panama | 793.0000000000000000
-- Tunisia | 763.0000000000000000
-- Nigeria | 716.2857142857142857
-- Senegal | 699.1000000000000000
-- Tanzania | 585.0000000000000000
-- South Sudan | 549.6666666666666667
-- Japan | 488.0000000000000000

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="18" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="18" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />

@ -2,7 +2,7 @@
<project version="4"> <project version="4">
<component name="ProjectModuleManager"> <component name="ProjectModuleManager">
<modules> <modules>
<module fileurl="file://$PROJECT_DIR$/TP1.iml" filepath="$PROJECT_DIR$/TP1.iml" /> <module fileurl="file://$PROJECT_DIR$/untitled.iml" filepath="$PROJECT_DIR$/untitled.iml" />
</modules> </modules>
</component> </component>
</project> </project>

@ -0,0 +1,25 @@
package MedecinProject;
public record Patient(String nom, String prenom, int age) {
@Override
public String nom() {
return nom;
}
@Override
public String prenom() {
return prenom;
}
@Override
public int age() {
return age;
}
@Override
public String toString() {
return "- Patient :" + nom() + " " + prenom() + " agé de : " + age() + " ans";
}
}

@ -0,0 +1,26 @@
package MedecinProject;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class Patienthèque {
private List<Patient> listePatient;
public Patienthèque(){
listePatient = new ArrayList<Patient>();
}
public void addPatient(Patient patient){
listePatient.add(patient);
}
@Override
public String toString() {
StringBuilder chaineDeCaractere = new StringBuilder();
for (Patient patient : listePatient){
chaineDeCaractere.append(patient.toString());
}
return chaineDeCaractere.toString();
}
}

@ -0,0 +1,7 @@
package Utilitaire;
public class Affichage {
public static void afficher(String message){
System.out.println(message);
}
}

@ -0,0 +1,23 @@
package Utilitaire;
import MedecinProject.Patient;
import java.util.Scanner;
public class SaisisseurPatient {
public static Patient saisirPatient(){
Scanner scan = new Scanner(System.in);
Integer ageScan;
String nomScan;
String prenomScan;
System.out.println("Saisissez un nom : ");
nomScan = scan.next();
System.out.println("Saisissez un prenom : ");
prenomScan = scan.next();
System.out.println("Saisissez un age : ");
ageScan = scan.nextInt();
return new Patient(nomScan, prenomScan, ageScan);
}
}

@ -1,28 +1,23 @@
package main; package main;
import models.Patient; import MedecinProject.*;
import models.Patientheque;
import utilitaires.Afficheur;
public class Main { import Utilitaire.Affichage;
import Utilitaire.SaisisseurPatient;
import java.util.List;
import static Utilitaire.Affichage.afficher;
import static Utilitaire.SaisisseurPatient.saisirPatient;
public static void testAfficherPatient(){
Patientheque lesPatients = new Patientheque();
Patient A = new Patient("josette", "morice", 89);
Patient B = new Patient("Gerard", "lanvin", 59);
lesPatients.addPatient(A);
lesPatients.addPatient(B);
Afficheur.afficherLesPatients(lesPatients.toString());
}
// public static void testAnimalFourrure(){
// Animal af = new AnimalFourrure("ours", 1, 0);
// System.out.println(af.getNom());
// System.out.println(af.getZone());
// System.out.println(af.getClass());
// }
public class Main {
public static void main(String[] args){ public static void main(String[] args){
testAfficherPatient(); Patienthèque lesPatient = new Patienthèque();
for (int i = 0; i < 2; i++) {
Patient patient = saisirPatient();
lesPatient.addPatient(patient);
}
afficher(lesPatient.toString());
} }
} }

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

@ -0,0 +1,5 @@
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" project-jdk-name="18" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/TP1.iml" filepath="$PROJECT_DIR$/TP1.iml" />
</modules>
</component>
</project>

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,28 @@
package main;
import models.Patient;
import models.Patientheque;
import utilitaires.Afficheur;
public class Main {
public static void testAfficherPatient(){
Patientheque lesPatients = new Patientheque();
Patient A = new Patient("josette", "morice", 89);
Patient B = new Patient("Gerard", "lanvin", 59);
lesPatients.addPatient(A);
lesPatients.addPatient(B);
Afficheur.afficherLesPatients(lesPatients.toString());
}
// public static void testAnimalFourrure(){
// Animal af = new AnimalFourrure("ours", 1, 0);
// System.out.println(af.getNom());
// System.out.println(af.getZone());
// System.out.println(af.getClass());
// }
public static void main(String[] args){
testAfficherPatient();
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -0,0 +1,22 @@
<?php
namespace Classes;
class Personne {
private $nom;
private $prenom;
private $anneeNaissance;
private $email;
// Constructeur
public function __construct($nom, $prenom, $anneeNaissance, $email) {
$this->nom = $nom;
$this->prenom = $prenom;
$this->anneeNaissance = $anneeNaissance;
$this->email = $email;
}
// Méthode magique pour l'affichage
public function __toString() {
return "Nom: {$this->nom}, Prénom: {$this->prenom}, Année de Naissance: {$this->anneeNaissance}, Email: {$this->email}";
}
}

@ -0,0 +1,19 @@
<?php
class Validation {
// Méthode pour valider une adresse email
public static function validerEmail($email) {
return filter_var($email, FILTER_VALIDATE_EMAIL);
}
public static function validerAge($age) {
return filter_var($age, FILTER_VALIDATE_INT);
}
// Méthode pour nettoyer une chaîne de caractères
public static function nettoyerChaine($chaine) {
return filter_var($chaine, FILTER_DEFAULT);
}
}
?>

@ -1,10 +0,0 @@
<html>
<body>
<?php
// foreach ($tab as $t)
// echo $t . "</br>";
echo "hello world";
?>
</body>
</html>

@ -0,0 +1,22 @@
<?php
// Initialise le tableau TMessage avec des messages d'erreur
//$TMessage = ['Division par zéro', 'Valeur invalide'];
//
//// Inclut la page fonction.php pour pouvoir apeler les fonctions
//require('fonction.php');
//
//// Exemples d'utilisation
//echo pourcentageAvis('favorable', 10, 40) . "<br>";
//echo pourcentageAvis('defavorable', 10, 40) . "<br>";
//
//echo pourcentageAvis2("defavorable", 5, 8, $TMessage) . "<br>";
//echo pourcentageAvis2("defavorable", 0, 0, $TMessage) . "<br>";
//
//// Inclut la page erreur.php pour afficher les messages d'erreur
//require('erreur.php');
require('testPersonne.php');
require('testPersonnes.php');
require('saisirPersonne.php');
?>

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Erreur</title>
</head>
<body>
<h1>Messages d'erreur :</h1>
<?php
// Vérifie si le tableau TMessage est défini
if (!empty($TMessage)) {
// Parcourir le tableau TMessage et afficher chaque message d'erreur
echo "<ul>";
foreach ($TMessage as $erreur) {
echo "<li>$erreur</li>";
}
echo "</ul>";
} else {
echo "<p>Aucun message d'erreur à afficher.</p>";
}
?>
</body>
</html>

@ -0,0 +1,50 @@
<?php
function pourcentageAvis(string $typeAvis, int $nbAvisFav, int $nbAvisDefav): string
{
// Vérifier que le type d'avis est soit "favorable" soit "defavorable"
if ($typeAvis !== 'favorable' && $typeAvis !== 'defavorable') {
return "Type d'avis non valide.";
}
// Calculer le pourcentage en fonction du type d'avis
$totalAvis = $nbAvisFav + $nbAvisDefav;
if ($totalAvis === 0) {
return "Aucun avis disponible.";
}
$pourcentage = ($typeAvis === 'favorable') ? ($nbAvisFav / $totalAvis) * 100 : ($nbAvisDefav / $totalAvis) * 100;
// Formater le résultat
return "Le pourcentage d'avis de type $typeAvis est de : " . number_format($pourcentage, 2) . "%";
}
function pourcentageAvis2(string $typeAvis, int $nbAvisFav, int $nbAvisDefav, array &$TMessage): string
{
// Vérifier que le type d'avis est soit "favorable" soit "defavorable"
if ($typeAvis !== 'favorable' && $typeAvis !== 'defavorable') {
return "Type d'avis non valide.";
}
try {
// Calculer le pourcentage en fonction du type d'avis
$totalAvis = $nbAvisFav + $nbAvisDefav;
if ($totalAvis === 0) {
throw new Exception("Division par zéro - Aucun avis disponible.");
}
$pourcentage = ($typeAvis === 'favorable') ? ($nbAvisFav / $totalAvis) * 100 : ($nbAvisDefav / $totalAvis) * 100;
// Formater le résultat
return "Le pourcentage d'avis de type $typeAvis est de : " . number_format($pourcentage, 2) . "%";
} catch (Exception $e) {
// En cas d'erreur, ajouter le message dans la table TMessage
$TMessage[] = $e->getMessage();
return "Attention : calcul du pourcentage impossible - division par zéro";
}
}
?>

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Saisie de Personne</title>
</head>
<body>
<h1>Saisie de Personne</h1>
<form action="verif.php" method="post">
<label for="nom">Nom :</label>
<input type="text" name="nom" id="nom" required>
<br>
<label for="prenom">Prénom :</label>
<input type="text" name="prenom" id="prenom" required>
<br>
<br>
<label for="age">Age :</label>
<input type="text" name="age" id="age" required>
<br>
<label for="email">Email :</label>
<input type="email" name="email" id="email" required>
<br>
<input type="submit" value="Valider">
</form>
</body>
</html>

@ -0,0 +1,12 @@
<?php
// Inclusion de la classe Personne
require_once('../classes/Personne.php');
use Classes\Personne;
// Instanciation de la classe Personne
$unePersonne = new Personne("Doe", "John", 1990, "john.doe@example.com");
// Affichage des propriétés à l'aide de la méthode magique __toString()
echo $unePersonne;

@ -0,0 +1,25 @@
<?php
// Inclure la classe Personne
require_once('../classes/Personne.php');
use Classes\Personne;
// Instancier plusieurs objets Personne
$personnes = [
new Personne("Doe", "John", 1990, "john.doe@example.com"),
new Personne("Smith", "Jane", 1985, "jane.smith@example.com"),
new Personne("DEoe", "Johqn", 1990, "john.doe@exdample.com"),
new Personne("Smsith", "Jaddne", 100, "jane.smithdd@example.com"),
new Personne("Dodsfe", "Johqzn", 1990, "john.doe@dexample.com"),
new Personne("Smitdfsh", "Jazne", 1985, "jane.smidsth@example.com"),
new Personne("Dcxvoe", "Johne", 1990, "john.doe@exdsample.com"),
new Personne("Smcxith", "Janee", 1985, "jane.smith@dsexample.com"),
// Ajoutez autant d'instances que nécessaire
];
// Appeler le script de vue
require('vuePersonnes.php');
?>

@ -0,0 +1,43 @@
<?php
require_once('../classes/Personne.php');
require_once('../classes/Validation.php');
use Classes\Personne;
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Récupérer les données du formulaire
$nom = $_POST['nom'];
$prenom = $_POST['prenom'];
$age = $_POST['age'];
$email = $_POST['email'];
// Utiliser la classe Validation pour valider l'adresse email
if (!Validation::validerEmail($email)) {
die("Adresse email invalide");
}
// Utiliser la classe Validation pour valider l'age
if (!Validation::validerAge($age)) {
die("Age invalide");
}
// Utiliser la classe Validation pour nettoyer le nom et le prénom
$nom = Validation::nettoyerChaine($nom);
$prenom = Validation::nettoyerChaine($prenom);
// Créer une instance de la classe Personne
$personne = new Personne($nom, $prenom, $age, $email);
// Afficher les données saisies, filtrées et nettoyées
echo "Nom : " . $nom . "<br>";
echo "Prénom : " . $prenom . "<br>";
echo "Age : " . $age . "<br>";
echo "Email : " . $email . "<br>";
echo "<h2>Instance de Personne :</h2>";
echo "$personne";
} else {
// Rediriger vers la page de saisie si la requête n'est pas POST
header("Location: saisirPersonne.php");
}
?>

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vue des Personnes</title>
</head>
<body>
<h1>Liste des Personnes</h1>
<ul>
<?php
// Parcourir le tableau de personnes et afficher les propriétés
foreach ($personnes as $personne) {
echo "<li>{$personne}</li>";
}
?>
</ul>
</body>
</html>

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/mvc_PSR4_twig/config" isTestSource="false" packagePrefix="config\" />
<sourceFolder url="file://$MODULE_DIR$/mvc_PSR4_twig/controleur" isTestSource="false" packagePrefix="controleur\" />
<sourceFolder url="file://$MODULE_DIR$/mvc_PSR4_twig/modeles" isTestSource="false" packagePrefix="modeles\" />
<excludeFolder url="file://$MODULE_DIR$/mvc_PSR4_twig/vendor/composer" />
<excludeFolder url="file://$MODULE_DIR$/mvc_PSR4_twig/vendor/symfony/polyfill-ctype" />
<excludeFolder url="file://$MODULE_DIR$/mvc_PSR4_twig/vendor/symfony/polyfill-mbstring" />
<excludeFolder url="file://$MODULE_DIR$/mvc_PSR4_twig/vendor/twig/twig" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/5_tp.iml" filepath="$PROJECT_DIR$/.idea/5_tp.iml" />
</modules>
</component>
</project>

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MessDetectorOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCSFixerOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCodeSnifferOptionsConfiguration">
<option name="highlightLevel" value="WARNING" />
<option name="transferred" value="true" />
</component>
<component name="PhpIncludePathManager">
<include_path>
<path value="$PROJECT_DIR$/mvc_PSR4_twig/vendor/symfony/polyfill-mbstring" />
<path value="$PROJECT_DIR$/mvc_PSR4_twig/vendor/symfony/polyfill-ctype" />
<path value="$PROJECT_DIR$/mvc_PSR4_twig/vendor/composer" />
<path value="$PROJECT_DIR$/mvc_PSR4_twig/vendor/twig/twig" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="7.0">
<option name="suggestChangeDefaultLanguageLevel" value="false" />
</component>
<component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PsalmOptionsConfiguration">
<option name="transferred" value="true" />
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../.." vcs="Git" />
</component>
</project>

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/mvc_PSR4_twig.iml" filepath="$PROJECT_DIR$/.idea/mvc_PSR4_twig.iml" />
</modules>
</component>
</project>

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/config" isTestSource="false" packagePrefix="config\" />
<sourceFolder url="file://$MODULE_DIR$/controleur" isTestSource="false" packagePrefix="controleur\" />
<sourceFolder url="file://$MODULE_DIR$/modeles" isTestSource="false" packagePrefix="modeles\" />
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-ctype" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-mbstring" />
<excludeFolder url="file://$MODULE_DIR$/vendor/twig/twig" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MessDetectorOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCSFixerOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PHPCodeSnifferOptionsConfiguration">
<option name="highlightLevel" value="WARNING" />
<option name="transferred" value="true" />
</component>
<component name="PhpIncludePathManager">
<include_path>
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
<path value="$PROJECT_DIR$/vendor/composer" />
<path value="$PROJECT_DIR$/vendor/twig/twig" />
</include_path>
</component>
<component name="PhpProjectSharedConfiguration" php_language_level="8.0">
<option name="suggestChangeDefaultLanguageLevel" value="false" />
</component>
<component name="PhpStanOptionsConfiguration">
<option name="transferred" value="true" />
</component>
<component name="PsalmOptionsConfiguration">
<option name="transferred" value="true" />
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../../.." vcs="Git" />
</component>
</project>

@ -0,0 +1,197 @@
<?php
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;
/* vuephp1.html */
class __TwigTemplate_b9d4fd87e58f6104955b79f240508016 extends Template
{
private $source;
private $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->parent = false;
$this->blocks = [
];
}
protected function doDisplay(array $context, array $blocks = [])
{
$macros = $this->macros;
// line 1
echo "<!DOCTYPE html>
<html lang=\"fr\">
<head>
<meta charset=\"UTF-8\" />
<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />
<title>Personne - formulaire</title>
<script type=\"text/javascript\">
function clearForm(oForm) {
const elements = oForm.elements;
oForm.reset();
for (i = 0; i < elements.length; i++) {
field_type = elements[i].type.toLowerCase();
switch (field_type) {
case \"text\":
case \"password\":
case \"textarea\":
case \"hidden\":
elements[i].value = \"\";
break;
case \"radio\":
case \"checkbox\":
if (elements[i].checked) {
elements[i].checked = false;
}
break;
case \"select-one\":
case \"select-multi\":
elements[i].selectedIndex = -1;
break;
default:
break;
}
}
}
</script>
</head>
<body>
<!-- on vérifie les données provenant du modèle -->
";
// line 45
if (array_key_exists("dVue", $context)) {
// line 46
echo " <div align=\"center\">
";
// line 47
if ((array_key_exists("dVueEreur", $context) && (twig_length_filter($this->env, ($context["dVueEreur"] ?? null)) > 0))) {
// line 48
echo " <h2>ERREUR !!!!!</h2>
";
// line 49
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(($context["dVueEreur"] ?? null));
foreach ($context['_seq'] as $context["_key"] => $context["value"]) {
// line 50
echo " <p>";
echo twig_escape_filter($this->env, $context["value"], "html", null, true);
echo "</p>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['value'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 52
echo " ";
}
// line 53
echo "
<h2>Personne - formulaire</h2>
<hr />
<!-- affichage de données provenant du modèle -->
";
// line 57
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["dVue"] ?? null), "data", [], "any", false, false, false, 57), "html", null, true);
echo "
<form method=\"post\" name=\"myform\" id=\"myform\">
<table>
<tr>
<td>Nom</td>
<td>
<input name=\"txtNom\" value=\"";
// line 64
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["dVue"] ?? null), "nom", [], "any", false, false, false, 64), "html", null, true);
echo "\" type=\"text\" size=\"20\" />
</td>
</tr>
<tr>
<td>Age</td>
<td>
<input
name=\"txtAge\"
value=\"";
// line 72
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["dVue"] ?? null), "age", [], "any", false, false, false, 72), "html", null, true);
echo "\"
type=\"text\"
size=\"3\"
required
/>
</td>
</tr>
<tr></tr>
</table>
<table>
<tr>
<td><input type=\"submit\" value=\"Envoyer\" /></td>
<td><input type=\"reset\" value=\"Rétablir\" /></td>
<td>
<input
type=\"button\"
value=\"Effacer\"
onclick=\"clearForm(this.form);\"
/>
</td>
</tr>
</table>
<!-- action !!!!!!!!!! -->
<input type=\"hidden\" name=\"action\" value=\"validationFormulaire\" />
</form>
</div>
";
} else {
// line 99
echo " <p>Erreur !!<br />utilisation anormale de la vuephp</p>
";
}
// line 101
echo " <p>
Essayez de mettre du code html dans nom -> Correspond à une attaque de type injection
</p>
</body>
</html>
";
}
public function getTemplateName()
{
return "vuephp1.html";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 170 => 101, 166 => 99, 136 => 72, 125 => 64, 115 => 57, 109 => 53, 106 => 52, 97 => 50, 93 => 49, 90 => 48, 88 => 47, 85 => 46, 83 => 45, 37 => 1,);
}
public function getSourceContext()
{
return new Source("", "vuephp1.html", "/Users/Perederii/IUT/2A/php/5_tp/mvc_PSR4_twig/templates/vuephp1.html");
}
}

@ -0,0 +1,185 @@
<?php
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Error\RuntimeError;
use Twig\Extension\SandboxExtension;
use Twig\Markup;
use Twig\Sandbox\SecurityError;
use Twig\Sandbox\SecurityNotAllowedTagError;
use Twig\Sandbox\SecurityNotAllowedFilterError;
use Twig\Sandbox\SecurityNotAllowedFunctionError;
use Twig\Source;
use Twig\Template;
/* vuephp1.html */
class __TwigTemplate_2ce784f5b9085065b66af58be97997ff169e0f0d71d95a1d280acea4a24fd4e6 extends Template
{
private $source;
private $macros = [];
public function __construct(Environment $env)
{
parent::__construct($env);
$this->source = $this->getSourceContext();
$this->parent = false;
$this->blocks = [
];
}
protected function doDisplay(array $context, array $blocks = [])
{
$macros = $this->macros;
// line 1
echo "<html>
<head><title>Personne - formulaire</title>
<script type=\"text/javascript\">
function clearForm(oForm) {
var elements = oForm.elements;
oForm.reset();
for(i=0; i<elements.length; i++) {
\tfield_type = elements[i].type.toLowerCase();
\t
\tswitch(field_type) {
\t
\t\tcase \"text\":
\t\tcase \"password\":
\t\tcase \"textarea\":
\t case \"hidden\":\t
\t\t\t
\t\t\telements[i].value = \"\";
\t\t\tbreak;
\t\tcase \"radio\":
\t\tcase \"checkbox\":
\t\t\tif (elements[i].checked) {
\t\t\t\telements[i].checked = false;
\t\t\t}
\t\t\tbreak;
\t\tcase \"select-one\":
\t\tcase \"select-multi\":
\t\telements[i].selectedIndex = -1;
\t\t\tbreak;
\t\tdefault:
\t\t\tbreak;
\t}
}
}
</script>
</head>
<body>
// on vérifie les données provenant du modèle
";
// line 50
if (array_key_exists("dVue", $context)) {
// line 51
echo "<div align=\"center\">
";
// line 54
if ((array_key_exists("dVueEreur", $context) && (twig_length_filter($this->env, ($context["dVueEreur"] ?? null)) > 0))) {
// line 55
echo " <h2>ERREUR !!!!!</h2>
";
// line 56
$context['_parent'] = $context;
$context['_seq'] = twig_ensure_traversable(($context["dVueEreur"] ?? null));
foreach ($context['_seq'] as $context["_key"] => $context["value"]) {
// line 57
echo " ";
echo twig_escape_filter($this->env, $context["value"], "html", null, true);
echo "<br>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['value'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 59
echo " ";
}
// line 60
echo "
<h2>Personne - formulaire</h2>
<hr>
<!-- affichage de données provenant du modèle -->
";
// line 65
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["dVue"] ?? null), "data", [], "any", false, false, false, 65), "html", null, true);
echo "
<form method=\"post\" name=\"myform\" id=\"myform\">
<table> <tr>
<td>Nom</td>
<td><input name=\"txtNom\" value=\"";
// line 71
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["dVue"] ?? null), "nom", [], "any", false, false, false, 71), "html", null, true);
echo "\" type=\"text\" size=\"20\"></td>
</tr>
<tr><td>Age</td>
<td><input name=\"txtAge\" value=\"";
// line 74
echo twig_escape_filter($this->env, twig_get_attribute($this->env, $this->source, ($context["dVue"] ?? null), "age", [], "any", false, false, false, 74), "html", null, true);
echo "\" type=\"text\" size=\"3\" required></td>
</tr>
<tr>
</table>
<table> <tr>
<td><input type=\"submit\" value=\"Envoyer\"></td>
<td><input type=\"reset\" value=\"Rétablir\"></td>
<td><input type=\"button\" value=\"Effacer\" onclick=\"clearForm(this.form);\">
</td> </tr> </table>
<!-- action !!!!!!!!!! -->
<input type=\"hidden\" name=\"action\" value=\"validationFormulaire\">
</form></div>
";
} else {
// line 89
echo "erreur !!<br>
utilisation anormale de la vuephp
";
}
// line 92
echo "
<p>Essayez de mettre du code html dans nom -> Correspond à une attaque de type injection</p>
</body> </html> ";
}
public function getTemplateName()
{
return "vuephp1.html";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 161 => 92, 156 => 89, 138 => 74, 132 => 71, 123 => 65, 116 => 60, 113 => 59, 104 => 57, 100 => 56, 97 => 55, 95 => 54, 90 => 51, 88 => 50, 37 => 1,);
}
public function getSourceContext()
{
return new Source("", "vuephp1.html", "/Applications/MAMP/htdocs/phptwig/templates/vuephp1.html");
}
}

@ -0,0 +1,12 @@
{
"require": {
"twig/twig": "^3.0"
},
"autoload": {
"psr-4": {
"controleur\\": "controleur/",
"config\\": "config/",
"modeles\\": "modeles/"
}
}
}

@ -0,0 +1,39 @@
<?php
namespace config;
class Validation
{
public static function val_action($action)
{
if (!isset($action)) {
throw new \Exception('pas d\'action');
//on pourrait aussi utiliser
//$action = $_GET['action'] ?? 'no';
// This is equivalent to:
//$action = if (isset($_GET['action'])) $action=$_GET['action'] else $action='no';
}
}
public static function val_form(string &$nom, string &$age, string &$email, &$dVueEreur)
{
if (!isset($nom) || $nom == '') {
$dVueEreur[] = 'pas de nom';
$nom = '';
}
if (strlen(htmlspecialchars($nom, ENT_QUOTES) === 0)) {
$dVueEreur[] = "testative d'injection de code (attaque sécurité)";
$nom = '';
}
if (!isset($age) || $age == '' || !filter_var($age, FILTER_VALIDATE_INT)) {
$dVueEreur[] = "pas d'age ";
$age = 0;
}
if (!isset($email) || $email = '' || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
$dVueEreur[] = "pas d'email";
$email = '';
}
}
}

@ -0,0 +1,14 @@
<?php
//gen
$rep = __DIR__ . '/../';
// liste des modules à inclure
//$dConfig['includes']= array('controleur/Validation.php');
//BD
$base = 'sasa';
$login = '';
$mdp = '';

@ -0,0 +1,84 @@
<?php
namespace controleur;
class Controleur
{
public function __construct()
{
global $twig; // nécessaire pour utiliser variables globales
// on démarre ou reprend la session pas utilisée ici
session_start();
//debut
//on initialise un tableau d'erreur
$dVueEreur = [];
try {
$action = $_REQUEST['action'] ?? null;
switch($action) {
//pas d'action, on réinitialise 1er appel
case null:
$this->Reinit();
break;
case 'validationFormulaire':
$this->ValidationFormulaire($dVueEreur);
break;
//mauvaise action
default:
$dVueEreur[] = "Erreur d'appel php";
echo $twig->render('vuephp1.html', ['dVueEreur' => $dVueEreur]);
break;
}
} catch (\PDOException $e) {
//si erreur BD, pas le cas ici
$dVueEreur[] = 'Erreur inattendue!!! ';
} catch (\Exception $e2) {
$dVueEreur[] = 'Erreur inattendue!!! ';
echo $twig->render('erreur.html', ['dVueEreur' => $dVueEreur]);
}
//fin
exit(0);
}//fin constructeur
public function Reinit()
{
global $twig; // nécessaire pour utiliser variables globales
$dVue = [
'nom' => '',
'age' => 0,
'email' => '',
];
echo $twig->render('vuephp1.html', [
'dVue' => $dVue
]);
}
public function ValidationFormulaire(array $dVueEreur)
{
global $twig; // nécessaire pour utiliser variables globales
//si exception, ca remonte !!!
$nom = $_POST['txtNom']; // txtNom = nom du champ texte dans le formulaire
$age = $_POST['txtAge'];
$email = $_POST['txtEmail'];
\config\Validation::val_form($nom, $age, $email, $dVueEreur);
$model = new \modeles\Simplemodel();
$data = $model->get_data();
$dVue = [
'nom' => $nom,
'age' => $age,
'email' => $email,
'data' => $data,
];
echo $twig->render('vuephp1.html', ['dVue' => $dVue, 'dVueEreur' => $dVueEreur]);
}
}//fin class

@ -0,0 +1,16 @@
<?php
//chargement config
require_once __DIR__ . '/config/config.php';
require __DIR__ . '/vendor/autoload.php';
use controleur\Controleur;
//twig
$loader = new \Twig\Loader\FilesystemLoader('templates');
$twig = new \Twig\Environment($loader, [
'cache' => false,
]);
$cont = new Controleur();

@ -0,0 +1,15 @@
<?php
namespace modeles;
class Simplemodel
{
//constructeur
//vide
public function get_data() :string
{
return 'Mon modèle ne fait rien';
}
//fin modèles
}

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Erreur</title>
</head>
<body>
<h1>ERREUR page !!!!!</h1>
<p>{{value}}</p>
</body>
</html>

@ -0,0 +1,112 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Personne - formulaire</title>
<script type="text/javascript">
function clearForm(oForm) {
const elements = oForm.elements;
oForm.reset();
for (i = 0; i < elements.length; i++) {
field_type = elements[i].type.toLowerCase();
switch (field_type) {
case "text":
case "password":
case "textarea":
case "hidden":
elements[i].value = "";
break;
case "radio":
case "checkbox":
if (elements[i].checked) {
elements[i].checked = false;
}
break;
case "select-one":
case "select-multi":
elements[i].selectedIndex = -1;
break;
default:
break;
}
}
}
</script>
</head>
<body>
<!-- on vérifie les données provenant du modèle -->
{% if dVue is defined %}
<div align="center">
{% if dVueEreur is defined and dVueEreur|length >0 %}
<h2>ERREUR !!!!!</h2>
{% for value in dVueEreur %}
<p>{{value}}</p>
{% endfor %}
{% endif %}
<h2>Personne - formulaire</h2>
<hr />
<!-- affichage de données provenant du modèle -->
{{dVue.data}}
{% if dVue.data is not defined or (dVueEreur is defined and dVueEreur|length >0) %}
<form method="post" name="myform" id="myform">
<table>
<tr>
<td>Nom</td>
<td>
<input name="txtNom" value="{{dVue.nom}}" type="text" size="20" />
</td>
</tr>
<tr>
<td>Age</td>
<td>
<input
name="txtAge"
value="{{dVue.age}}"
type="text"
size="3"
required
/>
</td>
</tr>
<tr>
<td>Email</td>
<td>
<input name="txtEmail" value="{{dVue.email}}" type="email" size="20" />
</td>
</tr>
<tr></tr>
</table>
<table>
<tr>
<td><input type="submit" value="Envoyer" /></td>
<td><input type="reset" value="Rétablir" /></td>
<td>
<input
type="button"
value="Effacer"
onclick="clearForm(this.form);"
/>
</td>
</tr>
</table>
<!-- action !!!!!!!!!! -->
<input type="hidden" name="action" value="validationFormulaire" />
</form>
{% endif %}
</div>
{% else %}
<p>Erreur !!<br />utilisation anormale de la vuephp</p>
{% endif %}
<p>
Essayez de mettre du code html dans nom -> Correspond à une attaque de type injection
</p>
</body>
</html>

@ -0,0 +1,25 @@
<?php
// autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
$err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, $err);
} elseif (!headers_sent()) {
echo $err;
}
}
trigger_error(
$err,
E_USER_ERROR
);
}
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInita6287a55fe354aae4af95d1e4395c915::getLoader();

@ -0,0 +1,579 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Autoload;
/**
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
*
* $loader = new \Composer\Autoload\ClassLoader();
*
* // register classes with namespaces
* $loader->add('Symfony\Component', __DIR__.'/component');
* $loader->add('Symfony', __DIR__.'/framework');
*
* // activate the autoloader
* $loader->register();
*
* // to enable searching the include path (eg. for PEAR packages)
* $loader->setUseIncludePath(true);
*
* In this example, if you try to use a class in the Symfony\Component
* namespace or one of its children (Symfony\Component\Console for instance),
* the autoloader will first look for the class under the component/
* directory, and it will then fallback to the framework/ directory if not
* found before giving up.
*
* This class is loosely based on the Symfony UniversalClassLoader.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @see https://www.php-fig.org/psr/psr-0/
* @see https://www.php-fig.org/psr/psr-4/
*/
class ClassLoader
{
/** @var \Closure(string):void */
private static $includeFile;
/** @var string|null */
private $vendorDir;
// PSR-4
/**
* @var array<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array();
/**
* @var array<string, list<string>>
*/
private $prefixDirsPsr4 = array();
/**
* @var list<string>
*/
private $fallbackDirsPsr4 = array();
// PSR-0
/**
* List of PSR-0 prefixes
*
* Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
*
* @var array<string, array<string, list<string>>>
*/
private $prefixesPsr0 = array();
/**
* @var list<string>
*/
private $fallbackDirsPsr0 = array();
/** @var bool */
private $useIncludePath = false;
/**
* @var array<string, string>
*/
private $classMap = array();
/** @var bool */
private $classMapAuthoritative = false;
/**
* @var array<string, bool>
*/
private $missingClasses = array();
/** @var string|null */
private $apcuPrefix;
/**
* @var array<string, self>
*/
private static $registeredLoaders = array();
/**
* @param string|null $vendorDir
*/
public function __construct($vendorDir = null)
{
$this->vendorDir = $vendorDir;
self::initializeIncludeClosure();
}
/**
* @return array<string, list<string>>
*/
public function getPrefixes()
{
if (!empty($this->prefixesPsr0)) {
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
}
return array();
}
/**
* @return array<string, list<string>>
*/
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
/**
* @return list<string>
*/
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
/**
* @return list<string>
*/
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
/**
* @return array<string, string> Array of classname => path
*/
public function getClassMap()
{
return $this->classMap;
}
/**
* @param array<string, string> $classMap Class to filename map
*
* @return void
*/
public function addClassMap(array $classMap)
{
if ($this->classMap) {
$this->classMap = array_merge($this->classMap, $classMap);
} else {
$this->classMap = $classMap;
}
}
/**
* Registers a set of PSR-0 directories for a given prefix, either
* appending or prepending to the ones previously set for this prefix.
*
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 root directories
* @param bool $prepend Whether to prepend the directories
*
* @return void
*/
public function add($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
if ($prepend) {
$this->fallbackDirsPsr0 = array_merge(
$paths,
$this->fallbackDirsPsr0
);
} else {
$this->fallbackDirsPsr0 = array_merge(
$this->fallbackDirsPsr0,
$paths
);
}
return;
}
$first = $prefix[0];
if (!isset($this->prefixesPsr0[$first][$prefix])) {
$this->prefixesPsr0[$first][$prefix] = $paths;
return;
}
if ($prepend) {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$paths,
$this->prefixesPsr0[$first][$prefix]
);
} else {
$this->prefixesPsr0[$first][$prefix] = array_merge(
$this->prefixesPsr0[$first][$prefix],
$paths
);
}
}
/**
* Registers a set of PSR-4 directories for a given namespace, either
* appending or prepending to the ones previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
* @param bool $prepend Whether to prepend the directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function addPsr4($prefix, $paths, $prepend = false)
{
$paths = (array) $paths;
if (!$prefix) {
// Register directories for the root namespace.
if ($prepend) {
$this->fallbackDirsPsr4 = array_merge(
$paths,
$this->fallbackDirsPsr4
);
} else {
$this->fallbackDirsPsr4 = array_merge(
$this->fallbackDirsPsr4,
$paths
);
}
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
// Register directories for a new namespace.
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = $paths;
} elseif ($prepend) {
// Prepend directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$paths,
$this->prefixDirsPsr4[$prefix]
);
} else {
// Append directories for an already registered namespace.
$this->prefixDirsPsr4[$prefix] = array_merge(
$this->prefixDirsPsr4[$prefix],
$paths
);
}
}
/**
* Registers a set of PSR-0 directories for a given prefix,
* replacing any others previously set for this prefix.
*
* @param string $prefix The prefix
* @param list<string>|string $paths The PSR-0 base directories
*
* @return void
*/
public function set($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr0 = (array) $paths;
} else {
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
}
}
/**
* Registers a set of PSR-4 directories for a given namespace,
* replacing any others previously set for this namespace.
*
* @param string $prefix The prefix/namespace, with trailing '\\'
* @param list<string>|string $paths The PSR-4 base directories
*
* @throws \InvalidArgumentException
*
* @return void
*/
public function setPsr4($prefix, $paths)
{
if (!$prefix) {
$this->fallbackDirsPsr4 = (array) $paths;
} else {
$length = strlen($prefix);
if ('\\' !== $prefix[$length - 1]) {
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
}
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
$this->prefixDirsPsr4[$prefix] = (array) $paths;
}
}
/**
* Turns on searching the include path for class files.
*
* @param bool $useIncludePath
*
* @return void
*/
public function setUseIncludePath($useIncludePath)
{
$this->useIncludePath = $useIncludePath;
}
/**
* Can be used to check if the autoloader uses the include path to check
* for classes.
*
* @return bool
*/
public function getUseIncludePath()
{
return $this->useIncludePath;
}
/**
* Turns off searching the prefix and fallback directories for classes
* that have not been registered with the class map.
*
* @param bool $classMapAuthoritative
*
* @return void
*/
public function setClassMapAuthoritative($classMapAuthoritative)
{
$this->classMapAuthoritative = $classMapAuthoritative;
}
/**
* Should class lookup fail if not found in the current class map?
*
* @return bool
*/
public function isClassMapAuthoritative()
{
return $this->classMapAuthoritative;
}
/**
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
*
* @param string|null $apcuPrefix
*
* @return void
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**
* The APCu prefix in use, or null if APCu caching is not enabled.
*
* @return string|null
*/
public function getApcuPrefix()
{
return $this->apcuPrefix;
}
/**
* Registers this instance as an autoloader.
*
* @param bool $prepend Whether to prepend the autoloader or not
*
* @return void
*/
public function register($prepend = false)
{
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
if (null === $this->vendorDir) {
return;
}
if ($prepend) {
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
} else {
unset(self::$registeredLoaders[$this->vendorDir]);
self::$registeredLoaders[$this->vendorDir] = $this;
}
}
/**
* Unregisters this instance as an autoloader.
*
* @return void
*/
public function unregister()
{
spl_autoload_unregister(array($this, 'loadClass'));
if (null !== $this->vendorDir) {
unset(self::$registeredLoaders[$this->vendorDir]);
}
}
/**
* Loads the given class or interface.
*
* @param string $class The name of the class
* @return true|null True if loaded, null otherwise
*/
public function loadClass($class)
{
if ($file = $this->findFile($class)) {
$includeFile = self::$includeFile;
$includeFile($file);
return true;
}
return null;
}
/**
* Finds the path to the file where the class is defined.
*
* @param string $class The name of the class
*
* @return string|false The path if found, false otherwise
*/
public function findFile($class)
{
// class map lookup
if (isset($this->classMap[$class])) {
return $this->classMap[$class];
}
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
return false;
}
if (null !== $this->apcuPrefix) {
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
if ($hit) {
return $file;
}
}
$file = $this->findFileWithExtension($class, '.php');
// Search for Hack files if we are running on HHVM
if (false === $file && defined('HHVM_VERSION')) {
$file = $this->findFileWithExtension($class, '.hh');
}
if (null !== $this->apcuPrefix) {
apcu_add($this->apcuPrefix.$class, $file);
}
if (false === $file) {
// Remember that this class does not exist.
$this->missingClasses[$class] = true;
}
return $file;
}
/**
* Returns the currently registered loaders keyed by their corresponding vendor directories.
*
* @return array<string, self>
*/
public static function getRegisteredLoaders()
{
return self::$registeredLoaders;
}
/**
* @param string $class
* @param string $ext
* @return string|false
*/
private function findFileWithExtension($class, $ext)
{
// PSR-4 lookup
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
$first = $class[0];
if (isset($this->prefixLengthsPsr4[$first])) {
$subPath = $class;
while (false !== $lastPos = strrpos($subPath, '\\')) {
$subPath = substr($subPath, 0, $lastPos);
$search = $subPath . '\\';
if (isset($this->prefixDirsPsr4[$search])) {
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
foreach ($this->prefixDirsPsr4[$search] as $dir) {
if (file_exists($file = $dir . $pathEnd)) {
return $file;
}
}
}
}
}
// PSR-4 fallback dirs
foreach ($this->fallbackDirsPsr4 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
return $file;
}
}
// PSR-0 lookup
if (false !== $pos = strrpos($class, '\\')) {
// namespaced class name
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
} else {
// PEAR-like class name
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
}
if (isset($this->prefixesPsr0[$first])) {
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
if (0 === strpos($class, $prefix)) {
foreach ($dirs as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
}
}
}
// PSR-0 fallback dirs
foreach ($this->fallbackDirsPsr0 as $dir) {
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
return $file;
}
}
// PSR-0 include paths.
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
return $file;
}
return false;
}
/**
* @return void
*/
private static function initializeIncludeClosure()
{
if (self::$includeFile !== null) {
return;
}
/**
* Scope isolated include.
*
* Prevents access to $this/self from included files.
*
* @param string $file
* @return void
*/
self::$includeFile = \Closure::bind(static function($file) {
include $file;
}, null, null);
}
}

@ -0,0 +1,359 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer;
use Composer\Autoload\ClassLoader;
use Composer\Semver\VersionParser;
/**
* This class is copied in every Composer installed project and available to all
*
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
*
* To require its presence, you can require `composer-runtime-api ^2.0`
*
* @final
*/
class InstalledVersions
{
/**
* @var mixed[]|null
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
*/
private static $installed;
/**
* @var bool|null
*/
private static $canGetVendors;
/**
* @var array[]
* @psalm-var array<string, array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
private static $installedByVendor = array();
/**
* Returns a list of all package names which are present, either by being installed, replaced or provided
*
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackages()
{
$packages = array();
foreach (self::getInstalled() as $installed) {
$packages[] = array_keys($installed['versions']);
}
if (1 === \count($packages)) {
return $packages[0];
}
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
}
/**
* Returns a list of all package names with a specific type e.g. 'library'
*
* @param string $type
* @return string[]
* @psalm-return list<string>
*/
public static function getInstalledPackagesByType($type)
{
$packagesByType = array();
foreach (self::getInstalled() as $installed) {
foreach ($installed['versions'] as $name => $package) {
if (isset($package['type']) && $package['type'] === $type) {
$packagesByType[] = $name;
}
}
}
return $packagesByType;
}
/**
* Checks whether the given package is installed
*
* This also returns true if the package name is provided or replaced by another package
*
* @param string $packageName
* @param bool $includeDevRequirements
* @return bool
*/
public static function isInstalled($packageName, $includeDevRequirements = true)
{
foreach (self::getInstalled() as $installed) {
if (isset($installed['versions'][$packageName])) {
return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
}
}
return false;
}
/**
* Checks whether the given package satisfies a version constraint
*
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
*
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
*
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
* @param string $packageName
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
* @return bool
*/
public static function satisfies(VersionParser $parser, $packageName, $constraint)
{
$constraint = $parser->parseConstraints((string) $constraint);
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
return $provided->matches($constraint);
}
/**
* Returns a version constraint representing all the range(s) which are installed for a given package
*
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
* whether a given version of a package is installed, and not just whether it exists
*
* @param string $packageName
* @return string Version constraint usable with composer/semver
*/
public static function getVersionRanges($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
$ranges = array();
if (isset($installed['versions'][$packageName]['pretty_version'])) {
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
}
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
}
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
}
if (array_key_exists('provided', $installed['versions'][$packageName])) {
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
}
return implode(' || ', $ranges);
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['version'])) {
return null;
}
return $installed['versions'][$packageName]['version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
*/
public static function getPrettyVersion($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
return null;
}
return $installed['versions'][$packageName]['pretty_version'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
*/
public static function getReference($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
if (!isset($installed['versions'][$packageName]['reference'])) {
return null;
}
return $installed['versions'][$packageName]['reference'];
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @param string $packageName
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
*/
public static function getInstallPath($packageName)
{
foreach (self::getInstalled() as $installed) {
if (!isset($installed['versions'][$packageName])) {
continue;
}
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
}
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
}
/**
* @return array
* @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}
*/
public static function getRootPackage()
{
$installed = self::getInstalled();
return $installed[0]['root'];
}
/**
* Returns the raw installed.php data for custom implementations
*
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
* @return array[]
* @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}
*/
public static function getRawData()
{
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
self::$installed = include __DIR__ . '/installed.php';
} else {
self::$installed = array();
}
}
return self::$installed;
}
/**
* Returns the raw data of all installed.php which are currently loaded for custom implementations
*
* @return array[]
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
public static function getAllRawData()
{
return self::getInstalled();
}
/**
* Lets you reload the static array from another file
*
* This is only useful for complex integrations in which a project needs to use
* this class but then also needs to execute another project's autoloader in process,
* and wants to ensure both projects have access to their version of installed.php.
*
* A typical case would be PHPUnit, where it would need to make sure it reads all
* the data it needs from this class, then call reload() with
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
* the project in which it runs can then also use this class safely, without
* interference between PHPUnit's dependencies and the project's dependencies.
*
* @param array[] $data A vendor/composer/installed.php data set
* @return void
*
* @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $data
*/
public static function reload($data)
{
self::$installed = $data;
self::$installedByVendor = array();
}
/**
* @return array[]
* @psalm-return list<array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}>
*/
private static function getInstalled()
{
if (null === self::$canGetVendors) {
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
}
$installed = array();
if (self::$canGetVendors) {
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
if (isset(self::$installedByVendor[$vendorDir])) {
$installed[] = self::$installedByVendor[$vendorDir];
} elseif (is_file($vendorDir.'/composer/installed.php')) {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require $vendorDir.'/composer/installed.php';
$installed[] = self::$installedByVendor[$vendorDir] = $required;
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
self::$installed = $installed[count($installed) - 1];
}
}
}
}
if (null === self::$installed) {
// only require the installed.php file if this file is loaded from its dumped location,
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
if (substr(__DIR__, -8, 1) !== 'C') {
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
$required = require __DIR__ . '/installed.php';
self::$installed = $required;
} else {
self::$installed = array();
}
}
if (self::$installed !== array()) {
$installed[] = self::$installed;
}
return $installed;
}
}

@ -0,0 +1,21 @@
Copyright (c) Nils Adermann, Jordi Boggiano
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

@ -0,0 +1,10 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
);

@ -0,0 +1,11 @@
<?php
// autoload_files.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
);

@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
);

@ -0,0 +1,15 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
return array(
'modeles\\' => array($baseDir . '/modeles'),
'controleur\\' => array($baseDir . '/controleur'),
'config\\' => array($baseDir . '/config'),
'Twig\\' => array($vendorDir . '/twig/twig/src'),
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
);

@ -0,0 +1,50 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInita6287a55fe354aae4af95d1e4395c915
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
require __DIR__ . '/platform_check.php';
spl_autoload_register(array('ComposerAutoloaderInita6287a55fe354aae4af95d1e4395c915', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
spl_autoload_unregister(array('ComposerAutoloaderInita6287a55fe354aae4af95d1e4395c915', 'loadClassLoader'));
require __DIR__ . '/autoload_static.php';
call_user_func(\Composer\Autoload\ComposerStaticInita6287a55fe354aae4af95d1e4395c915::getInitializer($loader));
$loader->register(true);
$filesToLoad = \Composer\Autoload\ComposerStaticInita6287a55fe354aae4af95d1e4395c915::$files;
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
require $file;
}
}, null, null);
foreach ($filesToLoad as $fileIdentifier => $file) {
$requireFile($fileIdentifier, $file);
}
return $loader;
}
}

@ -0,0 +1,75 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInita6287a55fe354aae4af95d1e4395c915
{
public static $files = array (
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
);
public static $prefixLengthsPsr4 = array (
'm' =>
array (
'modeles\\' => 8,
),
'c' =>
array (
'controleur\\' => 11,
'config\\' => 7,
),
'T' =>
array (
'Twig\\' => 5,
),
'S' =>
array (
'Symfony\\Polyfill\\Mbstring\\' => 26,
'Symfony\\Polyfill\\Ctype\\' => 23,
),
);
public static $prefixDirsPsr4 = array (
'modeles\\' =>
array (
0 => __DIR__ . '/../..' . '/modeles',
),
'controleur\\' =>
array (
0 => __DIR__ . '/../..' . '/controleur',
),
'config\\' =>
array (
0 => __DIR__ . '/../..' . '/config',
),
'Twig\\' =>
array (
0 => __DIR__ . '/..' . '/twig/twig/src',
),
'Symfony\\Polyfill\\Mbstring\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
),
'Symfony\\Polyfill\\Ctype\\' =>
array (
0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
),
);
public static $classMap = array (
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInita6287a55fe354aae4af95d1e4395c915::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInita6287a55fe354aae4af95d1e4395c915::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInita6287a55fe354aae4af95d1e4395c915::$classMap;
}, null, ClassLoader::class);
}
}

@ -0,0 +1,251 @@
{
"packages": [
{
"name": "symfony/polyfill-ctype",
"version": "v1.28.0",
"version_normalized": "1.28.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb",
"reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"provide": {
"ext-ctype": "*"
},
"suggest": {
"ext-ctype": "For best performance"
},
"time": "2023-01-26T09:26:14+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.28-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"installation-source": "dist",
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0"
},
"funding": [
{
"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"
}
],
"install-path": "../symfony/polyfill-ctype"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.28.0",
"version_normalized": "1.28.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "42292d99c55abe617799667f454222c54c60e229"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229",
"reference": "42292d99c55abe617799667f454222c54c60e229",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"provide": {
"ext-mbstring": "*"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"time": "2023-07-28T09:04:16+00:00",
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.28-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"installation-source": "dist",
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0"
},
"funding": [
{
"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"
}
],
"install-path": "../symfony/polyfill-mbstring"
},
{
"name": "twig/twig",
"version": "v3.7.1",
"version_normalized": "3.7.1.0",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "a0ce373a0ca3bf6c64b9e3e2124aca502ba39554"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/a0ce373a0ca3bf6c64b9e3e2124aca502ba39554",
"reference": "a0ce373a0ca3bf6c64b9e3e2124aca502ba39554",
"shasum": ""
},
"require": {
"php": ">=7.2.5",
"symfony/polyfill-ctype": "^1.8",
"symfony/polyfill-mbstring": "^1.3"
},
"require-dev": {
"psr/container": "^1.0|^2.0",
"symfony/phpunit-bridge": "^5.4.9|^6.3"
},
"time": "2023-08-28T11:09:02+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
"psr-4": {
"Twig\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
},
{
"name": "Twig Team",
"role": "Contributors"
},
{
"name": "Armin Ronacher",
"email": "armin.ronacher@active-4.com",
"role": "Project Founder"
}
],
"description": "Twig, the flexible, fast, and secure template language for PHP",
"homepage": "https://twig.symfony.com",
"keywords": [
"templating"
],
"support": {
"issues": "https://github.com/twigphp/Twig/issues",
"source": "https://github.com/twigphp/Twig/tree/v3.7.1"
},
"funding": [
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/twig/twig",
"type": "tidelift"
}
],
"install-path": "../twig/twig"
}
],
"dev": true,
"dev-package-names": []
}

@ -0,0 +1,50 @@
<?php return array(
'root' => array(
'name' => '__root__',
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'reference' => NULL,
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev' => true,
),
'versions' => array(
'__root__' => array(
'pretty_version' => '1.0.0+no-version-set',
'version' => '1.0.0.0',
'reference' => NULL,
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/polyfill-ctype' => array(
'pretty_version' => 'v1.28.0',
'version' => '1.28.0.0',
'reference' => 'ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
'aliases' => array(),
'dev_requirement' => false,
),
'symfony/polyfill-mbstring' => array(
'pretty_version' => 'v1.28.0',
'version' => '1.28.0.0',
'reference' => '42292d99c55abe617799667f454222c54c60e229',
'type' => 'library',
'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
'aliases' => array(),
'dev_requirement' => false,
),
'twig/twig' => array(
'pretty_version' => 'v3.7.1',
'version' => '3.7.1.0',
'reference' => 'a0ce373a0ca3bf6c64b9e3e2124aca502ba39554',
'type' => 'library',
'install_path' => __DIR__ . '/../twig/twig',
'aliases' => array(),
'dev_requirement' => false,
),
),
);

@ -0,0 +1,26 @@
<?php
// platform_check.php @generated by Composer
$issues = array();
if (!(PHP_VERSION_ID >= 70205)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.2.5". You are running ' . PHP_VERSION . '.';
}
if ($issues) {
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
if (!ini_get('display_errors')) {
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
} elseif (!headers_sent()) {
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
}
}
trigger_error(
'Composer detected issues in your platform: ' . implode(' ', $issues),
E_USER_ERROR
);
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save