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:
62
Kapitel_4/Lektion_3/1_objekte_kommunizieren.php
Normal file
62
Kapitel_4/Lektion_3/1_objekte_kommunizieren.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
class Foto
|
||||
{
|
||||
private $dateiname;
|
||||
|
||||
private $tags = 'Natur';
|
||||
|
||||
public function __construct($dateiname)
|
||||
{
|
||||
$this->dateiname = $dateiname;
|
||||
}
|
||||
|
||||
public function getTags()
|
||||
{
|
||||
return $this->tags;
|
||||
}
|
||||
|
||||
public function setTags($tags)
|
||||
{
|
||||
$this->tags = $tags;
|
||||
}
|
||||
|
||||
public function getDateiname()
|
||||
{
|
||||
return $this->dateiname;
|
||||
}
|
||||
|
||||
public function skaliere($maxAbmessung)
|
||||
{
|
||||
$this->loadFile();
|
||||
// image...
|
||||
$this->saveFile();
|
||||
}
|
||||
|
||||
private function loadFile()
|
||||
{
|
||||
// ...
|
||||
}
|
||||
|
||||
private function saveFile()
|
||||
{
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
class Datenbank
|
||||
{
|
||||
public function speichere(Foto $objekt)
|
||||
{
|
||||
$dateiname = $objekt->getDateiname();
|
||||
$tags = $objekt->getTags();
|
||||
|
||||
// Daten in MySQL speichern
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
$foto1 = new Foto('1.jpg');
|
||||
$db = new Datenbank();
|
||||
|
||||
$db->speichere($foto1);
|
||||
Reference in New Issue
Block a user