예제 #1
0
파일: FsKey.php 프로젝트: JeCat/framework
 public static function createKey(Folder $aFolder)
 {
     $sFlyweightKey = $aFolder->path();
     if (!($aKey = FsKey::flyweight($sFlyweightKey, false))) {
         $aKey = new FsKey($aFolder);
         FsKey::setFlyweight($aKey, $sFlyweightKey);
     }
     return $aKey;
 }
예제 #2
0
 /**
  * @return IKey 
  */
 public function key($sPath, $bAutoCreate = false)
 {
     $sKeyPath = self::transPath($sPath, false);
     $sFlyweightKey = $this->aRootFolder->path() . '/' . $sKeyPath;
     if (!($aKey = FsKey::flyweight($sFlyweightKey, false))) {
         if (!($aFolder = $this->aRootFolder->findFolder($sKeyPath, $bAutoCreate ? Folder::FIND_AUTO_CREATE : 0))) {
             return null;
         }
         $aKey = new FsKey($aFolder);
         FsKey::setFlyweight($aKey, $sFlyweightKey);
     }
     return $aKey;
 }