mirror of
https://github.com/janunger/rheinwerk-video-training.git
synced 2026-02-06 07:05:14 +01:00
Initiale Version
This commit is contained in:
6
Kapitel_4/Lektion_9/autoload.php
Normal file
6
Kapitel_4/Lektion_9/autoload.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
spl_autoload_register(function ($klassenname) {
|
||||
$klassenpfad = str_replace('\\', '/', $klassenname);
|
||||
require __DIR__ . '/src/' . $klassenpfad . '.php';
|
||||
});
|
||||
9
Kapitel_4/Lektion_9/index.php
Normal file
9
Kapitel_4/Lektion_9/index.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
require __DIR__ . '/autoload.php';
|
||||
|
||||
$autoFactoryService = new AutoFactory();
|
||||
|
||||
$auto1 = $autoFactoryService->baueAuto();
|
||||
$auto2 = $autoFactoryService->baueAuto();
|
||||
$auto3 = $autoFactoryService->baueAuto();
|
||||
8
Kapitel_4/Lektion_9/src/Auto.php
Normal file
8
Kapitel_4/Lektion_9/src/Auto.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
class Auto
|
||||
{
|
||||
public function __construct(Motor $motor, Getriebe $getriebe)
|
||||
{
|
||||
}
|
||||
}
|
||||
12
Kapitel_4/Lektion_9/src/AutoFactory.php
Normal file
12
Kapitel_4/Lektion_9/src/AutoFactory.php
Normal file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
class AutoFactory
|
||||
{
|
||||
public function baueAuto()
|
||||
{
|
||||
$motor = new Motor();
|
||||
$getriebe = new Getriebe();
|
||||
|
||||
return new Auto($motor, $getriebe);
|
||||
}
|
||||
}
|
||||
6
Kapitel_4/Lektion_9/src/Getriebe.php
Normal file
6
Kapitel_4/Lektion_9/src/Getriebe.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
class Getriebe
|
||||
{
|
||||
|
||||
}
|
||||
6
Kapitel_4/Lektion_9/src/Motor.php
Normal file
6
Kapitel_4/Lektion_9/src/Motor.php
Normal file
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
|
||||
class Motor
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user