1 | <?php |
||
12 | class EngagementService |
||
13 | { |
||
14 | /** |
||
15 | * Initialisation du service avec les repository utilisés. |
||
16 | * |
||
17 | * @param SDIS62\Core\Ops\Repository\EngagementRepositoryInterface $engagement_repository |
||
18 | * @param SDIS62\Core\Ops\Repository\MaterielRepositoryInterface $intervention_repository |
||
19 | * @param SDIS62\Core\Ops\Repository\InterventionRepositoryInterface $intervention_repository |
||
20 | * @param SDIS62\Core\Ops\Repository\PompierRepositoryInterface $pompier_repository |
||
21 | */ |
||
22 | public function __construct(EngagementRepositoryInterface $engagement_repository, |
||
32 | |||
33 | /** |
||
34 | * Retourne un engagement correspondant à l'id spécifié. |
||
35 | * |
||
36 | * @param mixed $id_engagement |
||
37 | * |
||
38 | * @return SDIS62\Core\Ops\Entity\Engagement |
||
39 | */ |
||
40 | public function find($id_engagement) |
||
44 | |||
45 | /** |
||
46 | * Retourne les engagements se trouvant dans un rayon de 500m (par défaut) des coordonnées. |
||
47 | * |
||
48 | * @param float $lat |
||
49 | * @param float $lon |
||
50 | * @param int $distance |
||
51 | * |
||
52 | * @return SDIS62\Core\Ops\Entity\Engagement[] |
||
53 | */ |
||
54 | public function findAllByDistance($lat, $lon, $distance = 500) |
||
58 | |||
59 | /** |
||
60 | * Sauvegarde d'un engagement. |
||
61 | * |
||
62 | * @param array $data |
||
63 | * @param array $id_engagement Optionnel |
||
64 | * |
||
65 | * @return SDIS62\Core\Ops\Entity\Engagement |
||
66 | */ |
||
67 | public function save($data, $id_engagement = null) |
||
91 | |||
92 | /** |
||
93 | * Suppression d'un engagement. |
||
94 | * |
||
95 | * @param mixed $id_engagement |
||
96 | * |
||
97 | * @return SDIS62\Core\Ops\Entity\Engagement |
||
98 | */ |
||
99 | public function delete($id_engagement) |
||
111 | } |
||
112 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: