Well those seem like methods that have a specific responsibility not getter and setters for a property. It may be worth while to use a interface in this instance. Seems like you have the methods together to do so and using interfaces would offer increased flexibility without using inheritance.
Code:
interface IUpload {
public function processIncomingFile();
public function saveFileToDatabase();
}
interface IDownload {
public function getFileFromDatabase();
public function downloadFileToBrowser();
}
interface IDisplay {
public function getImageFromDatabase();
public function displayImage();
}
Now if something is only able to be downloaded you just have that class implement IDwonload. However, if something is able to downloaded, uploaded and displayed you can just as easily implement all three.
Code:
class Movie implements IUpload,IDisplay {
public function processIncomingFile() { }
public function saveFileToDatabase() { }
public function getImageFromDatabase() { }
public function displayImage() { }
}
class Resume implements IUpload,IDownload,IDisplay {
public function processIncomingFile() { }
public function saveFileToDatabase() { }
public function getImageFromDatabase() { }
public function displayImage() { }
}
At the same time you could create a abstract class that implements all three and defines a common implementation. Then if you needed to you could override specific methods in sub classes to change the implementation. However, regardless of what you do they will all look the same and be able to be used the same way.
Code:
abstract class File implements IUpload,IDownload,IDisplay {
public function processIncomingFile() { }
public function saveFileToDatabase() { }
public function getFileFromDatabase() { }
public function downloadFileToBrowser() { }
public function getImageFromDatabase() { }
public function displayImage() { }
}
Bookmarks