-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRole.php
60 lines (45 loc) · 1.22 KB
/
Role.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
class Role {
private string $nomPersonnage;
private array $castings;
public function __construct(string $nomPersonnage)
{
$this->nomPersonnage = $nomPersonnage;
$this->castings = [];
}
// getters n setters
public function getNomPersonnage():string
{
return $this->nomPersonnage;
}
public function setNomPersonnage($nomPersonnage)
{
$this->nomPersonnage = $nomPersonnage;
return $this;
}
public function getCastings()
{
return $this->castings;
}
public function setCastings($castings)
{
$this->castings = $castings;
return $this;
}
//end of getters n setters
//function toString
public function __toString()
{
return $this->nomPersonnage." ";
}
public function addCasting(Casting $casting){
$this->castings[] = $casting;
}
public function displayActeurs(){
$result = "<b>Les acteurs ayant joué le rôle de $this :</b><br>";
foreach($this->castings as $casting) {
$result .= $casting->getActeur()." dans le ".$casting->getfilm()."<br>";
}
return $result;
}
}