Example #1
0
 /**
  * Initializes the Singleton instance.
  */
 private static function init()
 {
     if (!isset(self::$instance)) {
         self::$instance = new File();
     }
     return self::$instance;
 }
Example #2
0
 /**
  *	得到本类实例
  *
  *	@return Ambiguous
  */
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new File();
     }
     return self::$instance;
 }
Example #3
0
 /**
  * Class destructor
  */
 public final function __destruct()
 {
     try {
         self::$instance = NULL;
     } catch (Exception $e) {
         // can't throw exceptions in __destruct
     }
 }
Example #4
0
 public static function getInstance()
 {
     if (!self::$instance) {
         $file_system = Yaf_Registry::get('config')->file->file_system;
         if (!empty($file_system) && file_exists(dirname(__FILE__) . '/' . $file_system . '.php')) {
             Yaf_Loader::import(dirname(__FILE__) . '/' . $file_system . '.php');
             self::$instance = new $file_system();
         }
     }
     return self::$instance;
 }
Example #5
0
 public static function forge($path, array $config = array(), File_Area $area = null, $content = array())
 {
     $obj = new static($path, $config, \File::instance($area), $content);
     $config['path'] = $path;
     $config['area'] = $area;
     foreach ($config as $key => $value) {
         if (property_exists($obj, $key) && empty($obj->{$key})) {
             $obj->{$key} = $value;
         }
     }
     return $obj;
 }
Example #6
0
 /**
  * 通过文件操作对象实例化Model
  * @param $file
  * @return Model
  */
 public static function file($file)
 {
     return new self($file, File::instance());
 }