1abstract class AbstractDonater
2{
3 public function donateMinimum(): void
4 {
5 // this method can be complex
6 $minimum = 10;
7 $this->donate($minimum)
8 }
9 abstract protected function donate(int $money);
10}
11
12class ConcreteDonaterOne
13{
14 protected function donate(int $money)
15 {
16 $donateProvider = new PlayPal();
17 $donateProvider->pay($money);
18 }
19}
20
21class ConcreteDonaterTwo
22{
23 protected function donate(int $money)
24 {
25 $donateProvider = new Scribe();
26 $donateProvider->transfer($money);
27 }
28}
29$donaters = [
30 new ConcreteDonaterOne(),
31 new ConcreteDonaterTwo(),
32
33];
34
35foreach ($donaters as $donater)
36{
37 $donater->donateMinimum();
38}
39