- public function readINI($path)
- {
- if (file_exists($path))
- {
- $ini = parse_ini_file($path);
- foreach ($ini as $key => $value)
- {
- $this->set($key, $value);
- }
- }
- else
- {
- throw new FW_Exception("Die ini-Datei existiert nicht!");
- }
- }
Ich lese jetzt schon eine Weile dein schönes MVC-Tutorial und sehe dabei immer Codekonstrukte, die du vielleicht einfach umdrehen kannst. Ein Beispiel aus der Config-Klasse:
Das kannst du einfacher so schreiben und es ist mindestens genauso verständlich.
- if (!file_exists($path))
- {
- throw new FW_Exception("Die ini-Datei existiert nicht!");
- }
- $ini = parse_ini_file($path);
- foreach ($ini as $key => $value)
- {
- $this->set($key, $value);
- }
Vielleicht ist das für dich von Interesse.
