<?php
class FileHandler {
private static $_instance = null;
private function __construct() {
// restrict access to the constructor
}
public static function getInstance() {
if ( is_null ( self::$_instance ) ) {
self::$_instance = new self();
}
return self::$_instance;
}
/**
* Convenience function for testing.
* Clears the current instance so that it can be reinstantiated rather
* than retrieving the existing instance. Helpful when testing new
* properties, etc.
*/
public function clear() {
self::$_instance = null;
}
public function save ( $rootPath, $source, $fileName, $isTemporary ) {
...
}
public function delete ( $file ) {
...
}
protected function getBinDir() {
return chr ( ( rand ( 0, 25 ) ) + 97 );
}
public function checkFileSize ( $file, $max ) {
...
}
}
?>