Compare commits

..

89 Commits

Author SHA1 Message Date
Antoine PEREDERII e72636c4d7 Update 'Sources/config/config.php'
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine PEREDERII 97623ba062 Merge branch 'master' of codefirst.iut.uca.fr:HeartDev/Web
continuous-integration/drone/push Build is passing Details
1 year ago
Antoine PEREDERII 32afdd093c 📝 Add MCD on the readme file
1 year ago
David D'ALMEIDA 81b7a60267 Mise à jour de 'Sources/public/index.php'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 134f3ae997 Mise à jour de 'Sources/config/config.php'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA f80492db66 Mise à jour de 'Sources/config/config.php'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 3bc50ae677 Mise à jour de 'Sources/config/config.php'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 9c03d12906 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA bfd039d9bb Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 701563d0ee Mise à jour de 'Sources/config/httpd.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA b4fe541a4f Ajouter 'Sources/config/httpd.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 505d4cd71d Mise à jour de 'Sources/src/app/controller/Controller.php'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 8d000f997b Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 88d778f245 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 32b05eeb11 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 8d5f1ddefe Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA ac7b90f0fb Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 7cdd12df73 Ajouter 'Sources/config/virtual-host.conf'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA bcd043ceb1 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 1b66f277b5 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 1fb406c58a Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA f78276dbec Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA b52ba793d3 Mise à jour de 'Sources/config/nginx.conf'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA bb6e76f54f Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 4ce92111d1 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA c7f0ab60d6 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA ddc7d843ed Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA b20436b938 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 3fb3822ac7 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 23e04e3d71 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA cb04fc199b Mise à jour de 'Sources/config/nginx.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 0d090a7183 Mise à jour de 'Sources/config/nginx.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA e4a74cb353 Mise à jour de 'Sources/config/nginx.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 8b14c2c95b Mise à jour de 'Sources/config/nginx.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 0653af150b Mise à jour de 'Sources/config/nginx.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA c334f89aba Mise à jour de 'Sources/config/nginx.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 2acea545ae Mise à jour de 'Sources/config/nginx.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA f1b97a1c0d Mise à jour de 'Sources/config/nginx.conf'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 884307f6b0 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA b0b34843b3 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build encountered an error Details
1 year ago
David D'ALMEIDA f750992a07 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build encountered an error Details
1 year ago
David D'ALMEIDA 99405eb8b7 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 4f314cf7e3 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 93f68abf43 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA f6212b6d5e Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA f0bb8fed65 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 8b1ca8d371 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 837941721d Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 664f270062 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is running Details
1 year ago
David D'ALMEIDA 9d53db8000 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA b6fdae005b Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 39cc037569 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA c5632a47fb Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 373cc847ab Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 99f9e2ec22 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 43bd7295f9 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 2d5bc5303f Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 255a81c29c Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 92e196c7e3 Mise à jour de 'Sources/config/.htaccess'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA d0db1ad041 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 176e70d020 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 64a5a2c7c6 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA 65b63b0f2f Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA eeb2b8e3ab Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA b5c62a9791 Mise à jour de 'Sources/config/Dockerfile'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA e827554413 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA e4688dbe28 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA d241bd15a1 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 7042c6a2b6 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 71d1f58cc4 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA db8ed755db Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA b58ebcf3e8 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is passing Details
1 year ago
David D'ALMEIDA e2ed1aa3e6 Mise à jour de '.drone.yml'
1 year ago
David D'ALMEIDA f7016ba5b5 Mise à jour de '.drone.yml'
1 year ago
David D'ALMEIDA b1a486622e Mise à jour de '.drone.yml'
1 year ago
David D'ALMEIDA 5caaf280b6 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 397cc32336 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 4b8e69eec6 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 06a5b72d1a Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA 3a579bb606 Mise à jour de '.drone.yml'
continuous-integration/drone/push Build is failing Details
1 year ago
David D'ALMEIDA d2296ff7d0 Mise à jour de 'README.md'
continuous-integration/drone/push Build is failing Details
1 year ago
Antoine PEREDERII 8cf1786672 update some diagrams for futur evaluation
continuous-integration/drone/push Build is failing Details
1 year ago
Antoine PEREDERII 705edbf4e5 Merge branch 'master' of codefirst.iut.uca.fr:HeartDev/Web
continuous-integration/drone/push Build is failing Details
1 year ago
Antoine PEREDERII af00c88542 add MLD and update somes diagrams
1 year ago
Antoine PEREDERII d6484b9f16 Update 'README.md'
continuous-integration/drone/push Build is failing Details
1 year ago
Antoine PEREDERII c4adf90c8d Update 'Documents/Diagramme/DiagrammeDeClasses/README_accesDonnees.md'
continuous-integration/drone/push Build is failing Details
1 year ago
Antoine PEREDERII 4609a3e3d1 Merge remote-tracking branch 'origin/merged'
continuous-integration/drone/push Build is failing Details
1 year ago
Antoine PEREDERII d57f95ca62 Merge remote-tracking branch 'origin/merged'
continuous-integration/drone/push Build is failing Details
1 year ago
Antoine PEREDERII 52ac902d0f problemes de git
continuous-integration/drone/push Build is failing Details
1 year ago

@ -0,0 +1,90 @@
kind: pipeline
type: docker
name: HeartWave
trigger:
event:
- push
steps:
# Test ✔️
- name: test
image: composer:2.6
commands:
- cd Sources
- rm -r vendor
- rm composer.lock
# Installe les dépendances PHP si nécessaire
- php composer.phar install --no-interaction
- ./vendor/bin/phpunit tests
# Sonar static code analisis deployment
# TODO : use an image that already have unzip
- name: code-analysis
image: php:8.1-cli
environment:
SONAR_TOKEN:
from_secret: SONAR_TOKEN
commands:
- apt-get update && apt-get install -y curl unzip
- export SONAR_SCANNER_VERSION=4.7.0.2747
- export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
- curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
- unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
- export PATH=$SONAR_SCANNER_HOME/bin:$PATH
- export SONAR_SCANNER_OPTS="-server"
- cd Sources
- sonar-scanner -D sonar.projectKey=HeartTrack -D sonar.host.url=https://codefirst.iut.uca.fr/sonar
depends_on: [ test ]
# build image and push on the registry ✔️
- name: rewrite-urls
image: 'busybox:latest'
commands:
- cd Sources
- ls
- >-
find . -type f -exec sed -i -r
"s@(href|src)=\"/@\1=\"$${PLUGIN_CONTAINER_PATH}@g" {} +
settings:
container_path: https://codefirst.iut.uca.fr/containers/HeartDev-web/
- name: docker-build-and-push
image: plugins/docker
settings:
commands: ls
dockerfile: Sources/config/Dockerfile
context: Sources
registry: hub.codefirst.iut.uca.fr
repo: hub.codefirst.iut.uca.fr/david.d_almeida/web
mirror: https://proxy.iut.uca.fr:8443
username:
from_secret: SECRET_REGISTRY_USERNAME
password:
from_secret: SECRET_REGISTRY_PASSWORD
depends_on:
- rewrite-urls
- name: deploy-container
image: >-
hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
environment:
IMAGENAME: 'hub.codefirst.iut.uca.fr/david.d_almeida/web:latest'
CONTAINERNAME: web
COMMAND: create
OVERWRITE: true
ADMINS: david.d_almeida
depends_on:
- docker-build-and-push
- name: notify
image: ruby:2.1
when:
status: [ success ]
ref:
include:
- refs/tags/*-demo
commands:
- sh ./notifymail.sh
depends_on: [ docker-build-and-push ]

2
.gitignore vendored

@ -29,4 +29,4 @@ sftp-config.json
sftp-config-alt*.json sftp-config-alt*.json
*.log* *.log*
coverage/ coverage/

@ -4,23 +4,75 @@
# BDD # BDD
## Modèle Logique de Données (MLD)
Le MLD représente la structure de données de l'application, décrivant les entités et les relations entre elles. Voici un aperçu des principales entités du MLD :
### Athlète (Athlete)
L'entité principale représentant un athlète avec ces informations propre à lui telles que l'identifiant, le nom, le prénom, l'email, etc. Les athlètes peuvent être coach avec le boolean idCoach et être liés par des amitiés, ou par un coaching via la table `Amitie`.
### Amitié (Friendship)
Une entité qui modélise les relations d'amitié entre les athlètes et de coaching entre les athlètes et les coachs. Elle stocke les identifiants des deux utilisateurs impliqués.
### Notification (Notification)
L'entité qui stocke les notifications destinées aux athlètes, avec des détails tels que le message, la date, le statut, et le degré d'urgence.
### Envoi de Notification (SendNotification)
Une entité de liaison entre les athlètes et les notifications, indiquant quel athlète ou coach a envoyé quelle notification. Cela peut-être utile lors d'une notification d'ajout d'amie par exemple.
### Statistique (Statistic)
Les statistiques relatives à un athlètes, y compris le poids, la fréquence cardiaque moyenne, la fréquence cardiaque maximale, etc.
### Entraînement (Training)
Détails sur les sessions d'entraînement planifiés par un coach pour ses athlètes, comprenant la date, la description, la localisation, etc. Les athlètes peuvent participer à des entraînements et donner leur feedback sur l'entrainement donné.
### Participation (Participate)
Une entité de liaison entre les athlètes et les entraînements, indiquant quels athlètes participent à quels entraînements.
### Don (GiveParticipation)
Une entité de liaison entre les coachs et les entraînements, indiquant quels coachs ont attribué quels entraînements.
### Source de Données (DataSource)
L'entité représentant la source des données des enregistrements sportif, telle que le type, le modèle, la précision, etc., utilisée par les athlètes pour enregistrer une ou des activités.
### Activité (Activity)
Les détails des activités des athlètes, y compris le type, la date, les heures de début et de fin, l'effort ressenti, etc.
### Fréquence Cardiaque (HeartRate)
Les données de fréquence cardiaque enregistrées pendant les activités, avec des informations telles que l'altitude, la température, etc.
Ce MLD forme la base de données sous-jacente pour l'application, offrant une structure organisée pour stocker et récupérer les informations relatives aux athlètes et à leurs activités.
```plantuml ```plantuml
@startuml @startuml
skinparam classAttributeIconSize 0 skinparam classAttributeIconSize 0
package MLD{ package MLD{
entity "Athlète" as athlete { entity "Athlete" as athlete {
{static} idAthlete {static} idAthlete
username
nom nom
prénom prenom
email email
sexe sexe
taille taille
poids poids
motDePasse motDePasse
dateNaissance dateNaissance
isCoach
} }
entity "Amitié" as friendship{ entity "Amitie" as friendship{
{static}# idAthlete1 {static}# idAthlete1
{static}# idAthlete2 {static}# idAthlete2
début début
@ -35,10 +87,9 @@ entity "Notification" as notif {
#athleteId #athleteId
} }
entity "Coach" as coach { entity "Envoi" as sendNotif{
{static} idCoach {static}# idAthlete
// attributs spécifiques au coach {static}# idNotif
#athleteId
} }
entity "Statistique" as stats { entity "Statistique" as stats {
@ -46,20 +97,19 @@ entity "Statistique" as stats {
poids poids
fcMoyenne fcMoyenne
fcMax fcMax
caloriesBrûléesMoy caloriesBruleesMoy
date date
#athleteId #athleteId
} }
entity "Entraînement" as training { entity "Entrainement" as training {
{static} idEntrainement {static} idEntrainement
date date
description description
// Exercices
latitude latitude
longitude longitude
feedback feedback
#coachId #athleteId
} }
entity "Participe" as takepart { entity "Participe" as takepart {
@ -67,23 +117,28 @@ entity "Participe" as takepart {
{static} #entrainementId {static} #entrainementId
} }
entity "Donne" as givepart {
{static} #coachId
{static} #entrainementId
}
entity "SourceDonnée" as source { entity "SourceDonnee" as source {
{static} idSource {static} idSource
type type
modèle modele
précision precision
#athleteId #athleteId
} }
entity "Activité" as activity { entity "Activite" as activity {
{static} idActivité {static} idActivité
type type
date date
heureDeDébut heureDeDebut
heureDeFin heureDeFin
effortRessent effortRessent
variabilité variabilite
variance variance
ecartType ecartType
moyenne moyenne
@ -108,14 +163,114 @@ entity "FréquenceCardiaque" as fc {
activity --> athlete activity --> athlete
activity --> source activity --> source
activity <-- fc activity <-- fc
coach --> athlete
athlete <-- source athlete <-- source
stats --> athlete stats --> athlete
takepart --> athlete takepart --> athlete
takepart --> training takepart --> training
givepart --> athlete
givepart --> training
sendNotif --> athlete
sendNotif --> notif
friendship --> athlete friendship --> athlete
notif --> athlete notif --> athlete
coach <-- training
athlete <-- friendship athlete <-- friendship
@enduml @enduml
```
```plantuml
@startuml
skinparam classAttributeIconSize 0
package MCD{
entity "Athlete" as athlete {
{static} idAthlete
username
nom
prenom
email
sexe
taille
poids
motDePasse
dateNaissance
isCoach
}
entity "Notification" as notif {
{static} idNotif
message
date
statut
urgence
#athleteId
}
entity "Statistique" as stats {
{static} idStatistique
poids
fcMoyenne
fcMax
caloriesBruleesMoy
date
#athleteId
}
entity "Entrainement" as training {
{static} idEntrainement
date
description
latitude
longitude
feedback
#athleteId
}
entity "SourceDonnee" as source {
{static} idSource
type
modele
precision
#athleteId
}
entity "Activite" as activity {
{static} idActivité
type
date
heureDeDebut
heureDeFin
effortRessent
variabilite
variance
ecartType
moyenne
maximum
minimum
temperatureMoyenne
#athleteId
#sourceId
}
entity "FréquenceCardiaque" as fc {
{static} idFc
altitude
temps : time
température
bpm
longitude
latitude
#activitéId
}
}
activity "0..n" --- "1..1" athlete : réalise
activity "1..n" --- "1..1" source : possede
activity "1..1" --- "1..n" fc : enregistre
athlete "1..n" --- "0..1" source : possede
stats "0..n" --- "1..1" athlete : possede
training "0..n" --- "1..n" athlete : participe
training "0..n" --- "1..1" athlete : donne
athlete "0..n" --- "1..n" athlete : est ami
notif "0..n" --- "1..n" athlete : recoit
notif "0..n" --- "1..1" athlete : envoie
@enduml
``` ```

@ -28,11 +28,11 @@ Bienvenue dans l'écosystème dynamique de notre plateforme de gestion d'activit
- Les Utilisateurs ont un rôle spécifique (Athlete, Coach) qui détermine leurs fonctionnalités. - Les Utilisateurs ont un rôle spécifique (Athlete, Coach) qui détermine leurs fonctionnalités.
- Un Athlète peut enregistrer plusieurs Activités, Statistiques, et interagir avec différentes Sources de Données. - Un Athlète peut enregistrer plusieurs Activités, possède des Statistiques, et une Sources de Données qui est la plus utilisé.
- Les Entraînements sont liés aux Utilisateurs, permettant une planification efficace. - Les Entraînements sont liés aux Utilisateurs, permettant une planification efficace.
- Les Notifications informent les Utilisateurs des événements importants. - Les Notifications informent les Utilisateurs des événements importants tels qu'une demande d'amis ou une notification d'avertissement de ban.
Explorez ce diagramme pour comprendre comment notre plateforme offre une expérience complète, de la gestion des utilisateurs à l'enregistrement des activités sportives et au suivi des performances. Explorez ce diagramme pour comprendre comment notre plateforme offre une expérience complète, de la gestion des utilisateurs à l'enregistrement des activités sportives et au suivi des performances.

@ -18,7 +18,7 @@ Bienvenue dans le cœur de notre système, où les données prennent vie à trav
- **NotificationRepository :** Responsable de la gestion des notifications, assurant un accès structuré et une manipulation sécurisée de ces informations cruciales. - **NotificationRepository :** Responsable de la gestion des notifications, assurant un accès structuré et une manipulation sécurisée de ces informations cruciales.
- **RelationshipRequestRepository :** Facilite la gestion des demandes de relations entre utilisateurs, garantissant une interaction claire et ordonnée. - **RelationshipRequestRepository :** Facilite la gestion des demandes de relations entre utilisateurs (amitiés), garantissant une interaction claire et ordonnée au sein de l'application.
- **TrainingRepository :** Permet l'accès et la manipulation des données liées aux entraînements, facilitant le suivi des performances athlétiques. - **TrainingRepository :** Permet l'accès et la manipulation des données liées aux entraînements, facilitant le suivi des performances athlétiques.
@ -26,7 +26,7 @@ Explorez ce diagramme pour découvrir la robustesse de notre architecture de ges
```plantuml ```plantuml
@startuml couche_acces_aux_donnees @startuml couche_acces_aux_donnees
abstract class IGenericRepository { interface IGenericRepository {
+ getItemById(int id) : object + getItemById(int id) : object
+ getNbItems() : int + getNbItems() : int
+ getItems(int index, int count, string orderingPropertyName, bool descending) : array + getItems(int index, int count, string orderingPropertyName, bool descending) : array

@ -4,15 +4,15 @@
# Introduction au Diagramme de Classes : Statistiques pour Coach # Introduction au Diagramme de Classes : Statistiques pour Coach
Bienvenue dans l'univers captivant de notre système de gestion d'activités sportives avec une mise au point spéciale sur les statistiques destinées aux coaches. Ce diagramme de classes offre une vue approfondie de la manière dont les utilisateurs, en particulier les athlètes et les coaches, interagissent avec les données de performance. Bienvenue dans l'univers captivant de notre système de gestion d'activités sportives avec une mise au point spéciale sur les statistiques destinées aux athlètes. Ce diagramme de classes offre une vue approfondie de la manière dont les utilisateurs, en particulier les athlètes, interagissent avec leurs statistiques.
**Entités Principales :** **Entités Principales :**
- **Utilisateur (User) :** Représente les individus inscrits sur notre plateforme, avec des détails personnels et un rôle spécifique dans l'écosystème sportif. - **Utilisateur (User) :** Représente les individus inscrits sur notre plateforme, avec des détails personnels et un rôle spécifique dans l'écosystème sportif.
- **Athlète (Athlete) :** Un type spécialisé d'utilisateur qui peut enregistrer des statistiques liées à ses activités sportives. - **Athlète (Athlete) :** Un type spécialisé d'utilisateur qui possède des statistiques liées à ses activités sportives.
- **Coach (Coach) :** Un rôle qui s'étend à partir de la classe abstraite Role, dédié à la gestion des athlètes et de leurs statistiques. - **Coach (Coach) :** Un rôle qui s'étend à partir de la classe abstraite Role, dédié à la gestion des athlètes et de la vision de leurs statistiques.
- **Statistique (Statistique) :** Contient des informations détaillées sur les performances sportives d'un athlète, telles que la distance totale, le poids, le temps total, la fréquence cardiaque moyenne, minimale et maximale, ainsi que les calories brûlées. - **Statistique (Statistique) :** Contient des informations détaillées sur les performances sportives d'un athlète, telles que la distance totale, le poids, le temps total, la fréquence cardiaque moyenne, minimale et maximale, ainsi que les calories brûlées.
@ -22,11 +22,11 @@ Bienvenue dans l'univers captivant de notre système de gestion d'activités spo
- Un Coach peut gérer une liste d'athlètes et avoir accès à leurs statistiques. - Un Coach peut gérer une liste d'athlètes et avoir accès à leurs statistiques.
- Un Athlète peut enregistrer plusieurs statistiques liées à ses activités. - Un Athlète peut enregistrer plusieurs activités afin d'avoir des statistiques liées à celle-ci.
**Objectif Principal :** **Objectif Principal :**
- Permettre aux coaches d'accéder et de surveiller les statistiques détaillées de leurs athlètes, offrant ainsi un aperçu complet de leurs performances sportives. - Permettre aux coachs d'accéder et de surveiller les statistiques détaillées de leurs athlètes, offrant ainsi un aperçu complet de leurs performances sportives.
Explorez ce diagramme pour découvrir comment notre application crée une synergie entre les utilisateurs, les rôles, et les statistiques, contribuant ainsi à une expérience enrichissante dans le suivi des activités sportives. Explorez ce diagramme pour découvrir comment notre application crée une synergie entre les utilisateurs, les rôles, et les statistiques, contribuant ainsi à une expérience enrichissante dans le suivi des activités sportives.

@ -4,7 +4,7 @@
# Introduction au Modèle de Données de l'Application # Introduction au Modèle de Données de l'Application
L'architecture de données de notre application de suivi d'activités sportives repose sur un modèle robuste, avec des entités clés pour représenter les activités, les athlètes et les coachs. Découvrez les composants principaux de notre modèle de données : L'architecture de données de notre application de suivi d'activités sportives repose sur un modèle robuste, avec des entités clés pour représenter les activités, les athlètes et les coachs et la récupération de ces données au sein de notre application. Découvrez les composants principaux de notre modèle de données :
## Activité ## Activité
L'entité Activité représente une session d'activité sportive avec des détails variés tels que le type d'activité, la date, la durée, l'effort ressenti, etc. Le `ActiviteEntity` encapsule ces données, tandis que le `ActiviteGateway` gère la communication avec la base de données pour les activités. L'entité Activité représente une session d'activité sportive avec des détails variés tels que le type d'activité, la date, la durée, l'effort ressenti, etc. Le `ActiviteEntity` encapsule ces données, tandis que le `ActiviteGateway` gère la communication avec la base de données pour les activités.

@ -4,12 +4,12 @@
# Diagramme de classes pour l'importation de fichiers .fit # Diagramme de classes pour l'importation de fichiers .fit
Bienvenue dans le monde de la gestion d'activités sportives avec notre application innovante ! Cette user story se concentre sur une fonctionnalité essentielle qui améliorera l'expérience des utilisateurs : l'importation de fichiers .fit. Nous avons conçu un diagramme de classes pour vous offrir une vision claire et structurée de la manière dont cette fonctionnalité est implémentée au sein de notre application. Bienvenue dans le monde de la gestion d'activités sportives avec notre application innovante ! Ce diagramme de classe se concentre sur une fonctionnalité essentielle qui améliorera l'expérience des utilisateurs : l'importation de fichiers .fit. Nous avons conçu un diagramme de classes pour vous offrir une vision claire et structurée de la manière dont cette fonctionnalité est implémentée au sein de notre application.
**Acteurs Principaux :** **Acteurs Principaux :**
- Utilisateur (User) : Représente un individu inscrit sur notre plateforme, avec la capacité d'importer des fichiers .fit. - Utilisateur (User) : Représente un individu inscrit sur notre plateforme.
- Athlète (Athlete) : Un type spécialisé d'utilisateur, bénéficiant de fonctionnalités supplémentaires liées à la gestion d'activités sportives. - Athlète (Athlete) : Un type spécialisé d'utilisateur, bénéficiant de fonctionnalités supplémentaires liées à la gestion d'activités sportives et avec la capacité d'importer des fichiers .fit.
**Entités Clés :** **Entités Clés :**
@ -18,13 +18,13 @@ Bienvenue dans le monde de la gestion d'activités sportives avec notre applicat
**Fonctionnalité Clé :** **Fonctionnalité Clé :**
- Importation de fichiers .fit : Permet aux utilisateurs de charger des données provenant de fichiers .fit, générés par des dispositifs de suivi d'activité. Ces fichiers contiennent des informations précieuses telles que la fréquence cardiaque, la distance parcourue et d'autres métriques essentielles. - Importation de fichiers .fit : Permet aux utilisateurs de charger des données provenant de fichiers .fit via la bibliothèque `php-fit-file-analysis`, générés par des dispositifs de suivi d'activité. Ces fichiers contiennent des informations précieuses telles que la fréquence cardiaque, la distance parcourue et d'autres données de santé importante pour nos analyses.
**Architecture :** **Architecture :**
- AuthService (Service d'Authentification) : Gère l'authentification des utilisateurs, garantissant un accès sécurisé à la fonction d'importation. - AuthService (Service d'Authentification) : Gère l'authentification des utilisateurs, garantissant un accès sécurisé à la fonction d'importation.
- UserManager (Gestionnaire d'Utilisateurs) : Gère les opérations liées aux utilisateurs, y compris l'importation de fichiers .fit. - UserManager (Gestionnaire d'Utilisateurs) : Gère les opérations liées aux utilisateurs, y compris l'importation de fichiers .fit.
ActivityManager (Gestionnaire d'Activités) : Responsable du stockage et de la gestion des activités importées. - ActivityManager (Gestionnaire d'Activités) : Responsable du stockage et de la gestion des activités importées.
**Objectif :** **Objectif :**

@ -20,4 +20,7 @@
## Diagrammes de cas d'utilisation ## Diagrammes de cas d'utilisation
- [Cas d'utilisation pour la gestion du compte et des amitiés](CasUtilisations/README_gestionCompteAmitie.md) - [Cas d'utilisation pour la gestion du compte et des amitiés](CasUtilisations/README_gestionCompteAmitie.md)
- [Cas d'utilisation pour la gestion des activités et données](CasUtilisations/README_gestionActivites.md) - [Cas d'utilisation pour la gestion des activités et données](CasUtilisations/README_gestionActivites.md)
- [Cas d'utilisation pour la suivi d'une équipe sportive](CasUtilisations/README_coachSuiviSportif.md) - [Cas d'utilisation pour la suivi d'une équipe sportive](CasUtilisations/README_coachSuiviSportif.md)
## Base de Données
- [MLD](BDD/README_BDD.md)

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 27 KiB

@ -71,7 +71,8 @@ Documentation et informations à propos de `HearthTrack` disponible [ici]()
### Prerequisites ### Prerequisites
* [Visual Studio code](https://code.visualstudio.com/) - exemple d'IDE gratuit * [Visual Studio code](https://code.visualstudio.com/) - exemple d'IDE gratuit
* [Git](https://git-scm.com/) - Versioning * [Git](https://git-scm.com/) - Versioning
* [XAMPP : X, Apache, MySQL, Perl, PHP](https://www.apachefriends.org/fr/index.html) - Langages * [XAMPP : X, Apache, MySQL, Perl, PHP](https://www.apachefriends.org/fr/index.html) - Languages
* [PostgreSQL](https://www.postgresql.org/) - Base de Donnée
## Getting Started ## Getting Started
1. Cloner le répos 1. Cloner le répos
@ -80,7 +81,7 @@ Documentation et informations à propos de `HearthTrack` disponible [ici]()
4. Lancer le serveur Apache et MySQL 4. Lancer le serveur Apache et MySQL
5. Lancer le projet avec `php -S localhost:8000 -t Sources/` 5. Lancer le projet avec `php -S localhost:8000 -t Sources/`
6. Ouvrir le navigateur et aller sur `localhost:8000/index.php` 6. Ouvrir le navigateur et aller sur `localhost:8000/index.php`
## Features ## Features
* [x] Import de fichier .fit * [x] Import de fichier .fit
* [x] Ajout d'amis * [x] Ajout d'amis

@ -9,40 +9,37 @@
"Repository\\": "src/data/model/repository", "Repository\\": "src/data/model/repository",
"Manager\\": "src/data/model/manager", "Manager\\": "src/data/model/manager",
"Network\\": "src/data/core/network", "Network\\": "src/data/core/network",
"Console\\": "src/console",
"Stub\\": [ "Stub\\": [
"src/data/stub", "src/data/stub",
"src/data/stub/service", "src/data/stub/service",
"src/data/stub/repository" "src/data/stub/repository"
], ],
"Console\\": "src/console",
"Shared\\": "src/shared", "Shared\\": "src/shared",
"App\\Router\\": "src/app/router", "App\\Router\\": "src/app/router",
"App\\Controller\\": "src/app/controller", "App\\Controller\\": "src/app/controller",
"App\\Router\\Response\\": "src/app/router/response", "App\\Router\\Response\\" : "src/app/router/response",
"App\\Router\\Middleware\\": "src/app/router/middleware", "App\\Router\\Middleware\\" : "src/app/router/middleware",
"App\\Router\\Request\\": "src/app/router/request", "App\\Router\\Request\\" : "src/app/router/request",
"Shared\\Exception\\": "src/shared/exception", "Shared\\Exception\\": "src/shared/exception",
"Shared\\Attributes\\": "src/shared/attributes", "Shared\\Attributes\\": "src/shared/attributes",
"App\\Views\\Directives\\": "src/app/views/directives", "App\\Views\\Directives\\" : "src/app/views/directives",
"Data\\Core\\": "src/data/core/" "Data\\Core\\": "src/data/core/"
} }
}, },
"require": { "require": {
"twig/twig": "^3.0", "twig/twig": "^3.0",
"vlucas/phpdotenv": "^5.5",
"adriangibbons/php-fit-file-analysis": "^3.2.0",
"altorouter/altorouter": "1.1.0", "altorouter/altorouter": "1.1.0",
"psr/container": "^2.0" "vlucas/phpdotenv": "^5.5",
}, "psr/container": "^2.0",
"config": { "adriangibbons/php-fit-file-analysis": "^3.2.0"
"process-timeout": 2000
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "*" "phpunit/phpunit": "*"
}, },
"scripts": { "scripts": {
"dev": "php -S localhost:8081 -t public -d display_errors=1 -d error_reporting=E_ALL", "dev": "php -S localhost:8080 -t public -d display_errors=1 -d error_reporting=E_ALL",
"dev:console": "export APP_ENV=console && php public/index.php", "dev:console": "export APP_ENV=console && php public/index.php",
"dev:html": "export APP_ENV=html && php -S localhost:8080 -t public -d display_errors=1 -d error_reporting=E_ALL" "dev:html" : "export APP_ENV=html && php -S localhost:8080 -t public -d display_errors=1 -d error_reporting=E_ALL"
} }
} }

@ -0,0 +1,2 @@
AddType text/css .css
AddType application/javascript .js

@ -1,17 +1,31 @@
FROM php:8.2-fpm FROM php:8.2-apache as base
# Installation de dépendances nécessaires pour Composer # Installation de dépendances nécessaires pour Composer
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
git \ git \
unzip unzip
# Installation de Composer # Installation de Composer
# TODO : should use a image with composer install
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN docker-php-ext-install pdo pdo_mysql RUN docker-php-ext-install pdo pdo_mysql
COPY . /var/www/ # Copy configs
COPY ./config/virtual-host.conf /etc/apache2/sites-available/000-default.conf
COPY ./config/httpd.conf /etc/apache2/httpd.conf
# Setup App
RUN mkdir -p /app/public && chown -R www-data:www-data /app
WORKDIR /app
# add sources code
COPY . /app
ENV VOLUME_PATH /app/public
RUN composer install
WORKDIR /var/www/ EXPOSE 80
RUN composer install CMD ["apache2-foreground"]

@ -5,12 +5,13 @@ use Shared\Log;
$dotenv = Dotenv::createUnsafeImmutable(__DIR__,'.env'); $dotenv = Dotenv::createUnsafeImmutable(__DIR__,'.env');
$dotenv->safeLoad(); $dotenv->safeLoad();
// echo($_ENV);
// apenrently getEnv is not a good thing cause // apenrently getEnv is not a good thing cause
// const DB_HOST = $_ENV['DB_HOST'] ?? 'localhost'; // const DB_HOST = $_ENV['DB_HOST'] ?? 'localhost';
// const DB_DATABASE = $_ENV['DB_DATABASE'] ?? 'heartTrack'; // const DB_DATABASE = $_ENV['DB_DATABASE'] ?? 'heartTrack';
// const DB_USER = $_ENV['DB_USER'] ?? 'toto'; // const DB_USER = $_ENV['DB_USER'] ?? 'toto';
// const DB_PASSWORD = $_ENV['DB_PASSWORD'] ?? 'achanger'; // const DB_PASSWORD = $_ENV['DB_PASSWORD'] ?? 'achanger';
define("APP_ENV", getenv('APP_ENV')); define("APP_ENV", 'development');
const DB_HOST = 'localhost'; const DB_HOST = 'localhost';
const DB_DATABASE = 'heartTrack'; const DB_DATABASE = 'heartTrack';

@ -0,0 +1 @@
SetEnv ASSET_PREFIX containers/HeartDev-web/

@ -1,28 +1,19 @@
server { server {
listen 80; listen 80;
index index.php; index index.php index.html index.htm;
root /var/www/public; root /usr/share/nginx/html;
error_page 404 /index.php; error_page 404 /index.php;
location ~ ^/(images|javascript|js|css|flash|media|static)/ {
root /var/www/public;
}
location ~ \.php$ { location ~ \.php$ {
fastcgi_pass web:9000; # service name defined in docker-compose.yml file like web
fastcgi_param REQUEST_METHOD $request_method; fastcgi_param REQUEST_METHOD $request_method;
fastcgi_index index.php; fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params; include fastcgi_params;
} }
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
location / { location / {
try_files $uri $uri/ /index.php?$query_string; root /usr/share/nginx/html;
try_files $uri /index.php;
} }
} }

@ -0,0 +1,39 @@
<VirtualHost *:80>
ServerName default
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory ${VOLUME_PATH}>
AllowOverride All
Require all granted
</Directory>
DocumentRoot ${VOLUME_PATH}
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /proc/self/fd/1 combined
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
# Multiple DirectoryIndex directives within the same context will add
# to the list of resources to look for rather than replace
# https://httpd.apache.org/docs/current/mod/mod_dir.html#directoryindex
DirectoryIndex disabled
DirectoryIndex index.php index.html
</VirtualHost>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 692 B

After

Width:  |  Height:  |  Size: 586 B

File diff suppressed because it is too large Load Diff

@ -12,7 +12,7 @@ use Manager\DataManager;
use Repository\IUserRepository; use Repository\IUserRepository;
use Shared\ArgumentControllerResolver; use Shared\ArgumentControllerResolver;
use Shared\IArgumentResolver; use Shared\IArgumentResolver;
use Network\AuthService; use Stub\AuthService;
use Stub\NotificationRepository; use Stub\NotificationRepository;
use Stub\TrainingRepository; use Stub\TrainingRepository;
use Stub\UserRepository; use Stub\UserRepository;
@ -30,13 +30,13 @@ use Network\RelationshipService;
use Network\INotificationService; use Network\INotificationService;
use Stub\NotificationService; use Stub\NotificationService;
use App\Router\Session;
use Stub\StubData; use Stub\StubData;
use Twig\Environment; use Twig\Environment;
use Twig\Loader\FilesystemLoader; use Twig\Loader\FilesystemLoader;
use Shared\IHashPassword; use Shared\IHashPassword;
use Shared\HashPassword; use Shared\HashPassword;
use Shared\Log;
$appFactory = new AppCreator(); $appFactory = new AppCreator();
$appFactory->registerService(IArgumentResolver::class, ArgumentControllerResolver::class); $appFactory->registerService(IArgumentResolver::class, ArgumentControllerResolver::class);
@ -54,6 +54,7 @@ $appFactory->registerService(IUserRepository::class, UserRepository::class);
$appFactory->registerService(\Twig\Loader\LoaderInterface::class, function() { $appFactory->registerService(\Twig\Loader\LoaderInterface::class, function() {
return new FilesystemLoader(__DIR__ . '/../src/app/views/Templates'); return new FilesystemLoader(__DIR__ . '/../src/app/views/Templates');
}); });
@ -64,12 +65,4 @@ $appFactory->registerService(\Twig\Environment::class,\Twig\Environment::class);
// $databaseContext = DatabaseContext::getInstance(); // $databaseContext = DatabaseContext::getInstance();
$appFactory->AddControllers(); $appFactory->AddControllers();
$app = $appFactory->create();
if (!is_null($app)){
// Ajout des Middleware
/*$app->use(new LoggingMiddleware());*/
$app->use(new AuthMiddleware($appFactory->getDicontainer()->get(IAuthService::class) ));
$app->mapControllers();
$app->run(RequestFactory::createFromGlobals());
}

@ -1,34 +0,0 @@
/*!
* Start Bootstrap - New Age v6.0.7 (https://startbootstrap.com/theme/new-age)
* Copyright 2013-2023 Start Bootstrap
* Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-new-age/blob/master/LICENSE)
*/
//
// Scripts
//
window.addEventListener('DOMContentLoaded', event => {
// Activate Bootstrap scrollspy on the main nav element
const mainNav = document.body.querySelector('#mainNav');
if (mainNav) {
new bootstrap.ScrollSpy(document.body, {
target: '#mainNav',
offset: 74,
});
};
// Collapse responsive navbar when toggler is visible
const navbarToggler = document.body.querySelector('.navbar-toggler');
const responsiveNavItems = [].slice.call(
document.querySelectorAll('#navbarResponsive .nav-link')
);
responsiveNavItems.map(function (responsiveNavItem) {
responsiveNavItem.addEventListener('click', () => {
if (window.getComputedStyle(navbarToggler).display !== 'none') {
navbarToggler.click();
}
});
});
});

@ -1,34 +0,0 @@
/*!
* Start Bootstrap - New Age v6.0.7 (https://startbootstrap.com/theme/new-age)
* Copyright 2013-2023 Start Bootstrap
* Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-new-age/blob/master/LICENSE)
*/
//
// Scripts
//
window.addEventListener('DOMContentLoaded', event => {
// Activate Bootstrap scrollspy on the main nav element
const mainNav = document.body.querySelector('#mainNav');
if (mainNav) {
new bootstrap.ScrollSpy(document.body, {
target: '#mainNav',
offset: 74,
});
};
// Collapse responsive navbar when toggler is visible
const navbarToggler = document.body.querySelector('.navbar-toggler');
const responsiveNavItems = [].slice.call(
document.querySelectorAll('#navbarResponsive .nav-link')
);
responsiveNavItems.map(function (responsiveNavItem) {
responsiveNavItem.addEventListener('click', () => {
if (window.getComputedStyle(navbarToggler).display !== 'none') {
navbarToggler.click();
}
});
});
});

@ -29,6 +29,9 @@ class App
private FrontController $frontController; private FrontController $frontController;
private Session $session;
public function __construct(string $appName, int $version, \App\Container $diContainer) public function __construct(string $appName, int $version, \App\Container $diContainer)
{ {
$this->appName = $appName; $this->appName = $appName;
@ -36,7 +39,7 @@ class App
$this->container = $diContainer; $this->container = $diContainer;
$this->router = new Router(""); $this->router = new Router("");
$this->frontController = new FrontController($this->router,$this->container); $this->frontController = new FrontController($this->router,$this->container);
Session::getInstance(); $this->session = Session::getInstance();
} }
public function use(IHttpMiddleware $middleware) public function use(IHttpMiddleware $middleware)
@ -137,9 +140,9 @@ class App
/** @var RouteAttribute $route */ /** @var RouteAttribute $route */
$route = $attribute->newInstance(); $route = $attribute->newInstance();
$this->router->addControllerRoute( $this->router->addControllerRoute(
$route->getMethods(), implode('|', $route->getMethods()),
$prefix . $route->getPath(), $prefix . $route->getPath(),
$controllerClass, $controllerClass,
$method->getName(), $method->getName(),

@ -24,13 +24,6 @@ class AppCreator
return $this; return $this;
} }
public function registerSingleton(string $serviceId, $service): self
{
$this->container->set($serviceId, $service, Container::SINGLETON);
$this->services[] = $serviceId;
return $this;
}
/** /**
* Create an instance or perform actions based on the current application environment. * Create an instance or perform actions based on the current application environment.
* *
@ -40,7 +33,6 @@ class AppCreator
{ {
// Check the application environment // Check the application environment
switch (APP_ENV) { switch (APP_ENV) {
case 'console': case 'console':
// Load the Console.php file in case of the 'console' environment // Load the Console.php file in case of the 'console' environment
require_once __DIR__ . '/../console/Console.php'; require_once __DIR__ . '/../console/Console.php';
@ -48,6 +40,7 @@ class AppCreator
case 'development': case 'development':
// Create a new instance of the App class in the 'development' environment // Create a new instance of the App class in the 'development' environment
return new App("HeartTrack", 1, $this->container); return new App("HeartTrack", 1, $this->container);
break;
case 'html': case 'html':
// Load the index.test.php file in case of the 'html' environment // Load the index.test.php file in case of the 'html' environment
require_once __DIR__ . '/index.test.php'; require_once __DIR__ . '/index.test.php';
@ -60,6 +53,7 @@ class AppCreator
} }
function AddControllers($namespacePrefix = 'App\Controller', $pathToControllers = __DIR__ . '/controller'): self function AddControllers($namespacePrefix = 'App\Controller', $pathToControllers = __DIR__ . '/controller'): self
{ {
$controllerFiles = glob($pathToControllers . '/*.php'); $controllerFiles = glob($pathToControllers . '/*.php');
@ -77,8 +71,7 @@ class AppCreator
if ($reflectionClass->isSubclassOf(BaseController::class)) { if ($reflectionClass->isSubclassOf(BaseController::class)) {
// Register in DI container // Register in DI container
$this->container->set($fullClassName, function () use ($fullClassName) { $this->container->set($fullClassName, function () use ($fullClassName) {
/** @var $controllerInstance * */ $controllerInstance = new $fullClassName();
$controllerInstance = $this->container->resolve($fullClassName);
$controllerInstance->setContainer($this->container); $controllerInstance->setContainer($this->container);
return $controllerInstance; return $controllerInstance;
}); });
@ -93,11 +86,6 @@ class AppCreator
{ {
return $this->services; return $this->services;
} }
public function getDicontainer()
{
return $this->container;
}
} }

@ -11,45 +11,31 @@ class Container implements ContainerInterface
{ {
private array $entries = []; private array $entries = [];
const SINGLETON = 'singleton';
const TRANSIENT = 'transient';
public function get(string $id) public function get(string $id)
{ {
if ($this->has($id)) { if ($this->has($id)) {
$entry = $this->entries[$id]; $entry = $this->entries[$id];
if (is_callable($entry)) {
if ($entry['lifecycle'] === self::SINGLETON) { return $entry($this);
if ($entry['instance'] === null) {
$entry['instance'] = $this->resolve($entry['concrete']);
}
return $entry['instance'];
}
if (is_callable($entry['concrete'])) {
return $entry['concrete']($this);
} }
return $this->resolve($entry['concrete']); $id = $entry;
} }
return $this->resolve($id); return $this->resolve($id);
} }
public function has(string $id): bool public function has(string $id): bool
{ {
return isset($this->entries[$id]); return isset($this->entries[$id]);
} }
public function set(string $id, callable|string $concrete, string $lifecycle = self::TRANSIENT): void public function set(string $id, callable|string $concrete): void
{ {
$this->entries[$id] = [ $this->entries[$id] = $concrete;
'concrete' => $concrete,
'lifecycle' => $lifecycle,
'instance' => null
];
} }
public function resolve(string $id) public function resolve(string $id)

@ -2,10 +2,6 @@
namespace App\Controller; namespace App\Controller;
use Database\AthleteMapper;
use Database\EntrainementGateway;
use Database\EntrainementMapper;
use Shared\Validation;
use App\Container; use App\Container;
use App\Router\Request\IRequest; use App\Router\Request\IRequest;
use App\Router\Response\Response; use App\Router\Response\Response;
@ -13,132 +9,62 @@ use Shared\Attributes\Route;
use Twig\Environment; use Twig\Environment;
use Data\Core\Preferences; use Data\Core\Preferences;
use Shared\Log; use Shared\Log;
use Manager\UserManager;
use Database\Connexion;
use Database\AthleteGateway;
class AthleteController extends BaseController class AthleteController extends BaseController
{ {
private Environment $twig; #[Route(path: '/search-ath', name: 'search-ath', methods: ['GET'])]
protected Preferences $preference;
public function __construct()
{
//session_start();
$this->preference = new Preferences();
}
// #[Route(path: '/search-user', name: 'search-user', methods: ['GET'])]
// public function searchUser(string $username, IRequest $req): Response
// {
// $taberror = [];
// if(!Validation::val_string($username)){
// print("Nom invalide.");
// }
// else {
// try {
// $athleteGateway = new AthleteGateway(new Connexion("mysql:host=localhost;dbname=sae_3", "Perederii", ""));
//// $listSearch=$this->container->get(UserManager::class)->searchUsersByName($username);
// $listSearch = $athleteGateway->getAthlete();
// $map = new AthleteMapper ();
// $athleteEntity = $map->athleteSqlToEntity($listSearch);
// foreach ($athleteEntity as $entity) {
// $users = $map->athleteEntityToModel($entity);
// $listUsers[$i++]=['nom' => $users->getNom(), 'prenom'=>$users->getPrenom(), 'img'=>'john_doe'];
// }
//
// $i=0;
// foreach ($users as $user){
// echo "<h1> HELLO </h1>";
// $listUsers[$i++]=['nom' => $user->getNom(), 'prenom'=>$user->getPrenom(), 'img'=>'john_doe', 'username'=>$user->getUsername()];
// }
// echo "<h1> HEllO </h1>";
// //$currentUser=$this->container->get(UserManager::class)->getCurrentUser();
// //$currentUser=$_SESSION['user'];
// $response = $this->render('./page/addfriend.html.twig',[
// 'css' => $_COOKIE['preferences'],
// 'pp' => "test",
// 'user' => 'johndoe',//$currentUser->getUsername(),
// 'role' => 'Athlete',//$currentUser->getRole(),
// 'users' => $listUsers
// ]);
// } catch (\Throwable $th) {
// throw $th;
// return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
// }
// }
// return $response;
//
// }
#[Route(path: '/search-user', name: 'search-user', methods: ['GET'])]
public function searchUser(string $username, IRequest $req): Response public function searchUser(string $username, IRequest $req): Response
{ {
$taberror = []; $taberror = [];
if (!Validation::val_string($username)) { $utiliArray = [
print("Nom invalide."); [
} else { 'nom' => 'John',
try { 'prenom' => 'Doe',
$athleteGateway = new AthleteGateway(new Connexion("pgsql:host=localhost;dbname=sae_3", "Perederii", "")); 'img' => 'john_doe',
$listSearch = $athleteGateway->getAthlete($username); 'username' => 'johndoe',
$map = new AthleteMapper(); ],
$athleteEntity = $map->athleteSqlToEntity($listSearch); [
'nom' => 'Alice',
$listUsers = []; 'prenom' => 'Smith',
$i = 0; 'img' => 'alice_smith',
foreach ($athleteEntity as $entity) { 'username' => 'alicesmith',
$user = $map->athleteEntityToModel($entity); ],
$listUsers[$i] = ['idathlete' => number_format($user->getId(), 1), 'nom' => $user->getNom(), ];
'prenom' => $user->getPrenom(),'email' => $user->getEmail(), 'sexe' => $user->getSexe(), // if(!Validation::val_string($name)){
'taille' => $user->getTaille(), 'poids' => $user->getPoids(), 'motdepasse' => $user->getMotDePasse(), try {
'datenaissance' => $user->getDateNaissance(), 'iscoach' => $user->getRole(), 'img' => 'test', //code...
'username' => $user->getUsername()]; // $model->userMgr->getUser($name);
$i++; return $this->render('./page/addfriend.html.twig', [
} 'css' => $this->preference->getCookie(),
'pp' => "test2",
$response = $this->render('./page/addfriend.html.twig',[ 'user' => "Doe",
'css' => $_COOKIE['preferences'], 'role' => "Athlète",
'pp' => 'test', 'friendship' => [],
'user' => 'johndoe',//$currentUser->getUsername(), 'analyzes' => [],
'role' => 'Athlete',//$currentUser->getRole(), 'mails' => [],
'users' => $listUsers 'users' => $utiliArray,
]); 'infoUser' => [],
'exos' => [],
} catch (\Throwable $th) { 'member' => [],
throw $th; 'responce' => "Notification d'ajout envoyée à $username"
return $this->render("addfriend.html.twig", ['tabError' => $taberror]); ]);
} } catch (\Throwable $th) {
//throw $th;
// return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
} }
return $response; // }
} }
#[Route(path: '/analyses', name: 'analyses', methods: ['GET'])] #[Route(path: '/analyses', name: 'analyses', methods: ['GET'])]
public function analyses(): Response public function analyses(): Response
{ {
return $this->render('./page/analyze.html.twig',[ return $this->render('./page/analyze.html.twig', [
'css' => $this->preference->getCookie(), 'css' => $this->preference->getCookie(),
'pp' => "test2", 'pp' => "test2",
'user' => 'johndoe',//$currentUser->getUsername(), 'user' => "Doe",
'role' => 'Athlete',//$currentUser->getRole(), 'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
#[Route(path: '/activity', name: 'activity', methods: ['GET'])]
public function activity(): Response
{
return $this->render('./page/activity.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test",
'user' => 'johndoe',//$currentUser->getUsername(),
'role' => 'Athlete',//$currentUser->getRole(),
'friendship' => [], 'friendship' => [],
'analyzes' => [], 'analyzes' => [],
'mails' => [], 'mails' => [],
@ -153,67 +79,17 @@ class AthleteController extends BaseController
#[Route(path: '/exercice', name: 'exercice', methods: ['GET'])] // 8 #[Route(path: '/exercice', name: 'exercice', methods: ['GET'])] // 8
public function exercice(): Response public function exercice(): Response
{ {
try { return $this->render('./page/exercice.html.twig', [
$entrainementGateway = new EntrainementGateway(new Connexion("pgsql:host=localhost;dbname=sae_3", "Perederii", ""));
$listSearch = $entrainementGateway->getEntrainements();
$map = new EntrainementMapper();
$entrainementEntity = $map->entrainementSqlToEntity($listSearch);
$listUsers = [];
$i = 0;
foreach ($entrainementEntity as $entity) {
$user = $map->entrainementEntityToModel($entity);
$listUsers[$i] = ['idathlete' => number_format($user->getId(), 1), 'nom' => $user->getNom(),
'prenom' => $user->getPrenom(),'email' => $user->getEmail(), 'sexe' => $user->getSexe(),
'taille' => $user->getTaille(), 'poids' => $user->getPoids(), 'motdepasse' => $user->getMotDePasse(),
'datenaissance' => $user->getDateNaissance(), 'iscoach' => $user->getRole(), 'img' => 'test',
'username' => $user->getUsername()];
$i++;
}
$response = $this->render('./page/exercice.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => 'johndoe',//$currentUser->getUsername(),
'role' => 'Athlete',//$currentUser->getRole(),
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
} catch (\Throwable $th) {
throw $th;
return $this->render("addfriend.html.twig", ['tabError' => $taberror]);
}
return $response;
}
#[Route(path: '/exercices', name: 'exercices', methods: ['POST'])] // 8
public function exercices(String $type, String $intensite, String $date, IRequest $req): Response
{
$exercicesArray = [
[
'date' => $date,
'type' => $type,
'intensite' => $intensite,
'status' => 'A venir',
]
];
return $this->render('./page/exercice.html.twig',[
'css' => $this->preference->getCookie(), 'css' => $this->preference->getCookie(),
'pp' => "test2", 'pp' => "test2",
'user' => 'johndoe',//$currentUser->getUsername(), 'user' => "Doe",
'role' => 'Athlete',//$currentUser->getRole(), 'role' => "Athlète",
'friendship' => [], 'friendship' => [],
'analyzes' => [], 'analyzes' => [],
'mails' => [], 'mails' => [],
'users' => [], 'users' => [],
'infoUser' => [], 'infoUser' => [],
'exos' => $exercicesArray, 'exos' => [],
'member' => [] 'member' => []
]); ]);
} }
@ -221,61 +97,54 @@ class AthleteController extends BaseController
#[Route(path: '/add-friend', name: 'add-friend', methods: ['POST'])] #[Route(path: '/add-friend', name: 'add-friend', methods: ['POST'])]
public function addFriend(string $username, IRequest $req): Response public function addFriend(string $username, IRequest $req): Response
{ {
$taberror = [];
$utiliArray = [
[
'nom' => 'John',
'prenom' => 'Doe',
'img' => 'john_doe',
'username' => 'johndoe',
],
[
'nom' => 'Alice',
'prenom' => 'Smith',
'img' => 'alice_smith',
'username' => 'alicesmith',
],
];
// if(!Validation::val_string($name)){
try { try {
$athleteGateway = new AthleteGateway(new Connexion("pgsql:host=localhost;dbname=sae_3", "Perederii", "")); //code...
$userSearched=$athleteGateway->getAthleteByFirstName($username); // $model->userMgr->addFriend($name);
$currentUser=$this->container->get(UserManager::class)->getUserById(1); return $this->render('./page/addfriend.html.twig', [
if ($userSearched!=null) {
$currentUser->addFriend($userSearched);
foreach ($userSearched as $user) {
$users = ['nom' => $user->getNom(), 'prenom' => $user->getPrenom(), 'img' => 'test', 'username' => $user->getUsername()];
}
}
else{
$users=[];
}
return $this->render('./page/addfriend.html.twig',[
'css' => $this->preference->getCookie(), 'css' => $this->preference->getCookie(),
'pp' => "test2", 'pp' => "test2",
'user' => 'johndoe',//$currentUser->getUsername(), 'user' => "Doe",
'role' => 'Athlete',//$currentUser->getRole(), 'role' => "Athlète",
'friendship' => [], 'friendship' => [],
'analyzes' => [], 'analyzes' => [],
'mails' => [], 'mails' => [],
'users' => $users, 'users' => $utiliArray,
'infoUser' => [], 'infoUser' => [],
'exos' => [], 'exos' => [],
'member' => [], 'member' => [],
'responce' => "Notification d'ajout envoyée à $username" 'responce' => "Notification d'ajout envoyée à $username"
]); ]);
} catch (\Throwable $th) { } catch (\Throwable $th) {
throw $th; //throw $th;
return $this->render("addfriend.html.twig", ['tabError' => $taberror ]); // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
} }
// }
} }
#[Route(path: '/friend', name: 'friend', methods: ['GET'])] #[Route(path: '/friend', name: 'friend', methods: ['GET'])]
public function friend(): Response public function friend(): Response
{ {
return $this->render('./page/addfriend.html.twig',[ $utiliArray = [
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => 'John',//$currentUser->getUsername(),
'role' => 'Athlete',//$currentUser->getRole(),
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => [],
]);
}
/*#[Route(path: '/friendlist', name: 'friendlist', methods: ['POST'])]
public function friendlist(string $username, IRequest $req): Response
{
$friendList = [
[ [
'nom' => 'John', 'nom' => 'John',
'prenom' => 'Doe', 'prenom' => 'Doe',
@ -289,44 +158,19 @@ class AthleteController extends BaseController
'username' => 'alicesmith', 'username' => 'alicesmith',
], ],
]; ];
// TODO return $this->render('./page/addfriend.html.twig',[
// -> Enlever ou bloquer un utilisateur en fonction de son username
//$friendList = currentUser->getFriends();
return $this->render('./page/friend.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => 'johndoe',//$currentUser->getUsername(),
'role' => 'Athlete',//$currentUser->getRole(),
'friendship' => $friendList,
]);
}*/
#[Route(path: '/friendlist', name: 'friendlist2', methods: ['GET'])]
public function friendlist2(): Response
{
$athleteGateway = new AthleteGateway(new Connexion("pgsql:host=localhost;dbname=sae_3", "Perederii", ""));
$friendList = $athleteGateway->getListIdFriends(1);
foreach ($userSearched as $friendList) {
$users = ['nom' => $user->getNom(), 'prenom' => $user->getPrenom(), 'img' => 'test', 'username' => $user->getUsername()];
}
return $this->render('./page/friend.html.twig',[
'css' => $this->preference->getCookie(), 'css' => $this->preference->getCookie(),
'pp' => "test2", 'pp' => "test2",
'user' => "Doe", 'user' => "Doe",
'role' => "Athlète", 'role' => "Athlète",
'friendship' => $list, 'friendship' => [],
'analyzes' => [], 'analyzes' => [],
'mails' => [], 'mails' => [],
'users' => [], 'users' => $utiliArray,
'infoUser' => [], 'infoUser' => [],
'exos' => [], 'exos' => [],
'member' => [], 'member' => [],
]); ]);
} }
// #[Route(path: '/delete-friend', name: 'delete-friend', methods: ['POST'])] }
}
?>

@ -4,165 +4,144 @@ namespace App\Controller;
use App\Container; use App\Container;
use App\Router\Request\IRequest; use App\Router\Request\IRequest;
use App\Router\Response\RedirectResponse;
use App\Router\Response\Response; use App\Router\Response\Response;
use App\Router\Response\IResponse; use App\Router\Response\IResponse;
use App\Router\Session; use Couchbase\UserManager;
use Manager\UserManager;
use Shared\Attributes\Route; use Shared\Attributes\Route;
use Shared\Validation; use Shared\Validation;
use Twig\Environment; use Twig\Environment;
use Data\Core\Preferences; use Data\Core\Preferences;
use Shared\Log; use Shared\Log;
use function PHPUnit\Framework\isEmpty;
class AuthController extends BaseController class AuthController extends BaseController
{ {
private UserManager $userMgr;
public function __construct(UserManager $manager){
parent::__construct();
$this->userMgr = $manager;
}
#[Route('/login', name: 'login',methods: ['POST'])] #[Route('/login', name: 'login',methods: ['POST'])]
public function login(string $email,string $password, IRequest $request): IResponse { public function login(IRequest $request): IResponse {
$error = []; $error = [];
try { try {
$log=$email; // should check email with verrify email $log=Validation::clean_string($request->getBody()['email']);
$mdp=Validation::clean_string($password); $mdp=Validation::clean_string($request->getBody()['password']);
if($this->userMgr->login($log,$mdp)){
return new RedirectResponse('/');
}
else{
$error [] = "Erreur de connexion. Essayez encore";
return $this->render('./page/login.html.twig',[
'css' => $this->preference->getCookie(),
'login_error'=> $error,
]);
}
// should only cath a type of Exception not all
} catch (\Throwable $th) { } catch (\Throwable $th) {
$error [] =$th->getMessage(); $error = "Wrong cred";
return $this->render('./page/login.html.twig',[ }
'css' => $this->preference->getCookie(),
'login_error'=> $error, if($this->container->get(UserManager::class)->login($log,$mdp)){
]); return $this->redirectToRoute('/');
}
} else{
$error [] = "Erreur de connexion. Essayez encore";
} }
#[Route('/login', name: 'login2',methods: ['GET'])] return $this->render('./page/login.html.twig', ['error' => $error]);
public function login2(IRequest $request): IResponse {
return $this->render('./page/login.html.twig',[
'css' => $this->preference->getCookie(),
]);
} }
#[Route('/register', name: 'register2' , methods:['GET'])]
public function register2(IRequest $request): IResponse{ #[Route('/log', name: 'baseLog',methods: ['GET'])]
return $this->render('./page/register.html.twig',[ public function index(IRequest $request): IResponse {
return $this->render('./page/login.html.twig',[
'css' => $this->preference->getCookie(), 'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]); ]);
} }
#[Route('/register', name: 'register' , methods:['POST'])] #[Route('/register', name: 'register' , methods:['GET'])]
public function register( public function register(IRequest $request): IResponse
string $nom,
string $prenom,
string $username,
string $mail,
string $motDePasse,
string $sexe,
float $taille,
float $poids,
string $dateNaissance,
string $roleName,
IRequest $request): IResponse
{ {
$error = []; if ($request->getMethod() == 'POST') {
$nom = $request->getBody()['nom'];
$prenom = $request->getBody()['prenom'];
$username = $request->getBody()['username'];
$email = $request->getBody()['email'];
$motDePasse = $request->getBody()['motDePasse'];
$sexe = $request->getBody()['sexe'];
$taille = $request->getBody()['taille'];
$poids = $request->getBody()['poids'];
$dateNaissanceStr = $request->getBody()['nom'];
$dateNaissance = new \DateTime($dateNaissanceStr);
if (!$dateNaissance) {
throw new \Exception("Date de naissance non valide. Format attendu : YYYY-MM-DD");
}
$roleName = $request->getBody()['roleName'];
try {
$registrationData = [ $registrationData = [
'nom' => $nom, 'nom' => $nom,
'prenom' => $prenom, 'prenom' => $prenom,
'username' => $username, 'username' => $username,
'email' => $mail, 'email' => $email,
'sexe' => $sexe, 'sexe' => $sexe,
'taille' => $taille, 'taille' => $taille,
'poids' => $poids, 'poids' => $poids,
'dateNaissance' => $dateNaissance, 'dateNaissance' => $dateNaissance,
'roleName' => $roleName 'roleName' => $roleName
]; ];
if ($this->userMgr->register($mail, $motDePasse, $registrationData) ) { try {
return new RedirectResponse('/'); if ($this->container->get(UserManager::class)->register($email, $motDePasse, $registrationData)) {
} else { return $this->redirectToRoute('/');
$error [] = 'L\'inscription a échoué. Veuillez réessayer.'; } else {
return $this->render('./page/register.html.twig',[ $error [] = 'L\'inscription a échoué. Veuillez réessayer.';
'css' => $this->preference->getCookie(), }
'register_error'=> $error, } catch (\Exception $e) {
]); $error [] = 'Erreur lors de l\'inscription: ' . $e->getMessage();
} }
} catch (\Throwable $e) {
$error [] =$e->getMessage();
return $this->render('./page/register.html.twig', ['css' => $this->preference->getCookie(),"register_error" => $error ]);
} }
return $this->render('/register.html.twig');
} }
//string $ancienMotDePasse,string $nouveauMotDePasse,string $confirmerMotDePasse, #[Route(path: '/mdp', name: 'mdp', methods: ['POST'])]
public function mdp(string $ancienMotDePasse,string $nouveauMotDePasse,string $confirmerMotDePasse, IRequest $req): Response
#[Route(path: '/forgetPassword', name: 'forget-password2', methods: ['GET'])]
public function forgetPassword2(IRequest $request): IResponse
{
return $this->render('./page/password.html.twig',[
'css' => $this->preference->getCookie(),
]);
}
#[Route(path: '/forgetPassword', name: 'forget-password', methods: ['POST'])]
public function forgetPassword(string $mail, IRequest $request): IResponse
{ {
// CONFIRMER LES DONNESS !!!!! IMPORTANT
return $this->render('./page/password.html.twig',[ return $this->render('./page/settings.html.twig',[
'css' => $this->preference->getCookie(), 'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]); ]);
} }
#[Route(path: '/logout', name: 'logout', methods: ['POST'])]
public function logout(IRequest $request): IResponse
{
$error = [];
try {
if($this->userMgr->deconnecter()){
return new RedirectResponse('/');
}
else{
$error [] = "Erreur de deconnexion. Essayez encore";
return new RedirectResponse('/');
}
} catch (\Throwable $th) {
$error [] =$th->getMessage();
return new RedirectResponse('/');
}
}
} }
?>

@ -8,14 +8,13 @@ use App\Router\Response\RedirectResponse;
use App\Router\Response\Response; use App\Router\Response\Response;
use Psr\Container\ContainerInterface; use Psr\Container\ContainerInterface;
use Shared\Log;
abstract class BaseController abstract class BaseController
{ {
protected Preferences $preference; protected Preferences $preference;
public function __construct(){ public function __construct(){
$this->preference = new Preferences(); $this->preference = new Preferences();
} }
protected ContainerInterface $container; protected ContainerInterface $container;
@ -63,5 +62,18 @@ abstract class BaseController
return new RedirectResponse($url, $status); return new RedirectResponse($url, $status);
} }
protected function redirectToRoute(string $route, array $parameters = [], int $status = 302): RedirectResponse
{
return $this->redirect($this->generateUrl($route, $parameters), $status);
}
/*
* TODO : Should hanle ierror if the route is not existing
* */
protected function generateUrl(string $route, array $parameters = []): string
{
return $this->container->get(\App\Router\Router::class)->generate($route, $parameters);
}
} }

@ -1,34 +1,49 @@
<?php <?php
namespace App\Controller; // namespace App\Controller;
use App\Container; // use App\Container;
use App\Router\Request\IRequest; // use App\Router\Request\IRequest;
use App\Router\Response\Response; // use App\Router\Response\Response;
use App\Router\Response\IResponse; // use App\Router\Response\IResponse;
use Shared\Attributes\Route; // use Shared\Attributes\Route;
use Twig\Environment; // use Twig\Environment;
use Data\Core\Preferences; // use Data\Core\Preferences;
use Shared\Log; // use Shared\Log;
class CoachController extends BaseController
{
private ICoachManager $coachManager; // #[Route(path: '/coach', name: 'coach')]
private $security; // class CoachController extends BaseController
private Environment $twig; // {
protected Preferences $preference;
public function __construct(DataManager $dataManager, Security $security) // private ICoachManager $coachManager;
{ // private $security;
session_start();
$this->coachManager = $dataManager->coachMgr;
$this->security = $security;
$this->preference = new Preferences();
}
// public function __construct(DataManager $dataManager, Security $security)
// {
// $this->coachManager = $dataManager->coachMgr;
// $this->security = $security;
// }
// #[Route(path: '/', name: 'home', methods: ['GET'])]
// public function index(): Response
// {
// return $this->render('./page/home.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
// #[Route('/global-stats', name: 'coach_global_stats', methods: ['GET'])] // #[Route('/global-stats', name: 'coach_global_stats', methods: ['GET'])]
// public function globalStats(): Response // public function globalStats(): Response
// { // {
@ -36,145 +51,41 @@ class CoachController extends BaseController
// return $this->render('coach/global_stats.html.twig'); // return $this->render('coach/global_stats.html.twig');
// } // }
// #[Route(path: '/exercice', name: 'exercice', methods: ['GET'])] // 8
// public function exercice(): Response
// {
// return $this->render('./page/exercice.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
#[Route(path: '/coaching', name: 'coaching', methods: ['GET'])] // #[Route(path: '/coaching', name: 'coaching', methods: ['GET'])]
public function coaching(): Response // public function coaching(): Response
{ // {
return $this->render('./page/coaching.html.twig',[ // return $this->render('./page/coaching.html.twig',[
'css' => $this->preference->getCookie(), // 'css' => $this->preference->getCookie(),
'pp' => "test2", // 'pp' => "test2",
'user' => "Doe", // 'user' => "Doe",
'role' => "Coach", // 'role' => "Athlète",
'friendship' => [], // 'friendship' => [],
'analyzes' => [], // 'analyzes' => [],
'mails' => [], // 'mails' => [],
'users' => [], // 'users' => [],
'infoUser' => [], // 'infoUser' => [],
'exos' => [], // 'exos' => [],
'member' => [] // 'member' => []
]); // ]);
} // }
#[Route(path: '/search-member', name: 'search-member', methods: ['GET'])]
public function searchMember(string $username, IRequest $req): Response
{
$taberror = [];
// FILTER
$utiliArray = [
[
'nom' => 'John',
'prenom' => 'Doe',
'img' => 'john_doe',
'username' => 'johndoe',
],
[
'nom' => 'Alice',
'prenom' => 'Smith',
'img' => 'alice_smith',
'username' => 'alicesmith',
],
];
// if(!Validation::val_string($name)){
try {
//code...
// $model->userMgr->addFriend($name);
return $this->render('./page/addmember.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => $utiliArray,
'infoUser' => [],
'exos' => [],
'member' => [],
'responce' => "Notification d'ajout envoyée à $username"
]);
} catch (\Throwable $th) {
//throw $th;
// return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
}
// }
}
#[Route(path: '/add-member', name: 'add-member', methods: ['POST'])]
public function addmember(string $username, IRequest $req): Response
{
$taberror = [];
$utiliArray = [
[
'nom' => 'John',
'prenom' => 'Doe',
'img' => 'john_doe',
'username' => 'johndoe',
],
[
'nom' => 'Alice',
'prenom' => 'Smith',
'img' => 'alice_smith',
'username' => 'alicesmith',
],
];
// if(!Validation::val_string($name)){
try {
//code...
// $model->userMgr->addFriend($name);
return $this->render('./page/addmember.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => $utiliArray,
'infoUser' => [],
'exos' => [],
'member' => [],
'responce' => "Notification d'ajout envoyée à $username"
]);
} catch (\Throwable $th) {
//throw $th;
// return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
}
// }
}
#[Route(path: '/member', name: 'member', methods: ['GET'])]
public function member(): Response
{
$utiliArray = [
[
'nom' => 'John',
'prenom' => 'Doe',
'img' => 'john_doe',
'username' => 'johndoe',
],
[
'nom' => 'Alice',
'prenom' => 'Smith',
'img' => 'alice_smith',
'username' => 'alicesmith',
],
];
return $this->render('./page/addmember.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => $utiliArray,
'infoUser' => [],
'exos' => [],
'member' => [],
]);
}
// #[Route('/list-athletes', name: 'coach_list_athletes')] // #[Route('/list-athletes', name: 'coach_list_athletes')]
// public function listAthletes(): Response // public function listAthletes(): Response
@ -210,4 +121,4 @@ class CoachController extends BaseController
// // } // // }
} // }

@ -1,422 +0,0 @@
<?php
//
//namespace App\Controller;
//
//use App\Container;
//use App\Router\Request\IRequest;
//use App\Router\Response\Response;
//use Shared\Attributes\Route;
//use Twig\Environment;
//use Data\Core\Preferences;
//use Shared\Log;
//
//// TODO : Remove this BaseClass
//class Controller extends BaseController
//{
//
// #[Route(path: '/activity', name: 'activity', methods: ['GET'])]
// public function activity(): Response
// {
// return $this->render('./page/activity.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
//
//
// #[Route(path: '/exercices', name: 'exercices', methods: ['POST'])] // 8
// public function exercices(String $type, String $intensite, String $date, IRequest $req): Response
// {
// $exercicesArray = [
// [
// 'date' => $date,
// 'type' => $type,
// 'intensite' => $intensite,
// 'status' => 'A venur',
// ]
// ];
// return $this->render('./page/exercice.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => $exercicesArray,
// 'member' => []
// ]);
// }
//
// #[Route(path: '/search-user', name: 'search-user', methods: ['GET'])]
// public function searchUser(string $username, IRequest $req): Response
// {
// $taberror = [];
// // FILTER
// $utiliArray = [
// [
// 'nom' => 'John',
// 'prenom' => 'Doe',
// 'img' => 'john_doe',
// 'username' => 'johndoe',
// ],
// [
// 'nom' => 'Alice',
// 'prenom' => 'Smith',
// 'img' => 'alice_smith',
// 'username' => 'alicesmith',
// ],
// ];
// // if(!Validation::val_string($name)){
// try {
// //code...
// // $model->userMgr->addFriend($name);
// return $this->render('./page/addfriend.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => $utiliArray,
// 'infoUser' => [],
// 'exos' => [],
// 'member' => [],
// 'responce' => "Notification d'ajout envoyée à $username"
// ]);
// } catch (\Throwable $th) {
// //throw $th;
// // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
// }
// // }
//
// }
//
// #[Route(path: '/search-member', name: 'search-member', methods: ['GET'])]
// public function searchMember(string $username, IRequest $req): Response
// {
// $taberror = [];
// // FILTER
// $utiliArray = [
// [
// 'nom' => 'John',
// 'prenom' => 'Doe',
// 'img' => 'john_doe',
// 'username' => 'johndoe',
// ],
// [
// 'nom' => 'Alice',
// 'prenom' => 'Smith',
// 'img' => 'alice_smith',
// 'username' => 'alicesmith',
// ],
// ];
// // if(!Validation::val_string($name)){
// try {
// //code...
// // $model->userMgr->addFriend($name);
// return $this->render('./page/addmember.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => $utiliArray,
// 'infoUser' => [],
// 'exos' => [],
// 'member' => [],
// 'responce' => "Notification d'ajout envoyée à $username"
// ]);
// } catch (\Throwable $th) {
// //throw $th;
// // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
// }
// // }
//
// }
//
// #[Route(path: '/add-member', name: 'add-member', methods: ['POST'])]
// public function addmember(string $username, IRequest $req): Response
// {
// $taberror = [];
// $utiliArray = [
// [
// 'nom' => 'John',
// 'prenom' => 'Doe',
// 'img' => 'john_doe',
// 'username' => 'johndoe',
// ],
// [
// 'nom' => 'Alice',
// 'prenom' => 'Smith',
// 'img' => 'alice_smith',
// 'username' => 'alicesmith',
// ],
// ];
// // if(!Validation::val_string($name)){
// try {
// //code...
// // $model->userMgr->addFriend($name);
// return $this->render('./page/addmember.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => $utiliArray,
// 'infoUser' => [],
// 'exos' => [],
// 'member' => [],
// 'responce' => "Notification d'ajout envoyée à $username"
// ]);
// } catch (\Throwable $th) {
// //throw $th;
// // return $this->render("addfriend.html.twig", ['tabError' => $taberror ]);
// }
// // }
//
// }
//
// #[Route(path: '/member', name: 'member', methods: ['GET'])]
// public function member(): Response
// {
// $utiliArray = [
// [
// 'nom' => 'John',
// 'prenom' => 'Doe',
// 'img' => 'john_doe',
// 'username' => 'johndoe',
// ],
// [
// 'nom' => 'Alice',
// 'prenom' => 'Smith',
// 'img' => 'alice_smith',
// 'username' => 'alicesmith',
// ],
// ];
// return $this->render('./page/addmember.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => $utiliArray,
// 'infoUser' => [],
// 'exos' => [],
// 'member' => [],
// ]);
// }
//
//
// #[Route(path: '/friendlist', name: 'friendlist', methods: ['POST'])]
// public function friendlist(string $username, IRequest $req): Response
// {
// $utiliArray = [
// [
// 'nom' => 'John',
// 'prenom' => 'Doe',
// 'img' => 'john_doe',
// 'username' => 'johndoe',
// ],
// [
// 'nom' => 'Alice',
// 'prenom' => 'Smith',
// 'img' => 'alice_smith',
// 'username' => 'alicesmith',
// ],
// ];
// /* TODO */
//
// // -> Enlever ou bloquer un utilisateur en fonction de son username
//
// return $this->render('./page/friend.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => $utiliArray,
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => [],
// ]);
// }
//
// #[Route(path: '/friendlist', name: 'friendlist2', methods: ['GET'])]
// public function friendlist2(): Response
// {
// $utiliArray = [
// [
// 'nom' => 'John',
// 'prenom' => 'Doe',
// 'img' => 'test',
// 'status' => 'johndoe',
// 'username' => 'jdoe',
// ],
// [
// 'nom' => 'Alice',
// 'prenom' => 'Smith',
// 'img' => 'test2',
// 'status' => 'alicesmith',
// 'username' => 'asmith',
// ],
// ];
// return $this->render('./page/friend.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => $utiliArray,
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => [],
// ]);
// }
//
// #[Route(path: '/coaching', name: 'coaching', methods: ['GET'])]
// public function coaching(): Response
// {
// return $this->render('./page/coaching.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
//
// #[Route(path: '/mail', name: 'mail', methods: ['GET'])]
// public function mail(): Response
// {
// return $this->render('./page/mail.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
//
//
// #[Route(path: '/profile', name: 'profile', methods: ['GET'])]
// public function profile(): Response
// {
// return $this->render('./page/profile.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
//
//
// #[Route(path: '/psettings', name: 'psettings', methods: ['POST'])]
// public function psettings(string $nom,string $prenom,string $dateNaissance,string $mail,string $tel, IRequest $req): Response
// {
//
//
// return $this->render('./page/settings.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => $prenom,
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
//
//
//
//
// #[Route(path: '/pass', name: 'pass', methods: ['GET'])]
// public function pass(): Response
// {
//
// // CONFIRMER LES DONNESS !!!!! IMPORTANT
//
// return $this->render('./page/password.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
//
// #[Route(path: '/password', name: 'password', methods: ['POST'])]
// public function password(string $email, IRequest $req): Response
// {
//
// // CONFIRMER LES DONNESS !!!!! IMPORTANT
//
// return $this->render('./page/login.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
//
//}
//
//

@ -48,7 +48,6 @@ class FrontController {
$this->handleError(404, $e->getMessage()); $this->handleError(404, $e->getMessage());
} }
catch(\Throwable $e){ catch(\Throwable $e){
Log::dd($e->getLine() . $e->getFile() . $e->getMessage() );
$this->handleError(501, $e->getMessage()); $this->handleError(501, $e->getMessage());
} }
} }
@ -66,7 +65,7 @@ class FrontController {
// TODO : Don't work need Antoine help // TODO : Don't work need Antoine help
private function handleError(int $statusCode, $message) : void { private function handleError(int $statusCode, $message) : void {
if (!$this->container->has(\Twig\Environment::class)) { if (!$this->container->has(\Twig\Environment::class)) {
throw new \LogicException('You cannot use the "renderView" method if the Twig Bundle is not available. Try running "composer require ".'); throw new \LogicException('You cannot use the "renderView" method if the Twig Bundle is not available. Try running "composer require symfony/twig-bundle".');
} }
$response = new Response($this->container->get(\Twig\Environment::class)->render('./error/error.html.twig',['title'=> $message , "code" => $statusCode, "name" => $message, "descr" => $message ]),$statusCode); $response = new Response($this->container->get(\Twig\Environment::class)->render('./error/error.html.twig',['title'=> $message , "code" => $statusCode, "name" => $message, "descr" => $message ]),$statusCode);

@ -1,95 +1,36 @@
<?php <?php
namespace App\Controller; // namespace App\Controller;
// use App\Container;
// use App\Router\Request\IRequest;
// use App\Router\Response\Response;
// use Shared\Attributes\Route;
// use Twig\Environment;
// use Data\Core\Preferences;
// use Shared\Log;
// class HeartRateController extends BaseController
// {
// #[Route(path: '/import', name: 'import', methods: ['GET'])]
// public function import(): Response
// {
// return $this->render('./page/import.html.twig',[
// 'css' => $this->preference->getCookie(),
// 'pp' => "test2",
// 'user' => "Doe",
// 'role' => "Athlète",
// 'friendship' => [],
// 'analyzes' => [],
// 'mails' => [],
// 'users' => [],
// 'infoUser' => [],
// 'exos' => [],
// 'member' => []
// ]);
// }
use App\Container;
use App\Router\Request\IRequest;
use App\Router\Response\IResponse;
use App\Router\Response\RedirectResponse;
use App\Router\Response\Response;
use Manager\ActivityManager;
use Shared\Attributes\Route;
use Twig\Environment;
use Data\Core\Preferences;
use Shared\Log;
class HeartRateController extends BaseController
{
private ActivityManager $activityMgr;
public function __construct(ActivityManager $manager)
{
parent::__construct();
$this->activityMgr = $manager;
}
#[Route(path: '/import', name: 'import', methods: ['GET'])]
public function import(): Response
{
return $this->render('./page/import.html.twig', [
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
#[Route(path: '/upload', name: 'upload', methods: ['POST'])] // }
public function uploadFile(string $activityType, int $effort, IRequest $req): IResponse
{
$error = $this->validateRequest($effort);
if (!empty($error)) {
return $this->renderError($error);
}
$tmp_file = $_FILES['uploaded_file']['tmp_name'];
if (!$this->isValidFile($tmp_file)) {
return $this->renderError(['Failed to get file be sure that you provide the file']);
}
$content = file_get_contents($tmp_file);
try {
if ($this->activityMgr->uploadFile($activityType, 5, $content)) {
return new RedirectResponse('/');
}
} catch (\Exception $e) {
return $this->renderError([$e->getMessage()]);
}
return $this->renderError(['Failed to save activity.']);
}
private function validateRequest(int $effort): array
{
$error = [];
if ($effort < 0 || $effort > 5) {
$error[] = 'Invalid effort level.';
}
$fileExtension = pathinfo($_FILES['uploaded_file']['name'], PATHINFO_EXTENSION);
if ($fileExtension !== 'fit') {
$error[] = 'Invalid file type. Only .fit files are allowed.';
}
return $error;
}
private function isValidFile(string $tmp_file): bool
{
return file_exists($tmp_file) && is_uploaded_file($tmp_file);
}
private function renderError(array $error): Response
{
// Consolidez la logique de rendu ici
return $this->render('./error/error.html.twig', ['title'=> "Failed" , "code" => 400, "name" => "error import", "descr" => $error[0] ], new Response('$error', 400));
}
}

@ -1,45 +1,19 @@
<?php <?php
namespace App\Controller; // namespace App\Controller;
use App\Container; // use App\Container;
use App\Router\Request\IRequest; // use App\Router\Request\IRequest;
use App\Router\Response\Response; // use App\Router\Response\Response;
use Shared\Attributes\Route; // use App\Router\Response\IResponse;
use Twig\Environment;
use Data\Core\Preferences;
use Shared\Log;
class SocialController extends BaseController // use Shared\Attributes\Route;
{ // use Twig\Environment;
// use Data\Core\Preferences;
// use Shared\Log;
private Environment $twig;
protected Preferences $preference;
public function __construct()
{
session_start();
$this->preference = new Preferences();
}
// #[Route(path: '/coach', name: 'coach')]
#[Route(path: '/mail', name: 'mail', methods: ['GET'])] // class CoachController extends BaseController
public function mail(): Response // {
{
return $this->render('./page/mail.html.twig',[
'css' => $this->preference->getCookie(),
'pp' => "test2",
'user' => "Doe",
'role' => "Athlète",
'friendship' => [],
'analyzes' => [],
'mails' => [],
'users' => [],
'infoUser' => [],
'exos' => [],
'member' => []
]);
}
}

@ -4,27 +4,15 @@ namespace App\Controller;
use App\Container; use App\Container;
use App\Router\Request\IRequest; use App\Router\Request\IRequest;
use App\Router\Response\RedirectResponse;
use App\Router\Response\Response; use App\Router\Response\Response;
use App\Router\Response\IResponse;
use App\Router\Session;
use Manager\UserManager;
use Shared\Attributes\Route; use Shared\Attributes\Route;
use Shared\Validation;
use Twig\Environment; use Twig\Environment;
use Data\Core\Preferences; use Data\Core\Preferences;
use Shared\Log; use Shared\Log;
use function PHPUnit\Framework\isEmpty;
class UserController extends BaseController class UserController extends BaseController
{ {
private UserManager $userMgr;
public function __construct(UserManager $manager){
parent::__construct();
$this->userMgr = $manager;
}
#[Route(path: '/', name: 'home', methods: ['GET'])] #[Route(path: '/', name: 'home', methods: ['GET'])]
public function index(): Response public function index(): Response
@ -86,26 +74,5 @@ class UserController extends BaseController
'member' => [] 'member' => []
]); ]);
} }
// #[Route(path: '/logout', name: 'logout', methods: ['GET'])]
// public function logout(IRequest $request): IResponse
// {
// $error = [];
//
// try {
//
// if($this->userMgr->deconnecter()){
// return new RedirectResponse('/');
// }
// else{
// $error [] = "Erreur de deconnexion. Essayez encore";
// return new RedirectResponse('/');
// }
//
// } catch (\Throwable $th) {
// $error [] =$th->getMessage();
// return new RedirectResponse('/');
// }
// }
} }

@ -1,15 +1,12 @@
<?php <?php
namespace App\Router; namespace App\Router;
use App\Router\Request\IRequest; use App\Router\Request\IRequest;
/** /**
* Router class to manage a collection of routes in the application. * Router class to manage a collection of routes in the application.
* It provides functionalities to add routes and check if a given URL matches any of the defined routes. * It provides functionalities to add routes and check if a given URL matches any of the defined routes.
*/ */
class Router class Router {
{
/** /**
* The base path for routing. * The base path for routing.
@ -37,12 +34,11 @@ class Router
* *
* @param string $path The base path for the router. * @param string $path The base path for the router.
*/ */
public function __construct(string $path = "/PHP/project/index.php") public function __construct(string $path = "/PHP/project/index.php") {
{
$this->path = $path; $this->path = $path;
$this->routes = new \AltoRouter(); $this->routes = new \AltoRouter();
} }
/** /**
* Adds a new Route to the collection. * Adds a new Route to the collection.
* *
@ -50,37 +46,28 @@ class Router
* @param Route $route The route object. * @param Route $route The route object.
* @throws \InvalidArgumentException If method is not supported. * @throws \InvalidArgumentException If method is not supported.
*/ */
public function add(string $method, Route $route) public function add(string $method, Route $route) {
{
if (!in_array($method, self::$verbs)) { if (!in_array($method, self::$verbs)) {
throw new \InvalidArgumentException("Method not supported"); throw new \InvalidArgumentException("Method not supported");
} }
$this->routes->map($method, $route->getPath(), $route->getCallable(), $route->getName()); $this->routes->map($method, $route->getPath(), $route->getCallable(), $route->getName());
} }
/** /**
* Adds a route for a controller action. * Adds a route for a controller action.
* TODO : the problème is that AltoRouter is a map so i can't have mutilple Route just by doing this:(i need to find a logic to resolve this beavior) #[Route('/login', name: 'login',methods: ['POST','GET'])] *
* @param string|array $methods HTTP method. * @param string $method The HTTP method.
* @param string $path The path for the route. * @param string $path The path for the route.
* @param mixed $controller The controller object. * @param mixed $controller The controller object.
* @param string $action The action method in the controller. * @param string $action The action method in the controller.
* @param string $name (Optional) The name of the route. * @param string $name (Optional) The name of the route.
* @throws \InvalidArgumentException If method is not supported. * @throws \InvalidArgumentException If method is not supported.
*/ */
public function addControllerRoute(string|array $methods, string $path, $controller, string $action, string $name = '') public function addControllerRoute(string $method, string $path, $controller, string $action, string $name = '') {
{ if (!in_array($method, self::$verbs)) {
throw new \InvalidArgumentException("Method not supported");
if (is_string($methods)) {
$methods = [$methods]; // Convert to an array if it's a string
}
foreach ($methods as $method) {
if (!in_array($method, self::$verbs)) {
throw new \InvalidArgumentException("Method not supported");
}
$this->routes->map($method, $path, [$controller, $action], $name);
} }
$this->routes->map($method, $path, [$controller, $action], $name);
} }
// TODO: Implement the extractParams method. // TODO: Implement the extractParams method.
@ -93,8 +80,7 @@ class Router
* @param callable $callable The callback function. * @param callable $callable The callback function.
* @param string $name The name of the route. * @param string $name The name of the route.
*/ */
public function get(string $path, callable $callable, $name) public function get(string $path, callable $callable, $name) {
{
$this->routes->map('GET', $path, $callable, $name); $this->routes->map('GET', $path, $callable, $name);
} }
@ -106,8 +92,7 @@ class Router
* @param IRequest $request The request object. * @param IRequest $request The request object.
* @return array|null The matched route or null if no match. * @return array|null The matched route or null if no match.
*/ */
public function match(IRequest $request): ?array public function match(IRequest $request): ?array {
{
return $this->routes->match($request->getRequestUri(), $request->getMethod()) ?: null; return $this->routes->match($request->getRequestUri(), $request->getMethod()) ?: null;
} }
@ -116,17 +101,16 @@ class Router
* *
* @return array The array of routes. * @return array The array of routes.
*/ */
public function getRoutes() public function getRoutes() {
{
return []; // TODO: Implement the actual logic to return routes. return []; // TODO: Implement the actual logic to return routes.
} }
public function generate(string $routeName, array $params = array()): string public function generate (string $routeName, array $params = array()): string
{ {
return $this->routes->generate($routeName, $params); return $this->routes->generate($routeName,$params);
} }
} }
?> ?>

@ -111,7 +111,8 @@ class Session
if ( $this->sessionState == self::SESSION_STARTED ) if ( $this->sessionState == self::SESSION_STARTED )
{ {
$this->sessionState = !session_destroy(); $this->sessionState = !session_destroy();
session_unset(); // Clear all session variables unset( $_SESSION );
return !$this->sessionState; return !$this->sessionState;
} }

@ -2,24 +2,26 @@
namespace App\Router\Middleware; namespace App\Router\Middleware;
use App\Router\Session; use App\Router\Session;
use Network\IAuthService;
use Shared\Log; use Shared\Log;
use App\Router\Request\IRequest; use App\Router\Request\IRequest;
use App\Router\Response\RedirectResponse; use App\Router\Response\RedirectResponse;
class AuthMiddleware extends Middleware { class AuthMiddleware extends Middleware {
private IAuthService $auth;
public function __construct(IAuthService $auth) {
$this->auth = $auth;
}
public function handle(IRequest $request, callable $next) { public function handle(IRequest $request, callable $next) {
$excludedUrls = ['/login', '/register','/forgetPassword']; // if (isset($_SESSION['user'])) {
// $resp =new RedirectResponse("/");
// $resp->send();
// exit;
// }
// La page nest pas redirigée correctement
// Firefox a détecté que le serveur redirige la demande pour cette adresse dune manière qui naboutira pas.
if ($this->auth->getCurrentUser() === null && !in_array($request->getRequestUri(), $excludedUrls)) { // La cause de ce problème peut être la désactivation ou le refus des cookies.
$resp = new RedirectResponse("/login"); // if (!isset($_SESSION['user'])) {
$resp->send(); // $resp =new RedirectResponse("/log");
exit; // $resp->send();
} // exit;
// }
return parent::handle($request, $next); return parent::handle($request, $next);
} }
} }

@ -2,9 +2,6 @@
namespace App\Router\Response; namespace App\Router\Response;
use App\Router\Session;
use Shared\Log;
class RedirectResponse implements IResponse class RedirectResponse implements IResponse
{ {
private $content; private $content;
@ -52,13 +49,12 @@ class RedirectResponse implements IResponse
public function send(): void public function send(): void
{ {
http_response_code($this->statusCode); http_response_code($this->statusCode);
foreach ($this->headers as $name => $value) { foreach ($this->headers as $name => $value) {
header("$name: $value"); header("$name: $value");
} }
header("Location: " . $this->url); header("Location: " . $this->url);
// Optionally echo content if any // Optionally echo content if any

@ -1,8 +1,6 @@
<?php <?php
namespace App\Router\Response; namespace App\Router\Response;
use Shared\Log;
class Response implements IResponse { class Response implements IResponse {
private string $content; private string $content;
private int $statusCode; private int $statusCode;

@ -34,10 +34,15 @@
<input class="form-check-input" id="inputRememberPassword" type="checkbox" value="" /> <input class="form-check-input" id="inputRememberPassword" type="checkbox" value="" />
<label class="form-check-label" for="inputRememberPassword">Mémoriser le mot de passe</label> <label class="form-check-label" for="inputRememberPassword">Mémoriser le mot de passe</label>
</div> </div>
<div class="d-flex align-items-center justify-content-between mt-4 mb-0">
<a class="small" href="password.html">Mot de passe oublié ?</a>
<a class="btn btn-primary" href="index.html">Se connecter</a>
</div>
</form> </form>
</div> </div>
<div class="card-footer text-center py-3">
<div class="small"><a href="register.html">Besoin d'un compte ? Inscrivez-vous !</a></div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -63,4 +68,4 @@
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<script src="js/scripts.js"></script> <script src="js/scripts.js"></script>
</body> </body>
</html> </html>

@ -7,10 +7,8 @@
<meta name="description" content="Accueil" /> <meta name="description" content="Accueil" />
<meta name="author" content="PINAGOT Antoine" /> <meta name="author" content="PINAGOT Antoine" />
<title>{% block title %}{% endblock %}</title> <title>{% block title %}{% endblock %}</title>
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/simple-datatables@7.1.2/dist/style.min.css" rel="stylesheet" /> <link href="https://cdn.jsdelivr.net/npm/simple-datatables@7.1.2/dist/style.min.css" rel="stylesheet" />
<link href="/css/{% block css %}styles{% endblock %}.css" rel="stylesheet" /> <link href="/css/{% block css %}style{% endblock %}.css" rel="stylesheet" />
<script src="https://use.fontawesome.com/releases/v6.3.0/js/all.js" crossorigin="anonymous"></script> <script src="https://use.fontawesome.com/releases/v6.3.0/js/all.js" crossorigin="anonymous"></script>
</head> </head>
<body class="sb-nav-fixed"> <body class="sb-nav-fixed">
@ -37,7 +35,7 @@
<li><a class="dropdown-item" href="/profile">Profile</a></li> <li><a class="dropdown-item" href="/profile">Profile</a></li>
<li><a class="dropdown-item" href="/settings">Paramètres</a></li> <li><a class="dropdown-item" href="/settings">Paramètres</a></li>
<li><hr class="dropdown-divider" /></li> <li><hr class="dropdown-divider" /></li>
<li><a class="dropdown-item" href="/">Déconnexion</a></li> <li><a class="dropdown-item" href="/logout">Déconnexion</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -48,7 +46,7 @@
<div class="sb-sidenav-menu"> <div class="sb-sidenav-menu">
<div class="nav"> <div class="nav">
<div class="sb-sidenav-menu-heading">Menu</div> <div class="sb-sidenav-menu-heading">Menu</div>
<a class="nav-link" href="/home"> <a class="nav-link" href="/">
<div class="sb-nav-link-icon"><img src="/assets/img/house.png"></div> <div class="sb-nav-link-icon"><img src="/assets/img/house.png"></div>
Accueil Accueil
</a> </a>

@ -9,57 +9,34 @@
{% block user %}{{user}} - {{role}}{% endblock %} {% block user %}{{user}} - {{role}}{% endblock %}
{% block body %} {% block body %}
<div class="container-fluid px-4"> <div class="container-fluid px-4">
<h1 class="mt-4">Importer</h1> <h1 class="mt-4">Importer</h1>
<ol class="breadcrumb mb-4"> <ol class="breadcrumb mb-4">
<li class="breadcrumb-item"><a href="/">Accueil</a></li> <li class="breadcrumb-item"><a href="home.html">Accueil</a></li>
<li class="breadcrumb-item active">Importer</li> <li class="breadcrumb-item active">Importer</li>
</ol> </ol>
<div class="flex items-center justify-center">
<div class="sm:max-w-lg w-full p-10 bg-white rounded-xl z-10 "> <div class="row">
<div class="text-center"> <div class="col">
<h2 class="mt-5 text-3xl font-bold text-gray-900"> <div class="card mb-4">
Importer un fichier .fit ! <div class="card-header">
</h2> <img src="/assets/img/bupload.png"></i>
<p class="mt-2 text-sm text-gray-400">Let's go</p> Importer un fichier .fit
</div> </div>
<form class="mt-8 space-y-3" action="/upload" method="POST" enctype="multipart/form-data"> <div class="card-body">
<div class="grid grid-cols-1 space-y-2">
<label class="text-sm font-bold text-gray-500 tracking-wide">Veuillez renseigner le type d'activité</label> <div style="text-align:center; margin-bottom: 15px;">
<input class="text-base p-2 border border-gray-300 rounded-lg focus:outline-none focus:border-indigo-500" type="text" name="activityType" placeholder="Course à pied"> <label for="file-input">
</div> <img src="/assets/img/uploadW.svg"/>
<div class="grid grid-cols-1 space-y-2"> </label>
<label class="text-sm font-bold text-gray-500 tracking-wide">Effort Level (0-5)</label> <form action="/analyses" method="post">
<input class="text-base p-2 border border-gray-300 rounded-lg focus:outline-none focus:border-indigo-500" type="number" name="effort" min="0" max="5" placeholder="Enter effort level (0-5)"> <input id="file-input" type="file" name="fileToUpload" value=""style="visibility: hidden; width:0; height:0;"/>
</div> <input type="submit" value="Soumettre le fichier" name="submit"/>
<div class="grid grid-cols-1 space-y-2"> </form>
<label class="text-sm font-bold text-gray-500 tracking-wide">Attach Document</label> </div>
<div class="flex items-center justify-center w-full">
<label class="flex flex-col rounded-lg border-4 border-dashed w-full h-60 p-10 group text-center cursor-pointer">
<div class="h-full w-full text-center flex flex-col items-center justify-center items-center ">
<div class="flex flex-auto max-h-48 w-2/5 mx-auto -mt-10">
<img class="has-mask h-36 object-center" src="https://img.freepik.com/free-vector/image-upload-concept-landing-page_52683-27130.jpg?size=338&ext=jpg" alt="freepik image">
</div> </div>
<p class="pointer-none text-gray-500 "><span class="text-sm">Drag and drop</span> files here <br /> or
<span class="text-blue-600 hover:underline">select a file</span>
from your computer</p>
</div> </div>
<input type="file" class="hidden" id="file-input" name="uploaded_file"> </div>
</label> </div>
<p id="file-name-display" class="text-sm text-gray-500"></p>
</div> </div>
</div>
<p class="text-sm text-gray-300">
<span>File type: .fit</span>
</p>
<div class="flex justify-center">
<button type="submit" class="my-5 w-3/4 flex justify-center bg-blue-500 text-gray-100 p-4 rounded-full tracking-wide
font-semibold focus:outline-none focus:shadow-outline hover:bg-blue-600 shadow-lg cursor-pointer transition ease-in duration-300">
Upload
</button>
</div>
</form>
</div>
</div>
</div>
{% endblock %} {% endblock %}

@ -1,48 +1,40 @@
{% extends "authbase.html.twig" %} {% extends "authbase.html.twig" %}
{% block css %}{{ css }}{% endblock %} {% block css %}{{css}}{% endblock %}
{% block title %}Connexion - HearthTrack{% endblock %} {% block title %}Connexion - HearthTrack{% endblock %}
{% block main %} {% block main %}
<div class="container"> <div class="container">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-lg-5"> <div class="col-lg-5">
<div class="card shadow-lg border-0 rounded-lg mt-5"> <div class="card shadow-lg border-0 rounded-lg mt-5">
<div class="card-header"><h3 class="text-center font-weight-light my-4">Connexion</h3></div> <div class="card-header"><h3 class="text-center font-weight-light my-4">Connexion</h3></div>
<div class="card-body"> <div class="card-body">
{% if login_error %} <form>
{% for value in login_error %} <div class="form-floating mb-3">
<div class="alert alert-danger" role="alert"> <input class="form-control" id="inputEmail" type="email" placeholder="nom@exemple.com" />
{{ value }} <label for="inputEmail">Adresse eMail</label>
</div>
<div class="form-floating mb-3">
<input class="form-control" id="inputPassword" type="password" placeholder="Mot de passe" />
<label for="inputPassword">Mot de passe</label>
</div>
<div class="form-check mb-3">
<input class="form-check-input" id="inputRememberPassword" type="checkbox" value="" />
<label class="form-check-label" for="inputRememberPassword">Mémoriser le mot de passe</label>
</div>
<div class="d-flex align-items-center justify-content-between mt-4 mb-0">
<a class="small" href="password.html">Mot de passe oublié ?</a>
<a class="btn btn-primary" href="index.html">Se connecter</a>
</div>
</form>
</div>
<div class="card-footer text-center py-3">
<div class="small"><a href="register.html">Besoin d'un compte ? Inscrivez-vous !</a></div>
</div>
</div> </div>
{% endfor %}
{% endif %}
<form method="post" action="/login">
<div class="form-floating mb-3">
<input class="form-control" id="email" name="email" type="text" placeholder="Nom d'utilisateur" />
<label for="email">Nom d'utilisateur</label>
</div>
<div class="form-floating mb-3">
<input class="form-control" id="password" name="password" type="password" placeholder="Mot de passe" />
<label for="password">Mot de passe</label>
</div>
<div class="form-check mb-3">
<input class="form-check-input" id="inputRememberPassword" type="checkbox" value="" />
<label class="form-check-label" for="inputRememberPassword">Mémoriser le mot de passe</label>
</div> </div>
<div class="d-flex align-items-center justify-content-between mt-4 mb-0"> </div>
<a class="small" href="/forgetPassword">Mot de passe oublié ?</a>
<button class="btn btn-primary" type="submit">Se connecter</button>
</div>
</form>
</div>
<div class="card-footer text-center py-3">
<div class="small"><a href="/register">Besoin d'un compte ? Inscrivez-vous !</a></div>
</div> </div>
</div> {% endblock %}
</div>
</div>
</div>
{% endblock %}

@ -12,19 +12,19 @@
<div class="card-header"><h3 class="text-center font-weight-light my-4">Récupération du mot de passe</h3></div> <div class="card-header"><h3 class="text-center font-weight-light my-4">Récupération du mot de passe</h3></div>
<div class="card-body"> <div class="card-body">
<div class="small mb-3 text-muted">Entrez votre adresse eMail pour recevoir un lien pour changer de mot de passe</div> <div class="small mb-3 text-muted">Entrez votre adresse eMail pour recevoir un lien pour changer de mot de passe</div>
<form method="post" action="/"> <form method="post" action="/password">
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input class="form-control" id="email" name="email" type="email" placeholder="name@example.com" /> <input class="form-control" id="email" name="email" type="email" placeholder="name@example.com" />
<label for="email">Adresse eMail</label> <label for="email">Adresse eMail</label>
</div> </div>
<div class="d-flex align-items-center justify-content-between mt-4 mb-0"> <div class="d-flex align-items-center justify-content-between mt-4 mb-0">
<a class="small" href="/login">Retour à la connexion</a> <a class="small" href="/log">Retour à la connexion</a>
<button class="btn btn-primary" type="submit">Réinitialiser votre mot de passe</button> <button class="btn btn-primary" type="submit">Réinitialiser votre mot de passe</a>
</div> </div>
</form> </form>
</div> </div>
<div class="card-footer text-center py-3"> <div class="card-footer text-center py-3">
<div class="small"><a href="/register">Besoin d'un compte ? Inscrivez-vous !</a></div> <div class="small"><a href="/regist">Besoin d'un compte ? Inscrivez-vous !</a></div>
</div> </div>
</div> </div>
</div> </div>

@ -11,105 +11,82 @@
<div class="card shadow-lg border-0 rounded-lg mt-5"> <div class="card shadow-lg border-0 rounded-lg mt-5">
<div class="card-header"><h3 class="text-center font-weight-light my-4">Créer un compte</h3></div> <div class="card-header"><h3 class="text-center font-weight-light my-4">Créer un compte</h3></div>
<div class="card-body"> <div class="card-body">
{# Display error message if register_error is set #}
{% if register_error %}
{% for value in register_error %}
<div class="alert alert-danger" role="alert">
{{ value }}
</div>
{% endfor %}
{% endif %}
<form method="post" action="/register"> <form method="post" action="/register">
<div class="row mb-3"> <div class="row mb-3">
<div class="col-md-6"> <div class="col-md-6">
<div class="form-floating mb-3 mb-md-0"> <div class="form-floating mb-3 mb-md-0">
<input class="form-control" id="nom" name="nom" type="text" placeholder="Entrez votre nom" /> <input class="form-control" id="inputFirstName" type="text" placeholder="Entrez votre nom" />
<label for="nom">Nom de famille</label> <label for="inputFirstName">Nom de famille</label>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="form-floating"> <div class="form-floating">
<input class="form-control" id="prenom" name="prenom" type="text" placeholder="Entrez votre prénom" /> <input class="form-control" id="inputLastName" type="text" placeholder="Entrez votre prénom" />
<label for="prenom">Prénom</label> <label for="inputLastName">Prénom</label>
</div> </div>
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">
<div class="col-md-6"> <div class="col-md-6">
<div class="form-floating mb-3 mb-md-0"> <div class="form-floating mb-3 mb-md-0">
<input class="form-control" id="username" name="username" type="text" placeholder="Entrez votre pseudonyme" /> <label for="inputUsername"></label><input class="form-control" id="inputUsername" type="text" placeholder="Entrez votre pseudonyme" />
<label for="username">Nom d'utilisateur</label> <label for="inputFirstName">Nom d'utilisateur</label>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<label for="sexe" >Sexe:</label>
<div class="form-floating"> <div class="form-floating">
<select id="sexe" name="sexe"> <label for="inputLastName">Sexe</label>
<option value="M">Homme</option> <label for="gender"></label><select id="gender" name="gender">
<option value="H">Femme</option> <option value="male">Homme</option>
<option value="M">Ne se prononce pas</option> <option value="female">Femme</option>
<option value="unknown">Ne se prononce pas</option>
</select> </select>
</div> </div>
</div> </div>
</div> </div>
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input class="form-control" id="mail" name="mail" type="mail" placeholder="nom@exemple.com" /> <input class="form-control" id="inputEmail" type="email" placeholder="nom@exemple.com" />
<label for="mail">Adresse eMail</label> <label for="inputEmail">Adresse eMail</label>
</div> </div>
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<input class="form-control" id="dateNaissance" name="dateNaissance" type="date" placeholder="" /> <input class="form-control" id="inputDateNaissance" type="date" placeholder="" />
<label for="dateNaissance">Date de naissance</label> <label for="inputEmail">Date de naissance</label>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">
<div class="col-md-6"> <div class="col-md-6">
<div class="form-floating mb-3 mb-md-0"> <div class="form-floating mb-3 mb-md-0">
<input class="form-control" id="taille" name="taille" type="text" placeholder="Entrez votre taille" /> <input class="form-control" id="inputTaille" type="text" placeholder="Entrez votre taille" />
<label for="taille">Taille</label> <label for="inputPassword">Taille</label>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="form-floating mb-3 mb-md-0"> <div class="form-floating mb-3 mb-md-0">
<input class="form-control" id="poids" name="poids" type="text" placeholder="Entrez votre poids" /> <label for="inputPoids"></label><input class="form-control" id="inputPoids" type="text" placeholder="Entrez votre poids" />
<label for="poids">Poids</label> <label for="inputPasswordConfirm">Poids</label>
</div> </div>
</div> </div>
</div> </div>
<div class="row mb-3"> <div class="row mb-3">
<div class="col-md-6"> <div class="col-md-6">
<div class="form-floating mb-3 mb-md-0"> <div class="form-floating mb-3 mb-md-0">
<input class="form-control" id="motDePasse" name="motDePasse" type="password" placeholder="Créez un mot de passe" /> <input class="form-control" id="inputPassword" type="password" placeholder="Créez un mot de passe" />
<label for="motDePasse">Mot de passe</label> <label for="inputPassword">Mot de passe</label>
</div> </div>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="form-floating mb-3 mb-md-0"> <div class="form-floating mb-3 mb-md-0">
<input class="form-control" id="confirmMdp" name="confirmMdp" type="password" placeholder="Confirmez votre mot de passe" /> <input class="form-control" id="inputPasswordConfirm" type="password" placeholder="Confirmez votre mot de passe" />
<label for="confirmMdp">Confirmer le mot de passe</label> <label for="inputPasswordConfirm">Confirmer le mot de passe</label>
</div> </div>
</div> </div>
</div> </div>
<div class="row mb-3">
<div class="col-md-6">
<label for="roleName" >Role:</label>
<div class="form-floating">
<select id="roleName" name="roleName">
<option value="Athlete">Athlete</option>
<option value="Coach">Coach</option>
</select>
</div>
</div>
</div>
<div class="mt-4 mb-0"> <div class="mt-4 mb-0">
<div class="d-grid"> <div class="d-grid"><a class="btn btn-primary btn-block" href="login.html.twig">Créer un compte</a></div>
<button type="submit" class="btn btn-primary btn-block">Créer un compte</button>
</div>
</div> </div>
</form> </form>
</div> </div>
<div class="card-footer text-center py-3"> <div class="card-footer text-center py-3">
<div class="small"><a href="/login">Avez-vous déjà un compte ? Connectez-vous ?</a></div> <div class="small"><a href="login.html.twig">Avez-vous déjà un compte ? Connectez-vous ?</a></div>
</div> </div>
</div> </div>
</div> </div>

@ -763,13 +763,7 @@ function profileMenu(Model $model)
do { do {
$effort = trim(fgets(STDIN)); $effort = trim(fgets(STDIN));
} while ($effort < 0 || $effort > 5); } while ($effort < 0 || $effort > 5);
try { $isAddActivity = $model->activityMgr->uploadFile($typeActivity, $effort, $passFile);
$isAddActivity = $model->activityMgr->uploadFile($typeActivity, $effort, $passFile);
}catch (\Throwable $exception){
echo $exception;
}
echo $isAddActivity ? "Activité ajoutée avec succès" : "Erreur lors de l'ajout de l'activité"; echo $isAddActivity ? "Activité ajoutée avec succès" : "Erreur lors de l'ajout de l'activité";
case '0': case '0':
return; return;
@ -799,7 +793,7 @@ while (true) {
}*/ }*/
break; break;
case '2': // S'inscrire case '2': // S'inscrire
if($model->userMgr->login("bruce.lee@example.com", "password123")) if($model->userMgr->login("bruce.lee@example.com", "hello321"))
$loggedIn = true; $loggedIn = true;
// if (registerUser($model)) { // if (registerUser($model)) {
// $loggedIn = true; // $loggedIn = true;

@ -1,42 +1,34 @@
<?php <?php
namespace Network; namespace Data\Core;
use App\Router\Session;
use Model\User; use Model\User;
use Model\Athlete; use Model\Athlete;
use Model\CoachAthlete; use Model\CoachAthlete;
use Repository\IUserRepository; use Repository\IUserRepository;
use Shared\IHashPassword; use Shared\IHashPassword;
use Shared\Log;
const USER = 'USER'; class AuthService implements IAuthService {
class AuthService implements IAuthService
{
private IUserRepository $userRepository; private IUserRepository $userRepository;
private IHashPassword $passwordHacher; private IHashPassword $passwordHacher;
private ?User $currentUser = null; private ?User $currentUser = null;
public function __construct(IUserRepository $userRepository, IHashPassword $passwordHacher) public function __construct(IUserRepository $userRepository, IHashPassword $passwordHacher) {
{
$this->userRepository = $userRepository; $this->userRepository = $userRepository;
$this->passwordHacher = $passwordHacher; $this->passwordHacher = $passwordHacher;
} }
public function login(string $email, string $password): bool public function login(string $email, string $password): bool {
{
$user = $this->userRepository->getItemByEmail($email); $user = $this->userRepository->getItemByEmail($email);
if ($user === null || !$this->passwordHacher->isPasswordValid( $user->getMotDePasse(),$password)) { if ($user === null || !$this->validatePassword($password, $user->getPasswordHash())) {
return false; return false;
} }
$this->currentUser = $user; $this->currentUser = $user;
Session::getInstance()->__set(USER, $this->currentUser->getId()); // Add session handling logic here
return true; return true;
} }
public function register(string $email, string $password, array $data): bool {
public function register(string $email, string $password, $data): bool
{
if ($this->userRepository->getItemByEmail($email)) { if ($this->userRepository->getItemByEmail($email)) {
throw new \Exception('User already exists'); throw new \Exception('User already exists');
} }
@ -45,54 +37,50 @@ class AuthService implements IAuthService
$prenom = $data['prenom']; $prenom = $data['prenom'];
$username = $data['username']; $username = $data['username'];
$nom = $data['nom']; $nom = $data['nom'];
$email = $data['email'];
$sexe = $data['sexe']; $sexe = $data['sexe'];
$taille = $data['taille']; $taille = $data['taille'];
$poids = $data['poids']; $poids = $data['poids'];
$dateNaissance = $data['dateNaissance']; $dateNaissance = $data['dateNaissance'] ;
$roleName = $data['roleName']; $roleName = $data['roleName'];
$role = null; $role = null;
if ($roleName == "Coach") { if($roleName == "Coach"){
$role = new CoachAthlete(); $role = new CoachAthlete();
} else if ($roleName == "Athlete") { }
else if($roleName == "Athlete"){
$role = new Athlete(); $role = new Athlete();
} }
// Create a new user instance (you should expand on this with more data as needed)
$user = new User( $user = new User(
random_int(0, 100), random_int(0, 100),
$nom, $nom,
$prenom, $prenom,
$username, $username,
$email, $email,
$hashedPassword, $hashedPassword,
$sexe, $sexe,
$taille, $taille,
$poids, $poids,
$dateNaissance, $dateNaissance,
//should use reflexion //should use reflexion
$role $role
); );
$this->userRepository->addItem($user); $this->userRepository->addItem($user);
$this->currentUser = $user; $this->currentUser = $user;
Session::getInstance()->__set(USER,$this->currentUser->getId()); // Add session handling logic here
return true; return true;
} }
public function logoutUser(): bool public function logout(): void {
{
$this->currentUser = null; $this->currentUser = null;
Session::getInstance()->destroy(); // Add session handling logic here
return true;
} }
public function getCurrentUser(): ?User public function getCurrentUser(): ?User {
{
if (!empty(Session::getInstance()->__get(USER)) && $this->currentUser === null) {
$this->currentUser = $this->userRepository->getItemById(Session::getInstance()->__get(USER));
}
return $this->currentUser; return $this->currentUser;
} }
private function validatePassword(string $password, string $hash): bool {
// Implement password validation logic (e.g., using password_verify if using bcrypt)
}
} }

@ -2,19 +2,15 @@
namespace Data\Core; namespace Data\Core;
use Shared\Log;
class Preferences { class Preferences {
private string $cookie; private String $cookie;
private array $theme; private Array $theme;
public function __construct(){ public function __construct(){
if (isset($_COOKIE['preferences'])){ if (isset($_COOKIE['preferences'])){
$this->cookie = $_COOKIE['preferences']; $this->cookie = $_COOKIE['preferences'];
} else { } else {
if(setcookie('preferences', 'base_theme', time()+(3600*24)*7)){ $this->cookie = setcookie('preferences', 'base_theme', time()+(3600*24)*7);
$this->cookie = 'base_theme';
}
} }
$this->theme = array( $this->theme = array(
'base_theme', 'base_theme',
@ -23,7 +19,7 @@
); );
} }
public function majCookie(string $maj){ public function majCookie(String $maj){
try{ try{
foreach($this->theme as $t){ foreach($this->theme as $t){
$this->cookie = $maj; $this->cookie = $maj;
@ -34,8 +30,8 @@
} }
} }
public function getCookie():string{ public function getCookie():String{
return $this->cookie ?? "base_theme"; return $this->cookie;
} }
} }

@ -2,8 +2,8 @@
namespace Database; namespace Database;
class ActivityEntity { class ActiviteEntity {
private $idActivity; private $idActivite;
private $type; private $type;
private $date; private $date;
private $heureDebut; private $heureDebut;
@ -18,7 +18,7 @@ class ActivityEntity {
private $temperatureMoyenne; private $temperatureMoyenne;
// Getters // Getters
public function getIdActivity() { public function getIdActivite() {
return $this->idActivity; return $this->idActivity;
} }
@ -71,7 +71,7 @@ class ActivityEntity {
} }
// Setters // Setters
public function setIdActivity($idActivity) { public function setIdActivite($idActivite) {
$this->idActivity = $idActivity; $this->idActivity = $idActivity;
} }

@ -1,39 +1,38 @@
<?php <?php
namespace Database; namespace Database;
use \PDO;
class ActivityGateway { class ActiviteGateway {
private Connexion $connection; private $connection;
public function __construct(Connexion $connection) { public function __construct(Connection $connection) {
$this->connection = $connection; $this->connection = $connection;
} }
public function getActivity() { public function getActivite() {
$query = "SELECT * FROM Activite"; $query = "SELECT * FROM Activite";
return $this->connection->executeWithErrorHandling($query); return $this->connection->executeWithErrorHandling($query);
} }
public function getActivityById(int $activityId) { public function getActiviteById(int $activiteId) {
$query = "SELECT * FROM Activite WHERE idActivite = :id"; $query = "SELECT * FROM Activite WHERE idActivite = :id";
$params = [':id' => [$activityId, PDO::PARAM_INT]]; $params = [':id' => [$activiteId, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function getActivityByType(string $type) { public function getActiviteByType(string $type) {
$query = "SELECT * FROM Activite WHERE type = :type"; $query = "SELECT * FROM Activite WHERE type = :type";
$params = [':type' => [$type, PDO::PARAM_STR]]; $params = [':type' => [$type, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function getActivityByDate(string $date) { public function getActiviteByDate(string $date) {
$query = "SELECT * FROM Activite WHERE date = :date"; $query = "SELECT * FROM Activite WHERE date = :date";
$params = [':date' => [$date, PDO::PARAM_STR]]; $params = [':date' => [$date, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function getActivityByTimeRange(string $startTime, string $endTime) { public function getActiviteByTimeRange(string $startTime, string $endTime) {
$query = "SELECT * FROM Activite WHERE heureDebut >= :startTime AND heureFin <= :endTime"; $query = "SELECT * FROM Activite WHERE heureDebut >= :startTime AND heureFin <= :endTime";
$params = [ $params = [
':startTime' => [$startTime, PDO::PARAM_STR], ':startTime' => [$startTime, PDO::PARAM_STR],
@ -42,76 +41,76 @@ class ActivityGateway {
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function getActivityByEffort(int $effortRessenti) { public function getActiviteByEffort(int $effortRessenti) {
$query = "SELECT * FROM Activite WHERE effortRessenti = :effort"; $query = "SELECT * FROM Activite WHERE effortRessenti = :effort";
$params = [':effort' => [$effortRessenti, PDO::PARAM_INT]]; $params = [':effort' => [$effortRessenti, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function getActivityByVariability(int $variabilite) { public function getActiviteByVariability(int $variabilite) {
$query = "SELECT * FROM Activite WHERE variabilite = :variability"; $query = "SELECT * FROM Activite WHERE variabilite = :variability";
$params = [':variability' => [$variabilite, PDO::PARAM_INT]]; $params = [':variability' => [$variabilite, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function getActivityByTemperature(int $temperatureMoyenne) { public function getActiviteByTemperature(int $temperatureMoyenne) {
$query = "SELECT * FROM Activite WHERE temperatureMoyenne = :temperature"; $query = "SELECT * FROM Activite WHERE temperatureMoyenne = :temperature";
$params = [':temperature' => [$temperatureMoyenne, PDO::PARAM_INT]]; $params = [':temperature' => [$temperatureMoyenne, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function addActivity(ActivityEntity $activity) { public function addActivite(ActiviteEntity $activite) {
$query = "INSERT INTO Activite (type, date, heureDebut, heureDeFin, effortRessenti, variabilite, variance, ecartType, moyenne, maximum, minimum, temperatureMoyenne) $query = "INSERT INTO Activite (type, date, heureDebut, heureDeFin, effortRessenti, variabilite, variance, ecartType, moyenne, maximum, minimum, temperatureMoyenne)
VALUES (:type, :date, :heureDebut, :heureDeFin, :effortRessenti, :variabilite, :variance, :ecartType, :moyenne, :maximum, :minimum, :temperatureMoyenne)"; VALUES (:type, :date, :heureDebut, :heureDeFin, :effortRessenti, :variabilite, :variance, :ecartType, :moyenne, :maximum, :minimum, :temperatureMoyenne)";
$params = [ $params = [
':type' => $activity->getType(), ':type' => $activite->getType(),
':date' => $activity->getDate()->format('Y-m-d'), // Format date pour SQL ':date' => $activite->getDate()->format('Y-m-d'), // Format date pour SQL
':heureDebut' => $activity->getHeureDebut()->format('H:i:s'), // Format heure pour SQL ':heureDebut' => $activite->getHeureDebut()->format('H:i:s'), // Format heure pour SQL
':heureDeFin' => $activity->getHeureFin()->format('H:i:s'), // Format heure pour SQL ':heureDeFin' => $activite->getHeureFin()->format('H:i:s'), // Format heure pour SQL
':effortRessenti' => $activity->getEffortRessenti(), ':effortRessenti' => $activite->getEffortRessenti(),
':variabilite' => $activity->getVariabilite(), ':variabilite' => $activite->getVariabilite(),
':variance' => $activity->getVariance(), ':variance' => $activite->getVariance(),
':ecartType' => $activity->getEcartType(), ':ecartType' => $activite->getEcartType(),
':moyenne' => $activity->getMoyenne(), ':moyenne' => $activite->getMoyenne(),
':maximum' => $activity->getMaximum(), ':maximum' => $activite->getMaximum(),
':minimum' => $activity->getMinimum(), ':minimum' => $activite->getMinimum(),
':temperatureMoyenne' => $activity->getTemperatureMoyenne(), ':temperatureMoyenne' => $activite->getTemperatureMoyenne(),
]; ];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function updateActivity(ActivityEntity $oldActivity, ActivityEntity $newActivity) { public function updateActivite(ActiviteEntity $oldActivite, ActiviteEntity $newActivite) {
$query = "UPDATE Activite $query = "UPDATE Activite
SET type = :type, date = :date, heureDebut = :heureDebut, heureDeFin = :heureDeFin, SET type = :type, date = :date, heureDebut = :heureDebut, heureDeFin = :heureDeFin,
effortRessenti = :effortRessenti, variabilite = :variabilite, variance = :variance, ecartType = :ecartType, moyenne = :moyenne, maximum = :maximum, minimum = :minimum, temperatureMoyenne = :temperatureMoyenne effortRessenti = :effortRessenti, variabilite = :variabilite, variance = :variance, ecartType = :ecartType, moyenne = :moyenne, maximum = :maximum, minimum = :minimum, temperatureMoyenne = :temperatureMoyenne
WHERE idActivite = :idActivite"; WHERE idActivite = :idActivite";
$params = [ $params = [
':idActivite' => $oldActivity->getIdActivity(), ':idActivite' => $oldActivite->getIdActivite(),
':type' => $newActivity->getType(), ':type' => $newActivite->getType(),
':date' => $newActivity->getDate()->format('Y-m-d'), // Format date pour SQL ':date' => $newActivite->getDate()->format('Y-m-d'), // Format date pour SQL
':heureDebut' => $newActivity->getHeureDebut()->format('H:i:s'), // Format heure pour SQL ':heureDebut' => $newActivite->getHeureDebut()->format('H:i:s'), // Format heure pour SQL
':heureDeFin' => $newActivity->getHeureFin()->format('H:i:s'), // Format heure pour SQL ':heureDeFin' => $newActivite->getHeureFin()->format('H:i:s'), // Format heure pour SQL
':effortRessenti' => $newActivity->getEffortRessenti(), ':effortRessenti' => $newActivite->getEffortRessenti(),
':variabilite' => $newActivity->getVariabilite(), ':variabilite' => $newActivite->getVariabilite(),
':variance' => $newActivity->getVariance(), ':variance' => $newActivite->getVariance(),
':ecartType' => $newActivity->getEcartType(), ':ecartType' => $newActivite->getEcartType(),
':moyenne' => $newActivity->getMoyenne(), ':moyenne' => $newActivite->getMoyenne(),
':maximum' => $newActivity->getMaximum(), ':maximum' => $newActivite->getMaximum(),
':minimum' => $newActivity->getMinimum(), ':minimum' => $newActivite->getMinimum(),
':temperatureMoyenne' => $newActivity->getTemperatureMoyenne(), ':temperatureMoyenne' => $newActivite->getTemperatureMoyenne(),
]; ];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function deleteActivity(int $idActivity) { public function deleteActivite(int $idActivite) {
$query = "DELETE FROM Activite WHERE idActivite = :idActivity"; $query = "DELETE FROM Activite WHERE idActivite = :idActivite";
$params = [ $params = [
':idActivity' => $idActivity, ':idActivite' => $idActivite,
]; ];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);

@ -0,0 +1,51 @@
<?php
namespace Database;
use Model\Activite;
class ActiviteMapper {
public function map(array $data):ActiviteEntity {
$activite = new ActiviteEntity();
$activite->setIdActivite($data['idActivite']);
$activite->setType($data['type']);
$activite->setDate($data['date']);
$activite->setHeureDebut($data['heureDebut']);
$activite->setHeureFin($data['heureFin']);
$activite->setEffortRessenti($data['effortRessenti']);
$activite->setVariabilite($data['variabilite']);
$activite->setVariance($data['variance']);
$activite->setEcartType($data['ecartType']);
$activite->setMoyenne($data['moyenne']);
$activite->setMaximum($data['maximum']);
$activite->setMinimum($data['minimum']);
$activite->setTemperatureMoyenne($data['temperatureMoyenne']);
return $activite;
}
//public function ActiviteEntityToModel(ActiviteEntity entity): Activite;
public function ActiviteEntityToModel(ActiviteEntity $activiteEntity):Activite{
$act = new Activite(
$activiteEntity->getIdActivite(),
$activiteEntity->getType(),
$activiteEntity->getDate(),
$activiteEntity->getHeureDebut(),
$activiteEntity->getHeureFin(),
$activiteEntity->getEffortRessenti(),
$activiteEntity->getVariabilite(),
$activiteEntity->getVariance(),
$activiteEntity->getEcartType(),
$activiteEntity->getMoyenne(),
$activiteEntity->getMaximum(),
$activiteEntity->getMinimum(),
$activiteEntity->getTemperatureMoyenne()
);
return $act;
}
//public function ActiviteToEntity(Activite model): ActiviteEntity;
}
?>

@ -1,118 +0,0 @@
<?php
namespace Database;
use Model\Activity;
class ActivityMapper {
public function activitySqlToEntity(array $data):array
{
$activityEntities = [];
foreach ($data as $activityData) {
$activity = new ActivityEntity();
if (isset($activityData['idActivity'])) {
$activity->setIdActivity($data['idActivity']);
}
if (isset($activityData['type'])) {
$activity->setType($data['type']);
}
if (isset($activityData['date'])) {
$activity->setDate($data['date']);
}
if (isset($activityData['heureDebut'])) {
$activity->setHeureDebut($data['heureDebut']);
}
if (isset($activityData['heureFin'])) {
$activity->setHeureFin($data['heureFin']);
}
if (isset($activityData['effortRessenti'])) {
$activity->setEffortRessenti($data['effortRessenti']);
}
if (isset($activityData['variabilite'])) {
$activity->setVariabilite($data['variabilite']);
}
if (isset($activityData['variance'])) {
$activity->setVariance($data['variance']);
}
if (isset($activityData['ecartType'])) {
$activity->setEcartType($data['ecartType']);
}
if (isset($activityData['moyenne'])) {
$activity->setMoyenne($data['moyenne']);
}
if (isset($activityData['maximum'])) {
$activity->setMaximum($data['maximum']);
}
if (isset($activityData['minimum'])) {
$activity->setMinimum($data['minimum']);
}
if (isset($activityData['temperatureMoyenne'])) {
$activity->setTemperatureMoyenne($data['temperatureMoyenne']);
}
$activityEntities[] = $activity;
}
return $activityEntities;
}
/**
* @throws \Exception
*/
public function ActivityEntityToModel(ActivityEntity $activiteEntity):Activity{
$act = new Activity(
$activiteEntity->getIdActivity(),
$activiteEntity->getType(),
$activiteEntity->getDate(),
$activiteEntity->getHeureDebut(),
$activiteEntity->getHeureFin(),
$activiteEntity->getEffortRessenti(),
$activiteEntity->getVariabilite(),
$activiteEntity->getVariance(),
$activiteEntity->getEcartType(),
$activiteEntity->getMoyenne(),
$activiteEntity->getMaximum(),
$activiteEntity->getMinimum(),
$activiteEntity->getTemperatureMoyenne()
);
return $act;
}
//public function ActivityToEntity(Activity model): ActivityEntity;
public function activityToEntity(Activity $act):ActivityEntity{
$act = new ActivityEntity();
$act->setIdActivity($act->getIdActivity()());
$act->setType($act->getType());
$act->setDate($act->getDate());
$act->setHeureDebut($act->getHeureDebut());
$act->setHeureFin($act->getHeureFin());
$act->setEffortRessenti($act->getEffortRessenti());
$act->setVariabilite($act->getVariabilite());
$act->setVariance($act->getVariance());
$act->setEcartType($act->getEcartType());
$act->setMoyenne($act->getMoyenne());
$act->setMaximum($act->getMaximum());
$act->setMinimum($act->getMinimum());
$act->setTemperatureMoyenne($act->getTemperatureMoyenne());
return $act;
}
}
?>

@ -12,7 +12,6 @@ class AthleteEntity {
private $poids; private $poids;
private $motDePasse; private $motDePasse;
private $dateNaissance; private $dateNaissance;
private $isCoach;
// Getters // Getters
public function getIdAthlete() { public function getIdAthlete() {
@ -51,10 +50,6 @@ class AthleteEntity {
return $this->dateNaissance; return $this->dateNaissance;
} }
public function getIsCoach(){
return $this->isCoach;
}
// Setters // Setters
public function setIdAthlete($idAthlete) { public function setIdAthlete($idAthlete) {
$this->idAthlete = $idAthlete; $this->idAthlete = $idAthlete;
@ -91,10 +86,6 @@ class AthleteEntity {
public function setDateNaissance($dateNaissance) { public function setDateNaissance($dateNaissance) {
$this->dateNaissance = $dateNaissance; $this->dateNaissance = $dateNaissance;
} }
public function setIsCoach($isCoach){
$this->isCoach = $isCoach;
}
} }
?> ?>

@ -2,94 +2,70 @@
namespace Database; namespace Database;
use \PDO; use \PDO;
use Shared\Log;
class AthleteGateway { class AthleteGateway {
private Connexion $connection; private $connection;
public function __construct(Connexion $connection) { public function __construct(Connexion $connection) {
$this->connection = $connection; $this->connection = $connection;
} }
public function getAthlete(): array public function getAthlete() {
{ $query = "SELECT * FROM Athlete";
$query = "SELECT * FROM Athlete WHERE isCoach=FALSE"; return $this->connection->executeWithErrorHandling($query);
$res = $this->connection->executeWithErrorHandling($query);
return $res;
} }
public function getAthleteById(int $userId): array public function getAthleteById(int $userId) {
{ $query = "SELECT * FROM Athlete WHERE idAthlete = :id";
$query = "SELECT * FROM Athlete WHERE idAthlete = :id AND isCoach=FALSE";
$params = [':id' => [$userId, PDO::PARAM_INT]]; $params = [':id' => [$userId, PDO::PARAM_INT]];
$res = $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
return $res;
} }
public function getAthleteByName(string $name): array public function getAthleteByName(string $name) {
{ $query = "SELECT * FROM Athlete WHERE nom = :name";
$query = "SELECT * FROM Athlete WHERE nom = :name AND isCoach=FALSE";
$params = [':name' => [$name, PDO::PARAM_STR]]; $params = [':name' => [$name, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function getAthleteByFirstName(string $firstName): array public function getAthleteByFirstName(string $firstName) {
{ $query = "SELECT * FROM Athlete WHERE prenom = :firstName";
$query = "SELECT * FROM Athlete WHERE prenom = :firstName AND isCoach=FALSE";
$params = [':firstName' => [$firstName, PDO::PARAM_STR]]; $params = [':firstName' => [$firstName, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function getAthleteByEmail(string $email): array public function getAthleteByEmail(string $email) {
{ $query = "SELECT * FROM Athlete WHERE email = :email";
$query = "SELECT * FROM Athlete WHERE email = :email AND isCoach=FALSE";
$params = [':email' => [$email, PDO::PARAM_STR]]; $params = [':email' => [$email, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function getAthleteByGender(string $gender): array public function getAthleteByGender(string $gender) {
{ $query = "SELECT * FROM Athlete WHERE sexe = :gender";
$query = "SELECT * FROM Athlete WHERE sexe = :gender AND isCoach=FALSE";
$params = [':gender' => [$gender, PDO::PARAM_STR]]; $params = [':gender' => [$gender, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function getAthleteByHeight(int $height): array public function getAthleteByHeight(int $height) {
{ $query = "SELECT * FROM Athlete WHERE taille = :height";
$query = "SELECT * FROM Athlete WHERE taille = :height AND isCoach=FALSE";
$params = [':height' => [$height, PDO::PARAM_INT]]; $params = [':height' => [$height, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function getAthleteByWeight(int $weight): array public function getAthleteByWeight(int $weight) {
{ $query = "SELECT * FROM Athlete WHERE poids = :weight";
$query = "SELECT * FROM Athlete WHERE poids = :weight AND isCoach=FALSE";
$params = [':weight' => [$weight, PDO::PARAM_INT]]; $params = [':weight' => [$weight, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function getAthleteByBirthDate(string $birthdate): array public function getAthleteByBirthDate(string $birthdate) {
{ $query = "SELECT * FROM Athlete WHERE dateNaissance = :birthdate";
$query = "SELECT * FROM Athlete WHERE dateNaissance = :birthdate AND isCoach=FALSE";
$params = [':birthdate' => [$birthdate, PDO::PARAM_STR]]; $params = [':birthdate' => [$birthdate, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function getListIdFriends(int $idAthlete): array public function addAthlete(AthleteEntity $athlete) {
{ $query = "INSERT INTO Athlete (nom, prenom, email, sexe, taille, poids, motDePasse, dateNaissance)
$query = "SELECT idAthlete1, idAthlete2 FROM Friendship WHERE idAthlete1 = :idAthlete OR idAthlete2= :idAthlete"; VALUES (:nom, :prenom, :email, :sexe, :taille, :poids, :motDePasse, :dateNaissance)";
$params = [
':idAthlete' => $idAthlete,
];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function addAthlete(AthleteEntity $athlete): array
{
$query = "INSERT INTO Athlete (nom, prenom, email, sexe, taille, poids, motDePasse, dateNaissance, isCoach)
VALUES (:nom, :prenom, :email, :sexe, :taille, :poids, :motDePasse, :dateNaissance, :isCoach)";
$params = [ $params = [
':nom' => $athlete->getNom(), ':nom' => $athlete->getNom(),
@ -99,18 +75,16 @@ class AthleteGateway {
':taille' => $athlete->getTaille(), ':taille' => $athlete->getTaille(),
':poids' => $athlete->getPoids(), ':poids' => $athlete->getPoids(),
':motDePasse' => $athlete->getMotDePasse(), ':motDePasse' => $athlete->getMotDePasse(),
':dateNaissance' => $athlete->getDateNaissance(), ':dateNaissance' => $athlete->getDateNaissance(),
':isCoach' => $athlete->getIsCoach(),
]; ];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function updateAthlete(AthleteEntity $oldAthlete, AthleteEntity $newAthlete): array public function updateAthlete(AthleteEntity $oldAthlete, AthleteEntity $newAthlete) {
{
$query = "UPDATE Athlete $query = "UPDATE Athlete
SET nom = :nom, prenom = :prenom, email = :email, sexe = :sexe, SET nom = :nom, prenom = :prenom, email = :email, sexe = :sexe,
taille = :taille, poids = :poids, motDePasse = :motDePasse, dateNaissance = :dateNaissance, isCoach = :isCoach taille = :taille, poids = :poids, motDePasse = :motDePasse, dateNaissance = :dateNaissance
WHERE idAthlete = :idAthlete"; WHERE idAthlete = :idAthlete";
$params = [ $params = [
@ -122,15 +96,13 @@ class AthleteGateway {
':taille' => $newAthlete->getTaille(), ':taille' => $newAthlete->getTaille(),
':poids' => $newAthlete->getPoids(), ':poids' => $newAthlete->getPoids(),
':motDePasse' => $newAthlete->getMotDePasse(), ':motDePasse' => $newAthlete->getMotDePasse(),
':dateNaissance' => $newAthlete->getDateNaissance(), ':dateNaissance' => $newAthlete->getDateNaissance(),
':isCoach' => $newAthlete->getIsCoach(),
]; ];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function deleteAthlete(int $idAthlete): array public function deleteAthlete(int $idAthlete) {
{
$query = "DELETE FROM Athlete WHERE idAthlete = :idAthlete"; $query = "DELETE FROM Athlete WHERE idAthlete = :idAthlete";
$params = [ $params = [

@ -6,16 +6,16 @@ use \PDO;
use \DateTime; use \DateTime;
use Model\Role; use Model\Role;
use Model\Athlete; use Model\Athlete;
use Shared\Log;
class AthleteMapper { class AthleteMapper {
public function athleteSqlToEntity(array $data): array { public function fromSqlToEntity(array $data): array {
$athleteEntities = []; $athleteEntities = [];
foreach ($data as $athleteData) { foreach ($data as $athleteData) {
$athlete = new AthleteEntity(); $athlete = new AthleteEntity();
if (isset($athleteData['idathlete'])) {
$athlete->setIdAthlete($athleteData['idathlete']); if (isset($athleteData['idAthlete'])) {
$athlete->setIdAthlete($athleteData['idAthlete']);
} }
if (isset($athleteData['nom'])) { if (isset($athleteData['nom'])) {
@ -42,16 +42,12 @@ class AthleteMapper {
$athlete->setPoids($athleteData['poids']); $athlete->setPoids($athleteData['poids']);
} }
if (isset($athleteData['motdepasse'])) { if (isset($athleteData['motDePasse'])) {
$athlete->setMotDePasse($athleteData['motdepasse']); $athlete->setMotDePasse($athleteData['motDePasse']);
}
if (isset($athleteData['datenaissance'])) {
$athlete->setDateNaissance($athleteData['datenaissance']);
} }
if (isset($athleteData['iscoach'])) { if (isset($athleteData['dateNaissance'])) {
$athlete->setIsCoach($athleteData['iscoach']); $athlete->setDateNaissance($athleteData['dateNaissance']);
} }
$athleteEntities[] = $athlete; $athleteEntities[] = $athlete;
@ -62,12 +58,14 @@ class AthleteMapper {
public function athleteEntityToModel(AthleteEntity $athleteEntity): User { public function athleteEntityToModel(AthleteEntity $athleteEntity): User {
$role = new Athlete(); // Utilisez la classe Athlete $role = new Athlete(); // Utilisez la classe Athlete
$date = new DateTime($athleteEntity->getDateNaissance());
$dateSpecifique = $athleteEntity->getDateNaissance();
$date = new DateTime($dateSpecifique);
$user = new User( $user = new User(
$athleteEntity->getIdAthlete(), $athleteEntity->getIdAthlete(),
$athleteEntity->getNom(), $athleteEntity->getNom(),
$athleteEntity->getPrenom(), $athleteEntity->getPrenom(),
"myUsername",
$athleteEntity->getEmail(), $athleteEntity->getEmail(),
$athleteEntity->getMotDePasse(), $athleteEntity->getMotDePasse(),
$athleteEntity->getSexe(), $athleteEntity->getSexe(),
@ -92,8 +90,6 @@ class AthleteMapper {
$ath->setPoids($user->getPoids()); $ath->setPoids($user->getPoids());
$ath->setMotDePasse($user->getMotDePasse()); $ath->setMotDePasse($user->getMotDePasse());
$ath->setDateNaissance($user->getDateNaissance()); $ath->setDateNaissance($user->getDateNaissance());
$ath->setIsCoach(FALSE);
$ath->setCoachId(NULL);
return $ath; return $ath;
} }

@ -4,15 +4,50 @@ namespace Database;
class CoachEntity { class CoachEntity {
private $idCoach; private $idCoach;
private $athleteId; private $nom;
private $prenom;
private $email;
private $sexe;
private $taille;
private $poids;
private $motDePasse;
private $dateNaissance;
// Getters // Getters
public function getIdCoach() { public function getIdCoach() {
return $this->idCoach; return $this->idCoach;
} }
public function getAthleteId() { public function getNom() {
return $this->athleteId; return $this->nom;
}
public function getPrenom() {
return $this->prenom;
}
public function getEmail() {
return $this->email;
}
public function getSexe() {
return $this->sexe;
}
public function getTaille() {
return $this->taille;
}
public function getPoids() {
return $this->poids;
}
public function getMotDePasse() {
return $this->motDePasse;
}
public function getDateNaissance() {
return $this->dateNaissance;
} }
// Setters // Setters
@ -20,10 +55,37 @@ class CoachEntity {
$this->idCoach = $idCoach; $this->idCoach = $idCoach;
} }
public function setAthleteId($athleteId) { public function setNom($nom) {
$this->athleteId = $athleteId; $this->nom = $nom;
} }
public function setPrenom($prenom) {
$this->prenom = $prenom;
}
public function setEmail($email) {
$this->email = $email;
}
public function setSexe($sexe) {
$this->sexe = $sexe;
}
public function setTaille($taille) {
$this->taille = $taille;
}
public function setPoids($poids) {
$this->poids = $poids;
}
public function setMotDePasse($motDePasse) {
$this->motDePasse = $motDePasse;
}
public function setDateNaissance($dateNaissance) {
$this->dateNaissance = $dateNaissance;
}
} }
?> ?>

@ -10,96 +10,93 @@ class CoachGateway {
$this->connection = $connection; $this->connection = $connection;
} }
public function getCoach(): array public function getCoach() {
{
$query = "SELECT * FROM Coach"; $query = "SELECT * FROM Coach";
return $this->connection->executeWithErrorHandling($query); return $this->connection->executeWithErrorHandling($query);
} }
public function getCoachById(int $userId): array public function getCoachById(int $userId) {
{
$query = "SELECT * FROM Coach WHERE idCoach = :id"; $query = "SELECT * FROM Coach WHERE idCoach = :id";
$params = [':id' => [$userId, PDO::PARAM_INT]]; $params = [':id' => [$userId, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function getAthleteByCoachId(int $coachId): array public function getCoachByName(string $name) {
{ $query = "SELECT * FROM Coach WHERE nom = :name";
$query = "SELECT * FROM Athlete a, Coach c WHERE a.coachId = :id AND a.isCoach = TRUE";
$params = [':id' => [$coachId, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params);
}
public function getCoachByName(string $name): array
{
$query = "SELECT * FROM Coach c, Athlete a WHERE c.athleteId = a.idAthlete AND a.nom = :name";
$params = [':name' => [$name, PDO::PARAM_STR]]; $params = [':name' => [$name, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function getCoachByFirstName(string $firstName): array public function getCoachByFirstName(string $firstName) {
{ $query = "SELECT * FROM Coach WHERE prenom = :firstName";
$query = "SELECT * FROM Coach c, Athlete a WHERE c.athleteId = a.idAthlete AND a.prenom = :firstName";
$params = [':firstName' => [$firstName, PDO::PARAM_STR]]; $params = [':firstName' => [$firstName, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function getCoachByEmail(string $email): array public function getCoachByEmail(string $email) {
{ $query = "SELECT * FROM Coach WHERE email = :email";
$query = "SELECT * FROM Coach c, Athlete a WHERE c.athleteId = a.idAthlete AND a.email = :email";
$params = [':email' => [$email, PDO::PARAM_STR]]; $params = [':email' => [$email, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function getCoachByGender(string $gender): array public function getCoachByGender(string $gender) {
{ $query = "SELECT * FROM Coach WHERE sexe = :gender";
$query = "SELECT * FROM Coach c, Athlete a WHERE c.athleteId = a.idAthlete AND a.sexe = :gender";
$params = [':gender' => [$gender, PDO::PARAM_STR]]; $params = [':gender' => [$gender, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function getCoachByHeight(int $height): array public function getCoachByHeight(int $height) {
{ $query = "SELECT * FROM Coach WHERE taille = :height";
$query = "SELECT * FROM Coach c, Athlete a WHERE c.athleteId = a.idAthlete AND a.taille = :height";
$params = [':height' => [$height, PDO::PARAM_INT]]; $params = [':height' => [$height, PDO::PARAM_INT]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function getCoachByBirthDate(string $birthdate): array public function getCoachByBirthDate(string $birthdate) {
{ $query = "SELECT * FROM Coach WHERE dateNaissance = :birthdate";
$query = "SELECT * FROM Coach c, Athlete a WHERE c.athleteId = a.idAthlete AND a.dateNaissance = :birthdate";
$params = [':birthdate' => [$birthdate, PDO::PARAM_STR]]; $params = [':birthdate' => [$birthdate, PDO::PARAM_STR]];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function addCoach(CoachEntity $coach): array public function addCoach(CoachEntity $coach) {
{ $query = "INSERT INTO Coach (nom, prenom, email, sexe, taille, poids, motDePasse, dateNaissance)
$query = "INSERT INTO Coach (athleteId) VALUES (:nom, :prenom, :email, :sexe, :taille, :poids, :motDePasse, :dateNaissance)";
VALUES (:athleteId)";
$params = [ $params = [
':athleteId' => $coach->getAthleteId(), ':nom' => $coach->getNom(),
':prenom' => $coach->getPrenom(),
':email' => $coach->getEmail(),
':sexe' => $coach->getSexe(),
':taille' => $coach->getTaille(),
':poids' => $coach->getPoids(),
':motDePasse' => $coach->getMotDePasse(),
':dateNaissance' => $coach->getDateNaissance(),
]; ];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function updateCoach(CoachEntity $oldCoach, CoachEntity $newCoach): array public function updateCoach(CoachEntity $oldCoach, CoachEntity $newCoach) {
{
$query = "UPDATE Coach $query = "UPDATE Coach
SET athleteId = :athleteId SET nom = :nom, prenom = :prenom, email = :email, sexe = :sexe,
taille = :taille, poids = :poids, motDePasse = :motDePasse, dateNaissance = :dateNaissance
WHERE idCoach = :idCoach"; WHERE idCoach = :idCoach";
$params = [ $params = [
':idCoach' => $oldCoach->getIdCoach(), ':idCoach' => $oldCoach->getIdCoach(),
':athleteId' => $newCoach->getAthleteId(), ':nom' => $newCoach->getNom(),
':prenom' => $newCoach->getPrenom(),
':email' => $newCoach->getEmail(),
':sexe' => $newCoach->getSexe(),
':taille' => $newCoach->getTaille(),
':poids' => $newCoach->getPoids(),
':motDePasse' => $newCoach->getMotDePasse(),
':dateNaissance' => $newCoach->getDateNaissance(),
]; ];
return $this->connection->executeWithErrorHandling($query, $params); return $this->connection->executeWithErrorHandling($query, $params);
} }
public function deleteCoach(int $idCoach): array public function deleteCoach(int $idCoach) {
{
$query = "DELETE FROM Coach WHERE idCoach = :idCoach"; $query = "DELETE FROM Coach WHERE idCoach = :idCoach";
$params = [ $params = [

@ -1,7 +1,6 @@
<?php <?php
namespace Database; namespace Database;
use Model\CoachAthlete;
use Model\User; use Model\User;
use \PDO; use \PDO;
use \DateTime; use \DateTime;
@ -9,48 +8,34 @@ use Model\Role;
use Model\Coach; use Model\Coach;
class CoachMapper { class CoachMapper {
public function coachSqlToEntity(array $data): array { public function map(array $data) {
$coachEntities = []; $coach = new CoachEntity();
$coach->setIdCoach($data['idCoach']);
foreach ($data as $coachData) { $coach->setNom($data['nom']);
$coach = new CoachEntity(); $coach->setPrenom($data['prenom']);
$coach->setEmail($data['email']);
if (isset($coachData['idCoach'])) { $coach->setSexe($data['sexe']);
$coach->setIdCoach($coachData['idCoach']); $coach->setTaille($data['taille']);
} $coach->setPoids($data['poids']);
$coach->setMotDePasse($data['motDePasse']);
if (isset($coachData['athleteId'])) { $coach->setDateNaissance($data['dateNaissance']);
$coach->setAthleteId($coachData['athleteId']);
} return $coach;
$coachEntities[] = $coach;
}
return $coachEntities;
} }
public function CoachEntityToModel(CoachEntity $coachEntity):User{ public function CoachEntityToModel(CoachEntity $coachEntity):User{
$role = new CoachAthlete(); $role = "Coach";
$idCoach = $coachEntity->getIdCoach();
$ath = getAthleteByCoachId($idCoach);
$athlete = athleteSqlToEntity($ath);
$dateSpecific = $athlete->getDateNaissance();
$date = new DateTime($dateSpecific);
$user = new User( $user = new User(
$coachEntity->getIdCoach(), $coachEntity->getIdCoach(),
$athlete->getNom(), $coachEntity->getNom(),
$athlete->getPrenom(), $coachEntity->getPrenom(),
$athlete->getEmail(), $coachEntity->getEmail(),
$athlete->getMotDePasse(), $coachEntity->getMotDePasse(),
$athlete->getSexe(), $coachEntity->getSexe(),
$athlete->getTaille(), $coachEntity->getTaille(),
$athlete->getPoids(), $coachEntity->getPoids(),
$athlete->getDateNaissance(), $coachEntity->getDateNaissance(),
$date,
$role $role
); );
@ -61,10 +46,17 @@ class CoachMapper {
$coach = new CoachEntity(); $coach = new CoachEntity();
$coach->setIdCoach($user->getId()); $coach->setIdCoach($user->getId());
$coach->setAthleteId($user->getId()); $coach->setNom($user->getNom());
$coach->setPrenom($user->getPrenom());
$coach->setEmail($user->getEmail());
$coach->setSexe($user->getSexe());
$coach->setTaille($user->getTaille());
$coach->setPoids($user->getPoids());
$coach->setMotDePasse($user->getMotDePasse());
$coach->setDateNaissance($user->getDateNaissance());
return $coach; return $coach;
} }
} }
?>
?>

@ -2,9 +2,6 @@
namespace Database; namespace Database;
use DateTime;
use Shared\Log;
class Connexion extends \PDO { class Connexion extends \PDO {
private $stmt; private $stmt;
@ -18,14 +15,13 @@ class Connexion extends \PDO {
} }
} }
public function executeQuery(string $query, array $parameters = []) { public function executeQuery(string $query, array $parameters = []): bool {
$this->stmt = $this->prepare($query); $this->stmt = $this->prepare($query);
// foreach ($parameters as $name => $value) { //foreach ($parameters as $name => $value) {
// $this->stmt->bindValue($name, $value[0], $value[1]); // $this->stmt->bindValue($name, $value[0], $value[1]);
// } //}
foreach ($parameters as $name => $value) { foreach ($parameters as $name => $value) {
$dataType = is_numeric($value) ? \PDO::PARAM_INT : \PDO::PARAM_STR; $bindValueResult = $this->stmt->bindValue($name, $value, \PDO::PARAM_STR);
$bindValueResult = $this->stmt->bindValue($name, $value, $dataType);
if (!$bindValueResult) { if (!$bindValueResult) {
// Gérez l'erreur, par exemple, en lançant une exception. // Gérez l'erreur, par exemple, en lançant une exception.
throw new \PDOException('Failed to bind value for parameter ' . $name); throw new \PDOException('Failed to bind value for parameter ' . $name);
@ -47,15 +43,7 @@ class Connexion extends \PDO {
} }
public function getResults(): array { public function getResults(): array {
$results = $this->stmt->fetchAll(\PDO::FETCH_ASSOC); return $this->stmt->fetchAll(\PDO::FETCH_ASSOC);
// Convertissez les colonnes "taille" et "poids" en nombres
foreach ($results as &$row) {
$row['taille'] = floatval($row['taille']);
$row['poids'] = floatval($row['poids']);
}
return $results;
} }
} }
?> ?>

@ -1,71 +0,0 @@
<?php
namespace Database;
class EntrainementEntity
{
private $idEntrainement;
private $date;
private $description;
private $latitude;
private $longitude;
private $feedback;
private $coachId;
public function getIdEntrainement()
{
return $this->idEntrainement;
}
public function getDate()
{
return $this->date;
}
public function getDescription()
{
return $this->description;
}
public function getLatitude()
{
return $this->latitude;
}
public function getLongitude()
{
return $this->longitude;
}
public function getFeedback()
{
return $this->feedback;
}
public function getCoachId()
{
return $this->coachId;
}
public function setIdEntrainement($idEntrainement)
{
$this->idEntrainement = $idEntrainement;
}
public function setDate($date)
{
$this->date = $date;
}
public function setDescription($description)
{
$this->description = $description;
}
public function setLatitude($latitude)
{
$this->latitude = $latitude;
}
public function setLongitude($longitude)
{
$this->longitude = $longitude;
}
public function setFeedback($feedback)
{
$this->feedback = $feedback;
}
public function setCoachId($coachId)
{
$this->coachId = $coachId;
}
}

@ -1,19 +0,0 @@
<?php
namespace Database;
class EntrainementGateway
{
private Connexion $connection;
public function __construct(Connexion $connection) {
$this->connection = $connection;
}
public function getEntrainements(): array
{
$query = "SELECT * FROM Entrainement";
$res = $this->connection->executeWithErrorHandling($query);
return $res;
}
}

@ -1,74 +0,0 @@
<?php
namespace Database;
use Model\Athlete;
use Model\Training;
use Model\User;
class EntrainementMapper
{
public function entrainementSqlToEntity(array $data): array {
$entrainementEntities = [];
foreach ($data as $entrainementData) {
$entrainement = new EntrainementEntity();
if (isset($entrainementData['idEntrainement'])) {
$entrainement->setIdEntrainement($entrainementData['idEntrainement']);
}
if (isset($entrainementData['date'])) {
$entrainement->setDate($entrainementData['date']);
}
if (isset($entrainementData['description'])) {
$entrainement->setDescription($entrainementData['description']);
}
if (isset($entrainementData['latitude'])) {
$entrainement->setLatitude($entrainementData['latitude']);
}
if (isset($entrainementData['longitude'])) {
$entrainement->setLongitude($entrainementData['longitude']);
}
if (isset($entrainementData['feedback'])) {
$entrainement->setFeedback($entrainementData['feedback']);
}
if (isset($entrainementData['coachId'])) {
$entrainement->setCoachId($entrainementData['coachId']);
}
$entrainementEntities[] = $entrainement;
}
return $entrainementEntities;
}
public function entrainementEntityToModel(EntrainementEntity $entrainementEntity): Training {
return new Training(
$entrainementEntity->getIdEntrainement(),
$entrainementEntity->getDate(),
$entrainementEntity->getDescription(),
$entrainementEntity->getLatitude(),
$entrainementEntity->getLongitude(),
$entrainementEntity->getFeedback()
);
}
public function entrainementToEntity(Training $training):EntrainementEntity{
$train = new EntrainementEntity();
$train->setIdEntrainement($training->getId());
$train->setDate($training->getDate());
$train->setDescription($training->getDescription());
$train->setLatitude($training->getLatitude());
$train->setLongitude($training->getLongitude());
$train->setFeedback($training->getFeedback());
$train->setCoachId(1);
return $train;
}
}

@ -1,132 +1,158 @@
DROP TABLE IF EXISTS Athlete, Friendship, Notification, Statistique, Entrainement, Participe, SourceDonnee, Activite, FrequenceCardiaque CASCADE; -- Athlete Table
CREATE TABLE Athlete ( CREATE TABLE Athlete (
idAthlete SERIAL PRIMARY KEY, idAthlete SERIAL PRIMARY KEY,
nom VARCHAR(255), nom VARCHAR(255),
prenom VARCHAR(255), prenom VARCHAR(255),
email VARCHAR(255) UNIQUE, email VARCHAR(255) UNIQUE,
sexe CHAR(1), sexe CHAR(1),
taille DECIMAL, taille DECIMAL,
poids DECIMAL, poids DECIMAL,
motDePasse VARCHAR(255), motDePasse VARCHAR(255),
dateNaissance DATE, dateNaissance DATE
isCoach BOOLEAN
); );
-- Friendship Table
CREATE TABLE Friendship ( CREATE TABLE Friendship (
idAthlete1 INT, idAthlete1 INT,
idAthlete2 INT, idAthlete2 INT,
debut DATE, debut DATE,
PRIMARY KEY (idAthlete1, idAthlete2), PRIMARY KEY (idAthlete1, idAthlete2),
FOREIGN KEY (idAthlete1) REFERENCES Athlete(idAthlete), FOREIGN KEY (idAthlete1) REFERENCES Athlete (idAthlete),
FOREIGN KEY (idAthlete2) REFERENCES Athlete(idAthlete) FOREIGN KEY (idAthlete2) REFERENCES Athlete (idAthlete)
); );
-- Notification Table
CREATE TABLE Notification ( CREATE TABLE Notification (
idNotif INT PRIMARY KEY, idNotif SERIAL PRIMARY KEY,
message TEXT, message TEXT,
date DATE, date DATE,
statut BOOLEAN, statut BOOLEAN,
urgence INT, urgence INT,
athleteId INT, athleteId INT,
FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete) FOREIGN KEY (athleteId) REFERENCES Athlete (idAthlete)
);
-- Coach Table
CREATE TABLE Coach (
idCoach SERIAL PRIMARY KEY,
athleteId INT,
FOREIGN KEY (athleteId) REFERENCES Athlete (idAthlete)
); );
-- Statistique Table
CREATE TABLE Statistique ( CREATE TABLE Statistique (
idStatistique INT PRIMARY KEY, idStatistique SERIAL PRIMARY KEY,
poids DECIMAL, poids DECIMAL,
fcMoyenne DECIMAL, fcMoyenne DECIMAL,
fcMax DECIMAL, fcMax DECIMAL,
caloriesBruleesMoy DECIMAL, caloriesBruleesMoy DECIMAL,
date DATE, date DATE,
athleteId INT, athleteId INT,
FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete) FOREIGN KEY (athleteId) REFERENCES Athlete (idAthlete)
); );
-- Entrainement Table
CREATE TABLE Entrainement ( CREATE TABLE Entrainement (
idEntrainement INT PRIMARY KEY, idEntrainement SERIAL PRIMARY KEY,
date DATE, date DATE,
description TEXT, description TEXT,
latitude DECIMAL, latitude DECIMAL,
longitude DECIMAL, longitude DECIMAL,
feedback TEXT, feedback TEXT,
athleteId INT, coachId INT,
FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete) FOREIGN KEY (coachId) REFERENCES Coach (idCoach)
); );
-- Participe Table
CREATE TABLE Participe ( CREATE TABLE Participe (
athleteId INT, athleteId INT,
entrainementId INT, entrainementId INT,
PRIMARY KEY (athleteId, entrainementId), PRIMARY KEY (athleteId, entrainementId),
FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete), FOREIGN KEY (athleteId) REFERENCES Athlete (idAthlete),
FOREIGN KEY (entrainementId) REFERENCES Entrainement(idEntrainement) FOREIGN KEY (entrainementId) REFERENCES Entrainement (idEntrainement)
); );
-- SourceDonnee Table
CREATE TABLE SourceDonnee ( CREATE TABLE SourceDonnee (
idSource INT PRIMARY KEY, idSource SERIAL PRIMARY KEY,
type VARCHAR(255), type VARCHAR(255),
modele VARCHAR(255), modele VARCHAR(255),
precision2 DECIMAL, precision DECIMAL,
athleteId INT, athleteId INT,
FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete) FOREIGN KEY (athleteId) REFERENCES Athlete (idAthlete)
); );
-- Activite Table
CREATE TABLE Activite ( CREATE TABLE Activite (
idActivite INT PRIMARY KEY, idActivite SERIAL PRIMARY KEY,
type VARCHAR(255), type VARCHAR(255),
date DATE, date DATE,
heureDeDebut TIME, heureDeDebut TIME,
heureDeFin TIME, heureDeFin TIME,
effortRessent DECIMAL, effortRessent DECIMAL,
variabilite DECIMAL, variabilite DECIMAL,
variance DECIMAL, variance DECIMAL,
ecartType DECIMAL, ecartType DECIMAL,
moyenne DECIMAL, moyenne DECIMAL,
maximum DECIMAL, maximum DECIMAL,
minimum DECIMAL, minimum DECIMAL,
temperatureMoyenne DECIMAL, temperatureMoyenne DECIMAL,
athleteId INT, athleteId INT,
sourceId INT, sourceId INT,
FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete), FOREIGN KEY (athleteId) REFERENCES Athlete (idAthlete),
FOREIGN KEY (sourceId) REFERENCES SourceDonnee(idSource) FOREIGN KEY (sourceId) REFERENCES SourceDonnee (idSource)
); );
-- FrequenceCardiaque Table
CREATE TABLE FrequenceCardiaque ( CREATE TABLE FrequenceCardiaque (
idFc INT PRIMARY KEY, idFc SERIAL PRIMARY KEY,
altitude DECIMAL, altitude DECIMAL,
temps TIME, temps TIME,
temperature DECIMAL, temperature DECIMAL,
bpm INT, bpm INT,
longitude DECIMAL, longitude DECIMAL,
latitude DECIMAL, latitude DECIMAL,
activiteId INT, activiteId INT,
FOREIGN KEY (activiteId) REFERENCES Activite(idActivite) FOREIGN KEY (activiteId) REFERENCES Activite (idActivite)
); );
INSERT INTO Athlete (idAthlete, nom, prenom, email, sexe, taille, poids, motDePasse, dateNaissance, isCoach) VALUES -- Insertion de données dans la table Athlete
(1, 'Doe', 'John', 'john.doe@example.com', 'M', 1.80, 70, 'password123', '1990-01-01', FALSE), INSERT INTO Athlete (nom, prenom, email, sexe, taille, poids, motDePasse, dateNaissance) VALUES
(2, 'Smith', 'Jane', 'jane.smith@example.com', 'F', 1.65, 60, 'password456', '1992-02-02', TRUE); ('Doe', 'John', 'john.doe@example.com', 'M', 1.80, 70, 'password123', '1990-01-01'),
('Smith', 'Jane', 'jane.smith@example.com', 'F', 1.65, 60, 'password456', '1992-02-02');
-- Insertion de données dans la table Friendship
INSERT INTO Friendship (idAthlete1, idAthlete2, debut) VALUES INSERT INTO Friendship (idAthlete1, idAthlete2, debut) VALUES
(1, 2, '2023-01-01'); (1, 2, '2023-01-01');
-- Insertion de données dans la table Notification
INSERT INTO Notification (message, date, statut, urgence, athleteId) VALUES
('Training session at 10 AM', '2023-03-10', TRUE, 1, 1);
INSERT INTO Notification (idNotif, message, date, statut, urgence, athleteId) VALUES -- Insertion de données dans la table Coach
(1, 'Training session at 10 AM', '2023-03-10', TRUE, 1, 1); INSERT INTO Coach (athleteId) VALUES
(1);
INSERT INTO Statistique (idStatistique, poids, fcMoyenne, fcMax, caloriesBruleesMoy, date, athleteId) VALUES -- Insertion de données dans la table Statistique
(1, 70, 80, 150, 500, '2023-03-10', 1); INSERT INTO Statistique (poids, fcMoyenne, fcMax, caloriesBruleesMoy, date, athleteId) VALUES
(70, 80, 150, 500, '2023-03-10', 1);
INSERT INTO Entrainement (idEntrainement, date, description, latitude, longitude, feedback, athleteId) VALUES -- Insertion de données dans la table Entrainement
(1, '2023-03-12', 'Long run in the park', 40.7128, -74.0060, 'Good effort', 1); INSERT INTO Entrainement (date, description, latitude, longitude, feedback, coachId) VALUES
('2023-03-12', 'Long run in the park', 40.7128, -74.0060, 'Good effort', 1);
-- Insertion de données dans la table Participe
INSERT INTO Participe (athleteId, entrainementId) VALUES INSERT INTO Participe (athleteId, entrainementId) VALUES
(1, 1); (1, 1);
INSERT INTO SourceDonnee (idSource, type, modele, precision2, athleteId) VALUES -- Insertion de données dans la table SourceDonnee
(1, 'Heart Rate Monitor', 'HRM-Pro', 98.5, 1); INSERT INTO SourceDonnee (type, modele, precision, athleteId) VALUES
('Heart Rate Monitor', 'HRM-Pro', 98.5, 1);
INSERT INTO Activite (idActivite, type, date, heureDeDebut, heureDeFin, effortRessent, variabilite, variance, ecartType, moyenne, maximum, minimum, temperatureMoyenne, athleteId, sourceId) VALUES -- Insertion de données dans la table Activite
(1, 'Running', '2023-03-10', '08:00:00', '09:00:00', 7, 0.5, 1, 0.1, 140, 160, 120, 20, 1, 1); INSERT INTO Activite (type, date, heureDeDebut, heureDeFin, effortRessent, variabilite, variance, ecartType, moyenne, maximum, minimum, temperatureMoyenne, athleteId, sourceId) VALUES
('Running', '2023-03-10', '08:00:00', '09:00:00', 7, 0.5, 1, 0.1, 140, 160, 120, 20, 1, 1);
INSERT INTO FrequenceCardiaque (idFc, altitude, temps, temperature, bpm, longitude, latitude, activiteId) VALUES -- Insertion de données dans la table FrequenceCardiaque
(1, 100, '08:15:00', 15, 130, -74.0060, 40.7128, 1); INSERT INTO FrequenceCardiaque (altitude, temps, temperature, bpm, longitude, latitude, activiteId) VALUES
(100, '08:15:00', 15, 130, -74.0060, 40.7128, 1);

@ -33,18 +33,18 @@ interface IAuthService {
/** /**
* Register a new user. * Register a new user.
* *
* @param string $emailUser The emailUser of the new user. * @param string $username The username of the new user.
* @param string $password The password of the new user. * @param string $password The password of the new user.
* @param $data other data {undefined} for the moment. * @param $data other data {undefined} for the moment.
* *
* @return bool True if registration is successful, false otherwise. * @return bool True if registration is successful, false otherwise.
*/ */
public function register(string $emailUser, string $password, $data): bool; public function register(string $username, string $password, $data): bool;
/** /**
* Logout the currently authenticated user. * Logout the currently authenticated user.
* *
* @return bool * @return void
*/ */
public function logoutUser(): bool; public function logoutUser(): bool;

@ -27,7 +27,7 @@ class Activity
private float $variability; private float $variability;
private float $variance; private float $variance;
private float $standardDeviation; private float $standardDeviation;
private float $average; private int $average;
private int $maximum; private int $maximum;
private int $minimum; private int $minimum;
private float $avrTemperature; private float $avrTemperature;

@ -35,12 +35,6 @@ class Training
public function getLocation(): String { public function getLocation(): String {
return $this->longitude . $this->latitude; return $this->longitude . $this->latitude;
} }
public function getLatitude(): float {
return $this->latitude;
}
public function getLongitude(): float {
return $this->longitude;
}
public function getDescription(): String public function getDescription(): String
{ {
return $this->description; return $this->description;

@ -28,7 +28,6 @@ class User {
private \DateTime $dateNaissance; private \DateTime $dateNaissance;
private Role $role; private Role $role;
protected array $notifications = []; protected array $notifications = [];
private array $listFriend = [];
/** /**
* @return array * @return array
@ -51,9 +50,7 @@ class User {
* @param \DateTime $dateNaissance * @param \DateTime $dateNaissance
* @param \Model\Role $role * @param \Model\Role $role
*/ */
public function __construct(int $id, string $nom, string $prenom, string $username, string $email, public function __construct(int $id, string $nom, string $prenom, string $username, string $email, string $motDePasse, string $sexe, float $taille, float $poids, \DateTime $dateNaissance, Role $role)
string $motDePasse, string $sexe, float $taille, float $poids, \DateTime $dateNaissance,
Role $role)
{ {
$this->id = $id; $this->id = $id;
$this->nom = $nom; $this->nom = $nom;
@ -292,23 +289,5 @@ class User {
public function __toString() { public function __toString() {
return "Athlete [ID: {$this->id}, Username : $this->username, Nom: {$this->nom}, Prénom: {$this->prenom}, Email: {$this->email}]"; return "Athlete [ID: {$this->id}, Username : $this->username, Nom: {$this->nom}, Prénom: {$this->prenom}, Email: {$this->email}]";
} }
/**
* Donne la liste des amis de l'utilisateur
*
* @return string Les amis de l'utilisateur.
*/
public function getListFriend(): array {
return $this->listFriend;
}
/**
* Ajoute un utilisateur a sa liste d'amis.
*
* @param User L'utilisateur a ajouter.
*/
public function addFriend(User $user){
array_push($this->listFriend, $user);
}
} }
?> ?>

@ -8,14 +8,12 @@
* *
* @package manager * @package manager
*/ */
namespace Manager; namespace Manager;
use adriangibbons\phpFITFileAnalysis; use adriangibbons\phpFITFileAnalysis;
use Exception; use Exception;
use Model\Activity; use Model\Activity;
use Network\IAuthService; use Network\IAuthService;
use Shared\Log;
use Stub\AuthService; use Stub\AuthService;
/** /**
@ -29,21 +27,14 @@ class ActivityManager
*/ */
private IAuthService $authService; private IAuthService $authService;
/**
* @var DataManager
*/
private DataManager $dataManager;
/** /**
* Constructeur de la classe ActivityManager. * Constructeur de la classe ActivityManager.
* *
* @param IAuthService $authService Le service d'authentification utilisé pour vérifier l'utilisateur actuel. * @param IAuthService $authService Le service d'authentification utilisé pour vérifier l'utilisateur actuel.
*/ */
public function __construct(DataManager $dataManager, IAuthService $authService) public function __construct(DataManager $dataManager,IAuthService $authService)
{ {
$this->authService = $authService; $this->authService = $authService;
$this->dataManager = $dataManager;
} }
/** /**
@ -58,22 +49,23 @@ class ActivityManager
try { try {
// Extraction des données du fichier FIT // Extraction des données du fichier FIT
$fitData = [ $fitData = [
'timestamps' => $monFichierFit->data_mesgs['record']['timestamp'], 'timestamps' => $monFichierFit->data_mesgs['record']['timestamp'],
'latitudes' => $monFichierFit->data_mesgs['record']['position_lat'], 'latitudes' => $monFichierFit->data_mesgs['record']['position_lat'],
'longitudes' => $monFichierFit->data_mesgs['record']['position_long'], 'longitudes' => $monFichierFit->data_mesgs['record']['position_long'],
'altitudes' => $monFichierFit->data_mesgs['record']['altitude'], 'altitudes' => $monFichierFit->data_mesgs['record']['altitude'],
'heartRates' => $monFichierFit->data_mesgs['record']['heart_rate'], 'heartRates' => $monFichierFit->data_mesgs['record']['heart_rate'],
'cadences' => $monFichierFit->data_mesgs['record']['cadence'], 'cadences' => $monFichierFit->data_mesgs['record']['cadence'],
'distances' => $monFichierFit->data_mesgs['record']['distance'], 'distances' => $monFichierFit->data_mesgs['record']['distance'],
'speeds' => $monFichierFit->data_mesgs['record']['speed'], 'speeds' => $monFichierFit->data_mesgs['record']['speed'],
'powers' => $monFichierFit->data_mesgs['record']['power'], 'powers' => $monFichierFit->data_mesgs['record']['power'],
'temperatures' => $monFichierFit->data_mesgs['record']['temperature'], 'temperatures' => $monFichierFit->data_mesgs['record']['temperature'],
]; ];
// Conversion des données en format JSON // Conversion des données en format JSON
$jsonFitData = json_encode($fitData, JSON_PRETTY_PRINT); $jsonFitData = json_encode($fitData, JSON_PRETTY_PRINT);
// Enregistrement du fichier JSON // Enregistrement du fichier JSON
file_put_contents('./you.json', $jsonFitData); file_put_contents('/Users/Perederii/SAE/git/Web/Sources/src/data/model/fitFileSaver/jsonFiles/ActivitySave.json', $jsonFitData);
return true; return true;
} catch (\Exception $e) { } catch (\Exception $e) {
@ -93,21 +85,21 @@ class ActivityManager
* @return bool Retourne true en cas de succès, sinon false. * @return bool Retourne true en cas de succès, sinon false.
* @throws Exception En cas d'erreur lors du téléchargement, du traitement ou de l'enregistrement des données. * @throws Exception En cas d'erreur lors du téléchargement, du traitement ou de l'enregistrement des données.
*/ */
public function uploadFile(string $type, int $effortRessenti, string $file_path_or_data, ?array $options = null): bool public function uploadFile($type, $effortRessenti, $file_path_or_data, ?array $options = null): bool
{ {
try { try {
// Vérification des options par défaut // Vérification des options par défaut
if (empty($options)) { if (empty($options)) {
$options = [ $options = [
'input_is_data' => true, 'fix_data' => ['all'],
'fix_data' => ['all'], 'data_every_second' => false,
'data_every_second' => false, 'units' => 'metric',
'units' => 'metric', 'pace' => true,
'pace' => true, 'garmin_timestamps' => false,
'garmin_timestamps' => false,
'overwrite_with_dev_data' => false 'overwrite_with_dev_data' => false
]; ];
} }
// Ouverture du fichier FIT // Ouverture du fichier FIT
if (!($monFichierFit = new phpFITFileAnalysis($file_path_or_data, $options))) { if (!($monFichierFit = new phpFITFileAnalysis($file_path_or_data, $options))) {
throw new Exception("Problème lors de l'ouverture du fichier FIT"); throw new Exception("Problème lors de l'ouverture du fichier FIT");
@ -136,14 +128,9 @@ class ActivityManager
$standardDeviation = number_format(sqrt($variance), 2); $standardDeviation = number_format(sqrt($variance), 2);
$maximum = max($heartRateList); $maximum = max($heartRateList);
$minimum = min($heartRateList); $minimum = min($heartRateList);
if(isset($monFichierFit->data_mesgs['record']['temperature'])){
// Extraction de la température moyenne (si disponible $temperatureList = $monFichierFit->data_mesgs['record']['temperature'];
$temperatureList = $monFichierFit->data_mesgs['record']['temperature']; $averageTemperature = (!empty($temperatureList)) ? number_format(array_sum($temperatureList) / count($temperatureList), 1) : -200;
$averageTemperature = (!empty($temperatureList)) ? number_format(array_sum($temperatureList) / count($temperatureList), 1) : -200;
}
else{
$averageTemperature = -200;
}
$isPaused = count($monFichierFit->isPaused()) > 0; $isPaused = count($monFichierFit->isPaused()) > 0;
@ -163,23 +150,16 @@ class ActivityManager
$averageTemperature, $averageTemperature,
$isPaused $isPaused
); );
// $this->dataManager->activityRepository->add($newActivity);
// if ($this->saveFitFileToJSON($monFichierFit)) {
// Ajout de l'activité et enregistrement du fichier FIT en JSON // Ajout de l'activité et enregistrement du fichier FIT en JSON
if ($this->authService->getCurrentUser()->getRole()->addActivity($newActivity)) { if ($this->authService->getCurrentUser()->getRole()->addActivity($newActivity) && $this->saveFitFileToJSON($monFichierFit)) {
return true; return true;
} }
// } } catch (\Exception $e) {
return false;
}
catch(\Exception $e){
echo $e; echo $e;
} }
return false;
return false;
} }
} }
?> ?>

@ -11,7 +11,6 @@ abstract class DataManager {
public IRelationshipRequestRepository $relationshipRequestRepository; public IRelationshipRequestRepository $relationshipRequestRepository;
public ITrainingRepository $trainingRepository; public ITrainingRepository $trainingRepository;
public INotificationRepository $notificationRepository; public INotificationRepository $notificationRepository;
public IActivityRepository $activityRepository;
} }
?> ?>

@ -1,4 +1,13 @@
<?php <?php
/**
* Nom du fichier: UserManager.php
*
* @author PEREDERII Antoine
* @date 2023-11-25
* @description Classe UserManager pour gérer les opérations liées aux utilisateurs.
*
* @package manager
*/
namespace Manager; namespace Manager;
@ -10,7 +19,7 @@ use Network\IAuthService;
use Network\IFriendRequestService; use Network\IFriendRequestService;
use Shared\Validation; use Shared\Validation;
use Stub\UserRepository; use Stub\UserRepository;
use Shared\Log;
class UserManager class UserManager
{ {
private IAuthService $authService; private IAuthService $authService;
@ -35,6 +44,14 @@ class UserManager
return $this->currentUser; return $this->currentUser;
} }
/**
* Connecte un utilisateur avec les identifiants fournis.
*
* @param string $loginUser Le nom d'utilisateur.
* @param string $passwordUser Le mot de passe de l'utilisateur.
* @return bool Retourne true en cas de connexion réussie, sinon false.
* @throws \Exception En cas d'erreur dans les informations d'identification.
*/
public function login($emailUser, $passwordUser): bool public function login($emailUser, $passwordUser): bool
{ {
// Validate data format // Validate data format
@ -48,6 +65,7 @@ class UserManager
return false; return false;
} }
if ($this->authService->login($emailUser, $passwordUser)) { if ($this->authService->login($emailUser, $passwordUser)) {
$this->currentUser = $this->authService->getCurrentUser(); $this->currentUser = $this->authService->getCurrentUser();
// Check if the current user is correctly set // Check if the current user is correctly set
@ -145,9 +163,14 @@ class UserManager
} }
// NEED TO PERSIST // NEED TO PERSIST
/** /**
* @throws \Exception * Enregistre un nouvel utilisateur avec les informations fournies.
*
* @param string $loginUser Le nom d'utilisateur.
* @param string $passwordUser Le mot de passe de l'utilisateur.
* @param array $data Les données supplémentaires pour l'enregistrement.
* @return bool Retourne true en cas d'enregistrement réussi, sinon false.
* @throws \Exception En cas d'erreur lors de la validation des données ou de l'enregistrement.
*/ */
public function register($loginUser, $passwordUser, $data): bool public function register($loginUser, $passwordUser, $data): bool
{ {
@ -158,21 +181,6 @@ class UserManager
// } // }
// } // }
$dateNaissance = new \DateTime($data['dateNaissance']);
$dateActuelle = new \DateTime();
// Vérifier si la date est dans le futur
if ($dateNaissance > $dateActuelle) {
throw new \Exception("La date de naissance ne peut pas être dans le futur.");
}
// Vérifier l'âge minimum (par exemple, 18 ans)
$ageMinimum = new \DateTime('-10 years');
if ($dateNaissance > $ageMinimum) {
throw new \Exception("Vous devez avoir au moins 18 ans pour vous inscrire.");
}
$data['dateNaissance'] = $dateNaissance;
$roleName = $data['roleName']; $roleName = $data['roleName'];
if ($roleName !== "Athlete" && $roleName !== "Coach") { if ($roleName !== "Athlete" && $roleName !== "Coach") {
throw new \Exception("Rôle non valide"); throw new \Exception("Rôle non valide");
@ -189,6 +197,11 @@ class UserManager
return false; return false;
} }
/**
* Déconnecte l'utilisateur actuel.
*
* @return bool Retourne true en cas de déconnexion réussie, sinon false.
*/
public function deconnecter(): bool public function deconnecter(): bool
{ {
if ($this->authService->logoutUser()) { if ($this->authService->logoutUser()) {
@ -198,6 +211,4 @@ class UserManager
} }
} }
?>
?>

@ -1,12 +1,9 @@
<?php <?php
namespace Repository; namespace Repository;
use Model\User;
interface IUserRepository extends IGenericRepository { interface IUserRepository extends IGenericRepository {
public function addFriend(User $user1,user $user2); public function addFriend(int $user1,int $user2);
public function deleteFriend(User $user1,User $user2); public function deleteFriend(int $user1,int $user2);
public function getItemByEmail(string $email);
} }

@ -1,4 +1,13 @@
<?php <?php
/**
* Nom du fichier: UserRepository.php
*
* @author PEREDERII Antoine
* @date 2023-11-25
* @description Classe représentant un dépôt d'utilisateurs pour l'accès aux données des utilisateurs.
*
* @package repository
*/
namespace Stub; namespace Stub;
@ -7,17 +16,30 @@ use Model\CoachAthlete;
use Model\User; use Model\User;
use Repository\IUserRepository; use Repository\IUserRepository;
/**
* @class UserRepository
* @brief Classe représentant un dépôt d'utilisateurs pour l'accès aux données des utilisateurs.
*/
class UserRepository implements IUserRepository { class UserRepository implements IUserRepository {
private array $users = []; private array $users = [];
/**
* Constructeur de la classe UserRepository.
*/
public function __construct() { public function __construct() {
$this->users[] = new User(1, "Doe", "John", "Doe","john.doe@example.com", '$2y$10$U59ioMTGZBM2FGQv.3lcbuL0IkO4Fx1jQU7f5hF7o/hvCX2t46mby', 'M', 1.80, 75, new \DateTime("1985-05-15"), new CoachAthlete()); $this->users[] = new User(1, "Doe", "John", "Doe","john.doe@example.com", "password123", 'M', 1.80, 75, new \DateTime("1985-05-15"), new CoachAthlete());
$this->users[] = new User(2, "Smith", "Jane","Smith", "jane.smith@example.com", '$2y$10$U59ioMTGZBM2FGQv.3lcbuL0IkO4Fx1jQU7f5hF7o/hvCX2t46mby', 'F', 1.65, 60, new \DateTime("1990-03-10"), new Athlete()); $this->users[] = new User(2, "Smith", "Jane","Smith", "jane.smith@example.com", "secure456", 'F', 1.65, 60, new \DateTime("1990-03-10"), new Athlete());
$this->users[] = new User(3, "Martin", "Paul","Martin", "paul.martin@example.com", '$2y$10$U59ioMTGZBM2FGQv.3lcbuL0IkO4Fx1jQU7f5hF7o/hvCX2t46mby', 'M', 1.75, 68, new \DateTime("1988-08-20"), new CoachAthlete()); $this->users[] = new User(3, "Martin", "Paul","Martin", "paul.martin@example.com", "super789", 'M', 1.75, 68, new \DateTime("1988-08-20"), new CoachAthlete());
$this->users[] = new User(4, "Brown", "Anna","Brown", "anna.brown@example.com", '$2y$10$U59ioMTGZBM2FGQv.3lcbuL0IkO4Fx1jQU7f5hF7o/hvCX2t46mby', 'F', 1.70, 58, new \DateTime("1992-11-25"), new Athlete()); $this->users[] = new User(4, "Brown", "Anna","Brown", "anna.brown@example.com", "test000", 'F', 1.70, 58, new \DateTime("1992-11-25"), new Athlete());
$this->users[] = new User(5, "Lee", "Bruce","Lee", "bruce.lee@example.com", '$2y$10$U59ioMTGZBM2FGQv.3lcbuL0IkO4Fx1jQU7f5hF7o/hvCX2t46mby', 'M', 1.72, 70, new \DateTime("1970-02-05"), new Athlete()); $this->users[] = new User(5, "Lee", "Bruce","Lee", "bruce.lee@example.com", "hello321", 'M', 1.72, 70, new \DateTime("1970-02-05"), new Athlete());
} }
/**
* Obtient un utilisateur par son identifiant.
*
* @param int $id L'identifiant de l'utilisateur.
* @return User|null L'utilisateur correspondant à l'identifiant donné, ou null s'il n'existe pas.
*/
public function getItemById(int $id): ?User { public function getItemById(int $id): ?User {
foreach ($this->users as $user) { foreach ($this->users as $user) {
if ($user->getId() === $id) { if ($user->getId() === $id) {
@ -27,6 +49,26 @@ class UserRepository implements IUserRepository {
return null; return null;
} }
/**
* Obtient un utilisateur par son rôle.
*
* @return User|null L'utilisateur ayant le rôle spécifié, ou null s'il n'y en a pas.
*/
public function getItemByRole(): ?User {
foreach ($this->users as $user) {
if ($user->getRole() instanceof \Model\Coach) {
return $user;
}
}
return null;
}
/**
* Obtient un utilisateur par son adresse e-mail.
*
* @param string $email L'adresse e-mail de l'utilisateur.
* @return User|null L'utilisateur correspondant à l'adresse e-mail donnée, ou null s'il n'existe pas.
*/
public function getItemByEmail(string $email): ?User { public function getItemByEmail(string $email): ?User {
foreach ($this->users as $user) { foreach ($this->users as $user) {
if ($user->getEmail() === $email) { if ($user->getEmail() === $email) {
@ -36,6 +78,12 @@ class UserRepository implements IUserRepository {
return null; return null;
} }
/**
* Obtient le nombre total d'utilisateurs dans le dépôt.
*
* @return int Le nombre total d'utilisateurs.
*/
public function getNbItems(): int { public function getNbItems(): int {
return count($this->users); return count($this->users);
} }
@ -45,31 +93,67 @@ class UserRepository implements IUserRepository {
return array_slice($this->users, $index, $count); return array_slice($this->users, $index, $count);
} }
/**
* Obtient un tableau d'utilisateurs dont le nom ou le prénom contient la sous-chaîne spécifiée.
*
* @param string $substring La sous-chaîne pour la recherche.
* @param int $index L'indice de départ dans le tableau.
* @param int $count Le nombre d'utilisateurs à récupérer.
* @param string|null $orderingPropertyName Le nom de la propriété pour l'ordonnancement (facultatif).
* @param bool $descending Indique si l'ordonnancement doit être effectué en ordre descendant (facultatif, par défaut false).
* @return array|null Le tableau d'utilisateurs filtré, ou null s'il n'y a aucun utilisateur correspondant.
*/
public function getItemsByName(string $substring, int $index, int $count, ?string $orderingPropertyName = null, bool $descending = false): array { public function getItemsByName(string $substring, int $index, int $count, ?string $orderingPropertyName = null, bool $descending = false): array {
$filteredUsers = array_filter($this->users, function ($user) use ($substring) { $filteredUsers = array_filter($this->users, function ($user) use ($substring) {
return str_contains(strtolower($user->getNom()), strtolower($substring)) || str_contains(strtolower($user->getPrenom()), strtolower($substring)); return str_contains(strtolower($user->getNom()), strtolower($substring)) || str_contains(strtolower($user->getPrenom()), strtolower($substring));
}); });
return array_slice($filteredUsers, $index, $count); return array_slice($filteredUsers, $index, $count);
} }
/**
* Obtient un utilisateur dont le nom ou le prénom contient la sous-chaîne spécifiée.
*
* @param string $substring La sous-chaîne pour la recherche.
* @param int $index L'indice de départ dans le tableau.
* @param int $count Le nombre d'utilisateurs à récupérer.
* @param string|null $orderingPropertyName Le nom de la propriété pour l'ordonnancement (facultatif).
* @param bool $descending Indique si l'ordonnancement doit être effectué en ordre descendant (facultatif, par défaut false).
* @return User|null L'utilisateur filtré, ou null s'il n'y a aucun utilisateur correspondant.
*/
public function getItemByName(string $substring, int $index, int $count, ?string $orderingPropertyName = null, bool $descending = false): ?User { public function getItemByName(string $substring, int $index, int $count, ?string $orderingPropertyName = null, bool $descending = false): ?User {
$filteredUsers = $this->GetItemsByName($substring, $index, $count, $orderingPropertyName, $descending); $filteredUsers = $this->GetItemsByName($substring, $index, $count, $orderingPropertyName, $descending);
return $filteredUsers[0] ?? null; return $filteredUsers[0] ?? null;
} }
/**
// should have type here * Met à jour un utilisateur existant dans le dépôt.
*
* @param User $oldItem L'ancienne instance de l'utilisateur.
* @param User $newItem La nouvelle instance de l'utilisateur.
* @return void
*/
public function updateItem($oldUser, $newUser): void { public function updateItem($oldUser, $newUser): void {
$index = array_search($oldUser, $this->users); $index = array_search($oldUser, $this->users);
if ($index !== false) { if ($index !== false) {
$this->users[$index] = $newUser; $this->users[$index] = $newItem;
} }
} }
// should have type here /**
* Ajoute un nouvel utilisateur au dépôt.
*
* @param User $user L'instance de l'utilisateur à ajouter.
* @return void
*/
public function addItem( $user): void { public function addItem( $user): void {
$this->users[] = $user; $this->users[] = $user;
} }
// should have type here /**
* Supprime un utilisateur du dépôt.
*
* @param User $user L'instance de l'utilisateur à supprimer.
* @return bool Retourne true si la suppression a réussi, sinon false.
*/
public function deleteItem( $user): bool { public function deleteItem( $user): bool {
$index = array_search($user, $this->users); $index = array_search($user, $this->users);
if ($index !== false) { if ($index !== false) {
@ -79,16 +163,15 @@ class UserRepository implements IUserRepository {
return false; return false;
} }
public function addFriend(User $user1, User $user2) public function addFriend(int $user1, int $user2)
{ {
return true; return true;
} }
public function deleteFriend(User $user1, User $user2) public function deleteFriend(int $user1, int $user2)
{ {
return true; return true;
} }
} }
?>
?>

@ -1,7 +1,5 @@
<?php <?php
namespace Stub; namespace Stub;
use Model\Athlete; use Model\Athlete;
use Model\CoachAthlete; use Model\CoachAthlete;
@ -10,48 +8,39 @@ use Repository\IUserRepository;
use Shared\Exception\NotImplementedException; use Shared\Exception\NotImplementedException;
use Network\IAuthService; use Network\IAuthService;
use Shared\IHashPassword; use Shared\IHashPassword;
use Shared\Log;
use Stub\UserRepository; use Stub\UserRepository;
class AuthService implements IAuthService {
class AuthService implements IAuthService
{
private IUserRepository $userRepository; private IUserRepository $userRepository;
private IHashPassword $passwordHacher; private IHashPassword $passwordHacher;
private ?User $currentUser; private ?User $currentUser;
public function __construct(UserRepository $userRepository, IHashPassword $passwordHacher) public function __construct(UserRepository $userRepository, IHashPassword $passwordHacher) {
{
$this->userRepository = $userRepository; $this->userRepository = $userRepository;
$this->passwordHacher = $passwordHacher; $this->passwordHacher = $passwordHacher;
} }
public function login(string $emailUser, string $password): bool public function login(string $emailUser,string $password): bool {
{
$user = $this->userRepository->getItemByEmail($emailUser); $user = $this->userRepository->getItemByEmail($emailUser);
if (!$user instanceof User) { if (!$user instanceof User) {
throw new \Exception('Unable to find user with that name'); throw new \Exception('Unable to find user with that name');
} }
if (!$this->passwordHacher->isPasswordValid($user->getMotDePasse(), $password)) { if ($user->isValidPassword($password)) {
return false; $this->currentUser = $user;
return true;
} }
$this->currentUser = $user; return false;
return true;
} }
public function register(string $username, string $password, $data): bool public function register(string $username, string $password, $data): bool
{ {
$hashedPassword = $this->passwordHacher->hashPassword($password); $hashedPassword = $this->passwordHacher->hashPassword($password);
$existingUser = $this->userRepository->getItemByEmail($username); $existingUser = $this->userRepository->getItemByEmail($username);
if ($existingUser != null || $existingUser instanceof User ) {
if ($existingUser != null || $existingUser instanceof User) {
throw new \Exception('User already exists'); throw new \Exception('User already exists');
} }
$username = $data['username'];
$prenom = $data['prenom']; $prenom = $data['prenom'];
$username = $data['username']; $username = $data['username'];
$nom = $data['nom']; $nom = $data['nom'];
@ -59,12 +48,13 @@ class AuthService implements IAuthService
$sexe = $data['sexe']; $sexe = $data['sexe'];
$taille = $data['taille']; $taille = $data['taille'];
$poids = $data['poids']; $poids = $data['poids'];
$dateNaissance = $data['dateNaissance']; $dateNaissance = $data['dateNaissance'] ;
$roleName = $data['roleName']; $roleName = $data['roleName'];
$role = null; $role = null;
if ($roleName == "Coach") { if($roleName == "Coach"){
$role = new CoachAthlete(); $role = new CoachAthlete();
} else if ($roleName == "Athlete") { }
else if($roleName == "Athlete"){
$role = new Athlete(); $role = new Athlete();
} }
$user = new User( $user = new User(
@ -81,7 +71,6 @@ class AuthService implements IAuthService
//should use reflexion //should use reflexion
$role $role
); );
$this->userRepository->addItem($user); $this->userRepository->addItem($user);
$this->currentUser = $user; $this->currentUser = $user;
return true; return true;

@ -2,8 +2,6 @@
namespace Shared; namespace Shared;
use App\Router\Request\IRequest; use App\Router\Request\IRequest;
use InvalidArgumentException;
/** /**
* Responsible for resolving the arguments passed to a controller action. * Responsible for resolving the arguments passed to a controller action.
*/ */
@ -16,7 +14,7 @@ class ArgumentControllerResolver implements IArgumentResolver{
* @param callable $controller The controller callable. * @param callable $controller The controller callable.
* @return array An array of resolved arguments. * @return array An array of resolved arguments.
* @throws \ReflectionException If the controller method does not exist. * @throws \ReflectionException If the controller method does not exist.
* @throws InvalidArgumentException If an argument cannot be resolved. * @throws \InvalidArgumentException If an argument cannot be resolved.
*/ */
public function getArguments(IRequest $request, callable $controller): array public function getArguments(IRequest $request, callable $controller): array
{ {
@ -29,10 +27,10 @@ class ArgumentControllerResolver implements IArgumentResolver{
$reflectionMethod = new \ReflectionMethod($className, $methodName); $reflectionMethod = new \ReflectionMethod($className, $methodName);
} else { } else {
// Handle other types of callables if needed // Handle other types of callables if needed
throw new InvalidArgumentException("Invalid controller callable format."); throw new \InvalidArgumentException("Invalid controller callable format.");
} }
} catch (\ReflectionException $e) { } catch (\ReflectionException $e) {
throw new InvalidArgumentException("Controller method error: " . $e->getMessage()); throw new \InvalidArgumentException("Controller method error: " . $e->getMessage());
} }
$args = []; $args = [];
@ -44,10 +42,11 @@ class ArgumentControllerResolver implements IArgumentResolver{
$name = $param->getName(); $name = $param->getName();
$value = $this->getFromRequest($name, $request); $value = $this->getFromRequest($name, $request);
if ($value === null && $param->isDefaultValueAvailable()) { if ($value === null && $param->isDefaultValueAvailable()) {
$value = $param->getDefaultValue(); $value = $param->getDefaultValue();
} elseif ($value === null) { } elseif ($value === null) {
throw new InvalidArgumentException("Missing argument: $name"); throw new \InvalidArgumentException("Missing argument: $name");
} }
$args[] = $value; $args[] = $value;

@ -26,7 +26,7 @@ final class Validation {
* @throws Exception Si la chaîne n'est pas valide (tentative d'injection de code). * @throws Exception Si la chaîne n'est pas valide (tentative d'injection de code).
*/ */
public static function val_string(string $string) : bool { public static function val_string(string $string) : bool {
if (!$string) {//filter_var($string, FILTER_SANITIZE_STRING) !== $string if (strlen(htmlspecialchars($string, ENT_QUOTES) === 0)) {
throw new Exception("$string n'est pas valide. Tentative d'injection de code (attaque sécurité)!"); throw new Exception("$string n'est pas valide. Tentative d'injection de code (attaque sécurité)!");
} else { } else {
return true; return true;
@ -101,7 +101,7 @@ final class Validation {
* @return string La chaîne nettoyée. * @return string La chaîne nettoyée.
*/ */
public static function clean_string(string $string) : string { public static function clean_string(string $string) : string {
return filter_var($string); return filter_var($string, FILTER_SANITIZE_STRING);
} }
/** /**

@ -1,215 +0,0 @@
<?php
use PHPUnit\Framework\TestCase;
//use Database\{Connexion, AthleteGateway,AthleteEntity};
use Database\AthleteEntity;
use Database\AthleteGateway;
use Database\Connexion;
use Database\AthleteMapper;
use Database\CoachGateway;
use Database\CoachEntity;
use Database\CoachMapper;
class GatewayTest extends TestCase {
//Partie concernant les Athlètes
public function testGetAthlete() {
//$dsn = "pgsql:host=londres;port=8888;dbname=dbkemonteiro2;user=kemonteiro2;password=Mdp";
require "loginDatabase.php";
$connexion = new Connexion($dsn,$username,$password);
$athleteGateway = new AthleteGateway($connexion);
$result = $athleteGateway->getAthlete();
//var_dump($result);
}
/* Fonctionne mais en commentaire pour pas add et del a chaque fois
public function testAddAthlete(){
$dsn = "mysql:host=londres;dbname=dbkemonteiro2;";
$username = "kemonteiro2";
$password = "#Phpmyadmin63";
$connexion = new Connexion($dsn,$username,$password);
$athleteGateway = new AthleteGateway($connexion);
$dateSpecifique = "2023-11-26";
$timestamp = strtotime($dateSpecifique);
$dateSQL = date("Y-m-d", $timestamp);
$athleteEntity = new AthleteEntity();
$athleteEntity->setNom('John');
$athleteEntity->setPrenom('Doe');
$athleteEntity->setIdAthlete(1234);
$athleteEntity->setEmail('kevin.monteiro@gmail.fr');
$athleteEntity->setSexe('H');
$athleteEntity->setTaille(169);
$athleteEntity->setPoids(69);
$athleteEntity->setMotDePasse('motdepasse');
$athleteEntity->setDateNaissance($dateSQL);
$result2 = $athleteGateway->addAthlete($athleteEntity);
}
public function testDeleteAthlete(){
$dsn = "mysql:host=londres;dbname=dbkemonteiro2;";
$username = "kemonteiro2";
$password = "#Phpmyadmin63";
$connexion = new Connexion($dsn,$username,$password);
$athleteGateway = new AthleteGateway($connexion);
$result = $athleteGateway->deleteAthlete( //idAthlete );
var_dump($result);
}*/
public function testUpdateAthlete(){
$dsn = "mysql:host=londres;dbname=dbkemonteiro2;";
$username = "kemonteiro2";
$password = "#Phpmyadmin63";
$connexion = new Connexion($dsn,$username,$password);
$athleteGateway = new AthleteGateway($connexion);
$dateSpecifique = "2004-08-26";
$timestamp = strtotime($dateSpecifique);
$dateSQL = date("Y-m-d", $timestamp);
$athleteEntity = new AthleteEntity();
$athleteEntity->setNom('John');
$athleteEntity->setPrenom('Doe');
$athleteEntity->setIdAthlete(13);
$athleteEntity->setEmail('kevin.monteiro@gmail.fr');
$athleteEntity->setSexe('H');
$athleteEntity->setTaille(169);
$athleteEntity->setPoids(69);
$athleteEntity->setMotDePasse('motdepasse');
$athleteEntity->setDateNaissance($dateSQL);
$athleteEntity->setIsCoach(FALSE);
$athleteEntity->setCoachId(NULL);
$athleteEntity2 = new AthleteEntity();
$athleteEntity2->setNom('Monteiro');
$athleteEntity2->setPrenom('Kevin');
$athleteEntity2->setIdAthlete(13);
$athleteEntity2->setEmail('kevin.monteiro@gmail.fr');
$athleteEntity2->setSexe('H');
$athleteEntity2->setTaille(169);
$athleteEntity2->setPoids(69);
$athleteEntity2->setMotDePasse('motdepasse');
$athleteEntity2->setDateNaissance($dateSQL);
$athleteEntity2->setIsCoach(TRUE);
$athleteEntity2->setCoachId(1);
$result = $athleteGateway->updateAthlete($athleteEntity, $athleteEntity2);
}
//Partie concernant les Coachs
public function testGetCoach() {
//$dsn = "pgsql:host=londres;port=8888;dbname=dbkemonteiro2;user=kemonteiro2;password=Mdp";
$dsn = "mysql:host=londres;dbname=dbkemonteiro2;";
$username = "kemonteiro2";
$password = "#Phpmyadmin63";
$connexion = new Connexion($dsn,$username,$password);
$coachGateway = new CoachGateway($connexion);
$result = $coachGateway->getCoach();
var_dump($result);
}
/*
//Fonctionne PAS A PARTIR DE LA
public function testAddCoach(){
$dsn = "mysql:host=londres;dbname=dbkemonteiro2;";
$username = "kemonteiro2";
$password = "#Phpmyadmin63";
$connexion = new Connexion($dsn,$username,$password);
$coachGateway = new CoachGateway($connexion);
$dateSpecifique = "2023-11-26";
$timestamp = strtotime($dateSpecifique);
$dateSQL = date("Y-m-d", $timestamp);
$coachEntity = new CoachEntity();
$coachEntity->setNom('John');
$coachEntity->setPrenom('Doe');
$coachEntity->setIdCoach(1234);
$coachEntity->setEmail('kevin.monteiro@gmail.fr');
$coachEntity->setSexe('H');
$coachEntity->setTaille(169);
$coachEntity->setPoids(69);
$coachEntity->setMotDePasse('motdepasse');
$coachEntity->setDateNaissance($dateSQL);
$result2 = $coachGateway->addCoach($coachEntity);
}
public function testDeleteAthlete(){
$dsn = "mysql:host=londres;dbname=dbkemonteiro2;";
$username = "kemonteiro2";
$password = "#Phpmyadmin63";
$connexion = new Connexion($dsn,$username,$password);
$athleteGateway = new AthleteGateway($connexion);
$result = $athleteGateway->deleteAthlete( //idAthlete );
var_dump($result);
}*/
/*
public function testUpdateAthlete(){
$dsn = "mysql:host=londres;dbname=dbkemonteiro2;";
$username = "kemonteiro2";
$password = "#Phpmyadmin63";
$connexion = new Connexion($dsn,$username,$password);
$athleteGateway = new AthleteGateway($connexion);
$dateSpecifique = "2004-08-26";
$timestamp = strtotime($dateSpecifique);
$dateSQL = date("Y-m-d", $timestamp);
$athleteEntity = new AthleteEntity();
$athleteEntity->setNom('John');
$athleteEntity->setPrenom('Doe');
$athleteEntity->setIdAthlete(13);
$athleteEntity->setEmail('kevin.monteiro@gmail.fr');
$athleteEntity->setSexe('H');
$athleteEntity->setTaille(169);
$athleteEntity->setPoids(69);
$athleteEntity->setMotDePasse('motdepasse');
$athleteEntity->setDateNaissance($dateSQL);
$athleteEntity2 = new AthleteEntity();
$athleteEntity2->setNom('Monteiro');
$athleteEntity2->setPrenom('Kevin');
$athleteEntity2->setIdAthlete(13);
$athleteEntity2->setEmail('kevin.monteiro@gmail.fr');
$athleteEntity2->setSexe('H');
$athleteEntity2->setTaille(169);
$athleteEntity2->setPoids(69);
$athleteEntity2->setMotDePasse('motdepasse');
$athleteEntity2->setDateNaissance($dateSQL);
$result = $athleteGateway->updateAthlete($athleteEntity, $athleteEntity2);
}*/
}

@ -1,43 +0,0 @@
<?php
use PHPUnit\Framework\TestCase;
use Model\User;
use Database\AthleteEntity;
use Database\AthleteGateway;
use Database\Connexion;
use Database\AthleteMapper;
class MapperTest extends TestCase {
public function testMapperAthlete() {
//$dsn = "pgsql:host=londres;port=8888;dbname=dbkemonteiro2;user=kemonteiro2;password=Mdp";
$dsn = "mysql:host=londres;dbname=dbkemonteiro2;";
$username = "kemonteiro2";
$password = "#Phpmyadmin63";
$connexion = new Connexion($dsn,$username,$password);
$athleteGateway = new AthleteGateway($connexion);
$result = $athleteGateway->getAthlete();
$map = new AthleteMapper ();
//SQL To AthleteEntity
$athleteEntity = $map->athleteSqlToEntity($result);
foreach($athleteEntity as $ath){
$result = $ath->getNom();
var_dump($result);
//Pour chaque AthleteEntity : Athlete Entity To User avec Role Athlete(Model)
$user = $map->athleteEntityToModel($ath);
var_dump($user->getId());
//Pour chaque Athlete du Model -> Athlete Entity
$res = $map->athleteToEntity($user);
var_dump($res->getIdAthlete());
}
}
}

@ -1,7 +0,0 @@
<?php
$dsn = "psql:host=localhost;dbname=sae_3;";
$username = "Perederii";
$password = "";
?>

@ -1,5 +1,4 @@
<?php <?php
use Shared\Log;
class AltoRouter { class AltoRouter {
@ -101,8 +100,6 @@ class AltoRouter {
public function generate($routeName, array $params = array()) { public function generate($routeName, array $params = array()) {
// Check if named route exists // Check if named route exists
if(!isset($this->namedRoutes[$routeName])) { if(!isset($this->namedRoutes[$routeName])) {
throw new \Exception("Route '{$routeName}' does not exist."); throw new \Exception("Route '{$routeName}' does not exist.");
} }

@ -430,6 +430,7 @@ return array(
'PHPUnit\\Framework\\MockObject\\Stub\\ReturnValueMap' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/ReturnValueMap.php', 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnValueMap' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/ReturnValueMap.php',
'PHPUnit\\Framework\\MockObject\\Stub\\Stub' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/Stub.php', 'PHPUnit\\Framework\\MockObject\\Stub\\Stub' => $vendorDir . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/Stub.php',
'PHPUnit\\Framework\\NoChildTestSuiteException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/NoChildTestSuiteException.php', 'PHPUnit\\Framework\\NoChildTestSuiteException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/NoChildTestSuiteException.php',
'PHPUnit\\Framework\\PhptAssertionFailedError' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/PhptAssertionFailedError.php',
'PHPUnit\\Framework\\ProcessIsolationException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/ProcessIsolationException.php', 'PHPUnit\\Framework\\ProcessIsolationException' => $vendorDir . '/phpunit/phpunit/src/Framework/Exception/ProcessIsolationException.php',
'PHPUnit\\Framework\\Reorderable' => $vendorDir . '/phpunit/phpunit/src/Framework/Reorderable.php', 'PHPUnit\\Framework\\Reorderable' => $vendorDir . '/phpunit/phpunit/src/Framework/Reorderable.php',
'PHPUnit\\Framework\\SelfDescribing' => $vendorDir . '/phpunit/phpunit/src/Framework/SelfDescribing.php', 'PHPUnit\\Framework\\SelfDescribing' => $vendorDir . '/phpunit/phpunit/src/Framework/SelfDescribing.php',
@ -955,6 +956,93 @@ return array(
'PharIo\\Version\\VersionConstraintValue' => $vendorDir . '/phar-io/version/src/VersionConstraintValue.php', 'PharIo\\Version\\VersionConstraintValue' => $vendorDir . '/phar-io/version/src/VersionConstraintValue.php',
'PharIo\\Version\\VersionNumber' => $vendorDir . '/phar-io/version/src/VersionNumber.php', 'PharIo\\Version\\VersionNumber' => $vendorDir . '/phar-io/version/src/VersionNumber.php',
'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php', 'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
'SebastianBergmann\\CliParser\\AmbiguousOptionException' => $vendorDir . '/sebastian/cli-parser/src/exceptions/AmbiguousOptionException.php',
'SebastianBergmann\\CliParser\\Exception' => $vendorDir . '/sebastian/cli-parser/src/exceptions/Exception.php',
'SebastianBergmann\\CliParser\\OptionDoesNotAllowArgumentException' => $vendorDir . '/sebastian/cli-parser/src/exceptions/OptionDoesNotAllowArgumentException.php',
'SebastianBergmann\\CliParser\\Parser' => $vendorDir . '/sebastian/cli-parser/src/Parser.php',
'SebastianBergmann\\CliParser\\RequiredOptionArgumentMissingException' => $vendorDir . '/sebastian/cli-parser/src/exceptions/RequiredOptionArgumentMissingException.php',
'SebastianBergmann\\CliParser\\UnknownOptionException' => $vendorDir . '/sebastian/cli-parser/src/exceptions/UnknownOptionException.php',
'SebastianBergmann\\CodeCoverage\\BranchAndPathCoverageNotSupportedException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/BranchAndPathCoverageNotSupportedException.php',
'SebastianBergmann\\CodeCoverage\\CodeCoverage' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage.php',
'SebastianBergmann\\CodeCoverage\\Data\\ProcessedCodeCoverageData' => $vendorDir . '/phpunit/php-code-coverage/src/Data/ProcessedCodeCoverageData.php',
'SebastianBergmann\\CodeCoverage\\Data\\RawCodeCoverageData' => $vendorDir . '/phpunit/php-code-coverage/src/Data/RawCodeCoverageData.php',
'SebastianBergmann\\CodeCoverage\\DeadCodeDetectionNotSupportedException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/DeadCodeDetectionNotSupportedException.php',
'SebastianBergmann\\CodeCoverage\\Driver\\Driver' => $vendorDir . '/phpunit/php-code-coverage/src/Driver/Driver.php',
'SebastianBergmann\\CodeCoverage\\Driver\\PathExistsButIsNotDirectoryException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/PathExistsButIsNotDirectoryException.php',
'SebastianBergmann\\CodeCoverage\\Driver\\PcovDriver' => $vendorDir . '/phpunit/php-code-coverage/src/Driver/PcovDriver.php',
'SebastianBergmann\\CodeCoverage\\Driver\\PcovNotAvailableException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/PcovNotAvailableException.php',
'SebastianBergmann\\CodeCoverage\\Driver\\Selector' => $vendorDir . '/phpunit/php-code-coverage/src/Driver/Selector.php',
'SebastianBergmann\\CodeCoverage\\Driver\\WriteOperationFailedException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/WriteOperationFailedException.php',
'SebastianBergmann\\CodeCoverage\\Driver\\XdebugDriver' => $vendorDir . '/phpunit/php-code-coverage/src/Driver/XdebugDriver.php',
'SebastianBergmann\\CodeCoverage\\Driver\\XdebugNotAvailableException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/XdebugNotAvailableException.php',
'SebastianBergmann\\CodeCoverage\\Driver\\XdebugNotEnabledException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/XdebugNotEnabledException.php',
'SebastianBergmann\\CodeCoverage\\Exception' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/Exception.php',
'SebastianBergmann\\CodeCoverage\\FileCouldNotBeWrittenException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/FileCouldNotBeWrittenException.php',
'SebastianBergmann\\CodeCoverage\\Filter' => $vendorDir . '/phpunit/php-code-coverage/src/Filter.php',
'SebastianBergmann\\CodeCoverage\\InvalidArgumentException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/InvalidArgumentException.php',
'SebastianBergmann\\CodeCoverage\\NoCodeCoverageDriverAvailableException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/NoCodeCoverageDriverAvailableException.php',
'SebastianBergmann\\CodeCoverage\\NoCodeCoverageDriverWithPathCoverageSupportAvailableException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/NoCodeCoverageDriverWithPathCoverageSupportAvailableException.php',
'SebastianBergmann\\CodeCoverage\\Node\\AbstractNode' => $vendorDir . '/phpunit/php-code-coverage/src/Node/AbstractNode.php',
'SebastianBergmann\\CodeCoverage\\Node\\Builder' => $vendorDir . '/phpunit/php-code-coverage/src/Node/Builder.php',
'SebastianBergmann\\CodeCoverage\\Node\\CrapIndex' => $vendorDir . '/phpunit/php-code-coverage/src/Node/CrapIndex.php',
'SebastianBergmann\\CodeCoverage\\Node\\Directory' => $vendorDir . '/phpunit/php-code-coverage/src/Node/Directory.php',
'SebastianBergmann\\CodeCoverage\\Node\\File' => $vendorDir . '/phpunit/php-code-coverage/src/Node/File.php',
'SebastianBergmann\\CodeCoverage\\Node\\Iterator' => $vendorDir . '/phpunit/php-code-coverage/src/Node/Iterator.php',
'SebastianBergmann\\CodeCoverage\\ParserException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/ParserException.php',
'SebastianBergmann\\CodeCoverage\\ReflectionException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/ReflectionException.php',
'SebastianBergmann\\CodeCoverage\\ReportAlreadyFinalizedException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/ReportAlreadyFinalizedException.php',
'SebastianBergmann\\CodeCoverage\\Report\\Clover' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Clover.php',
'SebastianBergmann\\CodeCoverage\\Report\\Cobertura' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Cobertura.php',
'SebastianBergmann\\CodeCoverage\\Report\\Crap4j' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Crap4j.php',
'SebastianBergmann\\CodeCoverage\\Report\\Html\\Colors' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Colors.php',
'SebastianBergmann\\CodeCoverage\\Report\\Html\\CustomCssFile' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/CustomCssFile.php',
'SebastianBergmann\\CodeCoverage\\Report\\Html\\Dashboard' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Dashboard.php',
'SebastianBergmann\\CodeCoverage\\Report\\Html\\Directory' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Directory.php',
'SebastianBergmann\\CodeCoverage\\Report\\Html\\Facade' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Facade.php',
'SebastianBergmann\\CodeCoverage\\Report\\Html\\File' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php',
'SebastianBergmann\\CodeCoverage\\Report\\Html\\Renderer' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Html/Renderer.php',
'SebastianBergmann\\CodeCoverage\\Report\\PHP' => $vendorDir . '/phpunit/php-code-coverage/src/Report/PHP.php',
'SebastianBergmann\\CodeCoverage\\Report\\Text' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Text.php',
'SebastianBergmann\\CodeCoverage\\Report\\Thresholds' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Thresholds.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\BuildInformation' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/BuildInformation.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Coverage' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Coverage.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Directory' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Directory.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Facade' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Facade.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\File' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/File.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Method' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Method.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Node' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Node.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Project' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Project.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Report' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Report.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Source' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Source.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Tests' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Tests.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Totals' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Totals.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Unit' => $vendorDir . '/phpunit/php-code-coverage/src/Report/Xml/Unit.php',
'SebastianBergmann\\CodeCoverage\\StaticAnalysisCacheNotConfiguredException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/StaticAnalysisCacheNotConfiguredException.php',
'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CacheWarmer' => $vendorDir . '/phpunit/php-code-coverage/src/StaticAnalysis/CacheWarmer.php',
'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CachingFileAnalyser' => $vendorDir . '/phpunit/php-code-coverage/src/StaticAnalysis/CachingFileAnalyser.php',
'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CodeUnitFindingVisitor' => $vendorDir . '/phpunit/php-code-coverage/src/StaticAnalysis/CodeUnitFindingVisitor.php',
'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\ExecutableLinesFindingVisitor' => $vendorDir . '/phpunit/php-code-coverage/src/StaticAnalysis/ExecutableLinesFindingVisitor.php',
'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\FileAnalyser' => $vendorDir . '/phpunit/php-code-coverage/src/StaticAnalysis/FileAnalyser.php',
'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\IgnoredLinesFindingVisitor' => $vendorDir . '/phpunit/php-code-coverage/src/StaticAnalysis/IgnoredLinesFindingVisitor.php',
'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\ParsingFileAnalyser' => $vendorDir . '/phpunit/php-code-coverage/src/StaticAnalysis/ParsingFileAnalyser.php',
'SebastianBergmann\\CodeCoverage\\TestIdMissingException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/TestIdMissingException.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Known' => $vendorDir . '/phpunit/php-code-coverage/src/TestSize/Known.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Large' => $vendorDir . '/phpunit/php-code-coverage/src/TestSize/Large.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Medium' => $vendorDir . '/phpunit/php-code-coverage/src/TestSize/Medium.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Small' => $vendorDir . '/phpunit/php-code-coverage/src/TestSize/Small.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\TestSize' => $vendorDir . '/phpunit/php-code-coverage/src/TestSize/TestSize.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Unknown' => $vendorDir . '/phpunit/php-code-coverage/src/TestSize/Unknown.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\Failure' => $vendorDir . '/phpunit/php-code-coverage/src/TestStatus/Failure.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\Known' => $vendorDir . '/phpunit/php-code-coverage/src/TestStatus/Known.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\Success' => $vendorDir . '/phpunit/php-code-coverage/src/TestStatus/Success.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\TestStatus' => $vendorDir . '/phpunit/php-code-coverage/src/TestStatus/TestStatus.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\Unknown' => $vendorDir . '/phpunit/php-code-coverage/src/TestStatus/Unknown.php',
'SebastianBergmann\\CodeCoverage\\UnintentionallyCoveredCodeException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/UnintentionallyCoveredCodeException.php',
'SebastianBergmann\\CodeCoverage\\Util\\DirectoryCouldNotBeCreatedException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/DirectoryCouldNotBeCreatedException.php',
'SebastianBergmann\\CodeCoverage\\Util\\Filesystem' => $vendorDir . '/phpunit/php-code-coverage/src/Util/Filesystem.php',
'SebastianBergmann\\CodeCoverage\\Util\\Percentage' => $vendorDir . '/phpunit/php-code-coverage/src/Util/Percentage.php',
'SebastianBergmann\\CodeCoverage\\Version' => $vendorDir . '/phpunit/php-code-coverage/src/Version.php',
'SebastianBergmann\\CodeCoverage\\XmlException' => $vendorDir . '/phpunit/php-code-coverage/src/Exception/XmlException.php',
'SebastianBergmann\\CodeUnitReverseLookup\\Wizard' => $vendorDir . '/sebastian/code-unit-reverse-lookup/src/Wizard.php', 'SebastianBergmann\\CodeUnitReverseLookup\\Wizard' => $vendorDir . '/sebastian/code-unit-reverse-lookup/src/Wizard.php',
'SebastianBergmann\\CodeUnit\\ClassMethodUnit' => $vendorDir . '/sebastian/code-unit/src/ClassMethodUnit.php', 'SebastianBergmann\\CodeUnit\\ClassMethodUnit' => $vendorDir . '/sebastian/code-unit/src/ClassMethodUnit.php',
'SebastianBergmann\\CodeUnit\\ClassUnit' => $vendorDir . '/sebastian/code-unit/src/ClassUnit.php', 'SebastianBergmann\\CodeUnit\\ClassUnit' => $vendorDir . '/sebastian/code-unit/src/ClassUnit.php',

@ -12,21 +12,24 @@ return array(
'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
'Stub\\' => array($baseDir . '/src/data/stub', $baseDir . '/src/data/stub/service', $baseDir . '/src/data/stub/repository'), 'Stub\\' => array($baseDir . '/src/data/stub', $baseDir . '/src/data/stub/service', $baseDir . '/src/data/stub/repository'),
'Repository\\' => array($baseDir . '/src/data/model/repository'),
'Network\\' => array($baseDir . '/src/data/core/network'),
'Model\\' => array($baseDir . '/src/data/model'),
'Manager\\' => array($baseDir . '/src/data/model/manager'),
'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'),
'Data\\' => array($baseDir . '/src/data'),
'Shared\\Exception\\' => array($baseDir . '/src/shared/exception'), 'Shared\\Exception\\' => array($baseDir . '/src/shared/exception'),
'Shared\\Attributes\\' => array($baseDir . '/src/shared/attributes'), 'Shared\\Attributes\\' => array($baseDir . '/src/shared/attributes'),
'Shared\\' => array($baseDir . '/src/shared'), 'Shared\\' => array($baseDir . '/src/shared'),
'Repository\\' => array($baseDir . '/src/data/model/repository'), 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
'Psr\\Container\\' => array($vendorDir . '/psr/container/src', $vendorDir . '/sebastian/cli-parser/src'),
'PhpParser\\' => array($vendorDir . '/nikic/php-parser/lib/PhpParser'), 'PhpParser\\' => array($vendorDir . '/nikic/php-parser/lib/PhpParser'),
'PhpOption\\' => array($vendorDir . '/phpoption/phpoption/src/PhpOption', $vendorDir . '/phpunit/php-code-coverage/src/PhpOption'), 'PhpOption\\' => array($vendorDir . '/phpoption/phpoption/src/PhpOption'),
'Repository\\' => array($baseDir . '/src/data/model/repository'),
'Network\\' => array($baseDir . '/src/data/core/network'), 'Network\\' => array($baseDir . '/src/data/core/network'),
'Model\\' => array($baseDir . '/src/data/model'),
'Manager\\' => array($baseDir . '/src/data/model/manager'),
'Hearttrack\\' => array($baseDir . '/src'), 'Hearttrack\\' => array($baseDir . '/src'),
'GrahamCampbell\\ResultType\\' => array($vendorDir . '/graham-campbell/result-type/src'), 'GrahamCampbell\\ResultType\\' => array($vendorDir . '/graham-campbell/result-type/src'),
'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'), 'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'),
'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'), 'DeepCopy\\' => array($vendorDir . '/myclabs/deep-copy/src/DeepCopy'),
'Database\\' => array($baseDir . '/src/data/core/database'),
'Data\\Core\\' => array($baseDir . '/src/data/core'), 'Data\\Core\\' => array($baseDir . '/src/data/core'),
'Data\\' => array($baseDir . '/src/data'), 'Data\\' => array($baseDir . '/src/data'),
'Console\\' => array($baseDir . '/src/console'), 'Console\\' => array($baseDir . '/src/console'),

@ -63,10 +63,10 @@ class ComposerStaticInit1887e85fc3cfddacf8d7e17588dae6f1
'D' => 'D' =>
array ( array (
'Dotenv\\' => 7, 'Dotenv\\' => 7,
'Data\\' => 5,
'Doctrine\\Instantiator\\' => 22,
'DeepCopy\\' => 9, 'DeepCopy\\' => 9,
'Database\\' => 9,
'Data\\Core\\' => 10, 'Data\\Core\\' => 10,
'Data\\' => 5,
), ),
'C' => 'C' =>
array ( array (
@ -105,32 +105,31 @@ class ComposerStaticInit1887e85fc3cfddacf8d7e17588dae6f1
array ( array (
0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
), ),
'Stub\\' => 'Stub\\' =>
array ( array (
0 => __DIR__ . '/../..' . '/src/data/stub', 0 => __DIR__ . '/../..' . '/src/data/stub',
1 => __DIR__ . '/../..' . '/src/data/stub/service', 1 => __DIR__ . '/../..' . '/src/data/stub/service',
2 => __DIR__ . '/../..' . '/src/data/stub/repository', 2 => __DIR__ . '/../..' . '/src/data/stub/repository',
), ),
'Shared\\Exception\\' => 'Shared\\Exception\\' =>
array ( array (
0 => __DIR__ . '/../..' . '/src/shared/exception', 0 => __DIR__ . '/../..' . '/src/shared/exception',
), ),
'Shared\\Attributes\\' => 'Shared\\Attributes\\' =>
array ( array (
0 => __DIR__ . '/../..' . '/src/shared/attributes', 0 => __DIR__ . '/../..' . '/src/shared/attributes',
), ),
'Shared\\' => 'Shared\\' =>
array ( array (
0 => __DIR__ . '/../..' . '/src/shared', 0 => __DIR__ . '/../..' . '/src/shared',
), ),
'Repository\\' => 'Repository\\' =>
array ( array (
0 => __DIR__ . '/../..' . '/src/data/model/repository', 0 => __DIR__ . '/../..' . '/src/data/model/repository',
), ),
'Psr\\Container\\' => 'Psr\\Container\\' =>
array ( array (
0 => __DIR__ . '/..' . '/psr/container/src', 0 => __DIR__ . '/..' . '/psr/container/src',
1 => __DIR__ . '/..' . '/sebastian/cli-parser/src',
), ),
'PhpParser\\' => 'PhpParser\\' =>
array ( array (
@ -139,9 +138,8 @@ class ComposerStaticInit1887e85fc3cfddacf8d7e17588dae6f1
'PhpOption\\' => 'PhpOption\\' =>
array ( array (
0 => __DIR__ . '/..' . '/phpoption/phpoption/src/PhpOption', 0 => __DIR__ . '/..' . '/phpoption/phpoption/src/PhpOption',
1 => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/PhpOption',
), ),
'Network\\' => 'Network\\' =>
array ( array (
0 => __DIR__ . '/../..' . '/src/data/core/network', 0 => __DIR__ . '/../..' . '/src/data/core/network',
), ),
@ -153,7 +151,7 @@ class ComposerStaticInit1887e85fc3cfddacf8d7e17588dae6f1
array ( array (
0 => __DIR__ . '/../..' . '/src/data/model/manager', 0 => __DIR__ . '/../..' . '/src/data/model/manager',
), ),
'Hearttrack\\' => 'Hearttrack\\' =>
array ( array (
0 => __DIR__ . '/../..' . '/src', 0 => __DIR__ . '/../..' . '/src',
), ),
@ -165,15 +163,19 @@ class ComposerStaticInit1887e85fc3cfddacf8d7e17588dae6f1
array ( array (
0 => __DIR__ . '/..' . '/vlucas/phpdotenv/src', 0 => __DIR__ . '/..' . '/vlucas/phpdotenv/src',
), ),
'DeepCopy\\' => 'Doctrine\\Instantiator\\' =>
array ( array (
0 => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy', 0 => __DIR__ . '/..' . '/graham-campbell/result-type/src',
), ),
'Database\\' => 'Dotenv\\' =>
array ( array (
0 => __DIR__ . '/../..' . '/src/data/core/database', 0 => __DIR__ . '/..' . '/vlucas/phpdotenv/src',
),
'DeepCopy\\' =>
array (
0 => __DIR__ . '/..' . '/myclabs/deep-copy/src/DeepCopy',
), ),
'Data\\Core\\' => 'Data\\Core\\' =>
array ( array (
0 => __DIR__ . '/../..' . '/src/data/core', 0 => __DIR__ . '/../..' . '/src/data/core',
), ),
@ -185,7 +187,7 @@ class ComposerStaticInit1887e85fc3cfddacf8d7e17588dae6f1
array ( array (
0 => __DIR__ . '/../..' . '/src/console', 0 => __DIR__ . '/../..' . '/src/console',
), ),
'App\\Views\\Directives\\' => 'App\\Views\\Directives\\' =>
array ( array (
0 => __DIR__ . '/../..' . '/src/app/views/directives', 0 => __DIR__ . '/../..' . '/src/app/views/directives',
), ),
@ -640,6 +642,7 @@ class ComposerStaticInit1887e85fc3cfddacf8d7e17588dae6f1
'PHPUnit\\Framework\\MockObject\\Stub\\ReturnValueMap' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/ReturnValueMap.php', 'PHPUnit\\Framework\\MockObject\\Stub\\ReturnValueMap' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/ReturnValueMap.php',
'PHPUnit\\Framework\\MockObject\\Stub\\Stub' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/Stub.php', 'PHPUnit\\Framework\\MockObject\\Stub\\Stub' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/MockObject/Runtime/Stub/Stub.php',
'PHPUnit\\Framework\\NoChildTestSuiteException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/NoChildTestSuiteException.php', 'PHPUnit\\Framework\\NoChildTestSuiteException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/NoChildTestSuiteException.php',
'PHPUnit\\Framework\\PhptAssertionFailedError' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/PhptAssertionFailedError.php',
'PHPUnit\\Framework\\ProcessIsolationException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/ProcessIsolationException.php', 'PHPUnit\\Framework\\ProcessIsolationException' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Exception/ProcessIsolationException.php',
'PHPUnit\\Framework\\Reorderable' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Reorderable.php', 'PHPUnit\\Framework\\Reorderable' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Reorderable.php',
'PHPUnit\\Framework\\SelfDescribing' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/SelfDescribing.php', 'PHPUnit\\Framework\\SelfDescribing' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/SelfDescribing.php',
@ -1165,6 +1168,93 @@ class ComposerStaticInit1887e85fc3cfddacf8d7e17588dae6f1
'PharIo\\Version\\VersionConstraintValue' => __DIR__ . '/..' . '/phar-io/version/src/VersionConstraintValue.php', 'PharIo\\Version\\VersionConstraintValue' => __DIR__ . '/..' . '/phar-io/version/src/VersionConstraintValue.php',
'PharIo\\Version\\VersionNumber' => __DIR__ . '/..' . '/phar-io/version/src/VersionNumber.php', 'PharIo\\Version\\VersionNumber' => __DIR__ . '/..' . '/phar-io/version/src/VersionNumber.php',
'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php', 'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
'SebastianBergmann\\CliParser\\AmbiguousOptionException' => __DIR__ . '/..' . '/sebastian/cli-parser/src/exceptions/AmbiguousOptionException.php',
'SebastianBergmann\\CliParser\\Exception' => __DIR__ . '/..' . '/sebastian/cli-parser/src/exceptions/Exception.php',
'SebastianBergmann\\CliParser\\OptionDoesNotAllowArgumentException' => __DIR__ . '/..' . '/sebastian/cli-parser/src/exceptions/OptionDoesNotAllowArgumentException.php',
'SebastianBergmann\\CliParser\\Parser' => __DIR__ . '/..' . '/sebastian/cli-parser/src/Parser.php',
'SebastianBergmann\\CliParser\\RequiredOptionArgumentMissingException' => __DIR__ . '/..' . '/sebastian/cli-parser/src/exceptions/RequiredOptionArgumentMissingException.php',
'SebastianBergmann\\CliParser\\UnknownOptionException' => __DIR__ . '/..' . '/sebastian/cli-parser/src/exceptions/UnknownOptionException.php',
'SebastianBergmann\\CodeCoverage\\BranchAndPathCoverageNotSupportedException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/BranchAndPathCoverageNotSupportedException.php',
'SebastianBergmann\\CodeCoverage\\CodeCoverage' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/CodeCoverage.php',
'SebastianBergmann\\CodeCoverage\\Data\\ProcessedCodeCoverageData' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Data/ProcessedCodeCoverageData.php',
'SebastianBergmann\\CodeCoverage\\Data\\RawCodeCoverageData' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Data/RawCodeCoverageData.php',
'SebastianBergmann\\CodeCoverage\\DeadCodeDetectionNotSupportedException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/DeadCodeDetectionNotSupportedException.php',
'SebastianBergmann\\CodeCoverage\\Driver\\Driver' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Driver/Driver.php',
'SebastianBergmann\\CodeCoverage\\Driver\\PathExistsButIsNotDirectoryException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/PathExistsButIsNotDirectoryException.php',
'SebastianBergmann\\CodeCoverage\\Driver\\PcovDriver' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Driver/PcovDriver.php',
'SebastianBergmann\\CodeCoverage\\Driver\\PcovNotAvailableException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/PcovNotAvailableException.php',
'SebastianBergmann\\CodeCoverage\\Driver\\Selector' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Driver/Selector.php',
'SebastianBergmann\\CodeCoverage\\Driver\\WriteOperationFailedException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/WriteOperationFailedException.php',
'SebastianBergmann\\CodeCoverage\\Driver\\XdebugDriver' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Driver/XdebugDriver.php',
'SebastianBergmann\\CodeCoverage\\Driver\\XdebugNotAvailableException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/XdebugNotAvailableException.php',
'SebastianBergmann\\CodeCoverage\\Driver\\XdebugNotEnabledException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/XdebugNotEnabledException.php',
'SebastianBergmann\\CodeCoverage\\Exception' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/Exception.php',
'SebastianBergmann\\CodeCoverage\\FileCouldNotBeWrittenException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/FileCouldNotBeWrittenException.php',
'SebastianBergmann\\CodeCoverage\\Filter' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Filter.php',
'SebastianBergmann\\CodeCoverage\\InvalidArgumentException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/InvalidArgumentException.php',
'SebastianBergmann\\CodeCoverage\\NoCodeCoverageDriverAvailableException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/NoCodeCoverageDriverAvailableException.php',
'SebastianBergmann\\CodeCoverage\\NoCodeCoverageDriverWithPathCoverageSupportAvailableException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/NoCodeCoverageDriverWithPathCoverageSupportAvailableException.php',
'SebastianBergmann\\CodeCoverage\\Node\\AbstractNode' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/AbstractNode.php',
'SebastianBergmann\\CodeCoverage\\Node\\Builder' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/Builder.php',
'SebastianBergmann\\CodeCoverage\\Node\\CrapIndex' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/CrapIndex.php',
'SebastianBergmann\\CodeCoverage\\Node\\Directory' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/Directory.php',
'SebastianBergmann\\CodeCoverage\\Node\\File' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/File.php',
'SebastianBergmann\\CodeCoverage\\Node\\Iterator' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Node/Iterator.php',
'SebastianBergmann\\CodeCoverage\\ParserException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/ParserException.php',
'SebastianBergmann\\CodeCoverage\\ReflectionException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/ReflectionException.php',
'SebastianBergmann\\CodeCoverage\\ReportAlreadyFinalizedException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/ReportAlreadyFinalizedException.php',
'SebastianBergmann\\CodeCoverage\\Report\\Clover' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Clover.php',
'SebastianBergmann\\CodeCoverage\\Report\\Cobertura' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Cobertura.php',
'SebastianBergmann\\CodeCoverage\\Report\\Crap4j' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Crap4j.php',
'SebastianBergmann\\CodeCoverage\\Report\\Html\\Colors' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Colors.php',
'SebastianBergmann\\CodeCoverage\\Report\\Html\\CustomCssFile' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/CustomCssFile.php',
'SebastianBergmann\\CodeCoverage\\Report\\Html\\Dashboard' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Dashboard.php',
'SebastianBergmann\\CodeCoverage\\Report\\Html\\Directory' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer/Directory.php',
'SebastianBergmann\\CodeCoverage\\Report\\Html\\Facade' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Facade.php',
'SebastianBergmann\\CodeCoverage\\Report\\Html\\File' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php',
'SebastianBergmann\\CodeCoverage\\Report\\Html\\Renderer' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Html/Renderer.php',
'SebastianBergmann\\CodeCoverage\\Report\\PHP' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/PHP.php',
'SebastianBergmann\\CodeCoverage\\Report\\Text' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Text.php',
'SebastianBergmann\\CodeCoverage\\Report\\Thresholds' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Thresholds.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\BuildInformation' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/BuildInformation.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Coverage' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Coverage.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Directory' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Directory.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Facade' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Facade.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\File' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/File.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Method' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Method.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Node' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Node.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Project' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Project.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Report' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Report.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Source' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Source.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Tests' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Tests.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Totals' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Totals.php',
'SebastianBergmann\\CodeCoverage\\Report\\Xml\\Unit' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Report/Xml/Unit.php',
'SebastianBergmann\\CodeCoverage\\StaticAnalysisCacheNotConfiguredException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/StaticAnalysisCacheNotConfiguredException.php',
'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CacheWarmer' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/StaticAnalysis/CacheWarmer.php',
'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CachingFileAnalyser' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/StaticAnalysis/CachingFileAnalyser.php',
'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\CodeUnitFindingVisitor' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/StaticAnalysis/CodeUnitFindingVisitor.php',
'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\ExecutableLinesFindingVisitor' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/StaticAnalysis/ExecutableLinesFindingVisitor.php',
'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\FileAnalyser' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/StaticAnalysis/FileAnalyser.php',
'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\IgnoredLinesFindingVisitor' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/StaticAnalysis/IgnoredLinesFindingVisitor.php',
'SebastianBergmann\\CodeCoverage\\StaticAnalysis\\ParsingFileAnalyser' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/StaticAnalysis/ParsingFileAnalyser.php',
'SebastianBergmann\\CodeCoverage\\TestIdMissingException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/TestIdMissingException.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Known' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestSize/Known.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Large' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestSize/Large.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Medium' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestSize/Medium.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Small' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestSize/Small.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\TestSize' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestSize/TestSize.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestSize\\Unknown' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestSize/Unknown.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\Failure' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestStatus/Failure.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\Known' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestStatus/Known.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\Success' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestStatus/Success.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\TestStatus' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestStatus/TestStatus.php',
'SebastianBergmann\\CodeCoverage\\Test\\TestStatus\\Unknown' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/TestStatus/Unknown.php',
'SebastianBergmann\\CodeCoverage\\UnintentionallyCoveredCodeException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/UnintentionallyCoveredCodeException.php',
'SebastianBergmann\\CodeCoverage\\Util\\DirectoryCouldNotBeCreatedException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/DirectoryCouldNotBeCreatedException.php',
'SebastianBergmann\\CodeCoverage\\Util\\Filesystem' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Util/Filesystem.php',
'SebastianBergmann\\CodeCoverage\\Util\\Percentage' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Util/Percentage.php',
'SebastianBergmann\\CodeCoverage\\Version' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Version.php',
'SebastianBergmann\\CodeCoverage\\XmlException' => __DIR__ . '/..' . '/phpunit/php-code-coverage/src/Exception/XmlException.php',
'SebastianBergmann\\CodeUnitReverseLookup\\Wizard' => __DIR__ . '/..' . '/sebastian/code-unit-reverse-lookup/src/Wizard.php', 'SebastianBergmann\\CodeUnitReverseLookup\\Wizard' => __DIR__ . '/..' . '/sebastian/code-unit-reverse-lookup/src/Wizard.php',
'SebastianBergmann\\CodeUnit\\ClassMethodUnit' => __DIR__ . '/..' . '/sebastian/code-unit/src/ClassMethodUnit.php', 'SebastianBergmann\\CodeUnit\\ClassMethodUnit' => __DIR__ . '/..' . '/sebastian/code-unit/src/ClassMethodUnit.php',
'SebastianBergmann\\CodeUnit\\ClassUnit' => __DIR__ . '/..' . '/sebastian/code-unit/src/ClassUnit.php', 'SebastianBergmann\\CodeUnit\\ClassUnit' => __DIR__ . '/..' . '/sebastian/code-unit/src/ClassUnit.php',

Loading…
Cancel
Save