Czy istnieje możliwość stworzenia metody, która zwraca zmienną jaką chcemy?
Z czegoś takiego
public function getId(){
return $this->id;
}
public function getTitle(){
return $this->title;
}
public function getContent(){
return $this->content;
}
na
public function get($varName){
return $this->$varName;
}
Wiem, że można to zrobić instrukcjami if, ale może jest jakiś lepszy sposób.