-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathActionMovie.php
More file actions
27 lines (22 loc) · 767 Bytes
/
Copy pathActionMovie.php
File metadata and controls
27 lines (22 loc) · 767 Bytes
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
<?php
namespace App\Behavioral\TemplateMethod;
class ActionMovie extends Movie
{
public const AVAILABLE_DIRECTORS = ['Michael Bay', 'James Cameron', 'Steven Spielberg'];
public const AVAILABLE_ACTORS = ['Sylvester Stallone', 'Bruce Willis', 'Al Pacino', 'Arnold Schwarzenegger'];
public const NUM_ROLES = 2;
protected function raiseMoney(): void
{
$this->budget = 100000;
}
protected function castActors(): void
{
foreach (array_rand(self::AVAILABLE_ACTORS, self::NUM_ROLES) as $actor) {
$this->cast[] = self::AVAILABLE_ACTORS[$actor];
}
}
protected function castDirector(): void
{
$this->director = self::AVAILABLE_DIRECTORS[array_rand(self::AVAILABLE_DIRECTORS)];
}
}