示例#1
0
    $success = false;
}
if ($success) {
    echo "Success! Identifier: {$ret->getIdentifier()}\n";
} else {
    echo "Failure...\n";
}
unset($ret);
echo "    Add To Folder Identity Path (data5, grandchild2) -- \n";
$success = true;
$granchild2 = null;
try {
    echo "        Instantiate grandchild2 -> ";
    $grandchild2 = new File\Folder('data5', 'grandchild2');
    echo "Success!\n";
    echo "        Add to Path (topFolder/childFolder2) -> ";
    File\Folder::addToFolderIdentityPath($top, 'topFolder/childFolder2', $grandchild2, $grandchild2->getIdentifier());
} catch (\Exception $e) {
    $success = false;
}
if ($success) {
    echo "Success!\n\n";
} else {
    echo "Failure...\n\n";
}
$paths = File\Folder::getFolderIdentityPaths($top);
echo "Paths: \n";
foreach ($paths as $path) {
    echo "    {$path}\n";
}
echo "\n";
示例#2
0
 /**
  * Returns a Module path that contains the path
  * 
  * Okay, this returns a Module path to the Module that contains the associated path
  * 
  * @param $path The path to find (NOT Modulepath)
  * @param Falcraft\Data\Components\File\Resource\DirectoryInterface $rootModule - The root of the Module
  * @param string $ModuleKey Recursive function argument, don't use
  * @param Falcraft\Data\Components\File\Resource\DirectoryInterface $Module Recursive function argument, don't use
  * 
  */
 public static function pathBelongsTo($path, LoaderResource\ModuleInterface $rootModule, $moduleKey = '', $module = null)
 {
     return File\Folder::dataBelongsTo($path, $rootModule, $moduleKey, $module);
 }
示例#3
0
 /**
  * Returns a folder path that contains the data
  * 
  * NOTE: Only returns the first instance it finds
  * 
  * Okay, this returns a folder path to the folder that contains the
  * associated data
  * 
  * @param $data The data to find (NOT CDirectorypath)
  * @param Falcraft\Data\Components\File\Resource\DirectoryInterface
  *              $root The root of the CDirectory
  * @param string $recurseKey Recursive function argument, don't use
  * @param Falcraft\Data\Components\File\Resource\FolderInterface
  *              $recurseFolder Recursive function argument, don't use
  * 
  */
 public static function dataBelongsTo($data, FileResource\FolderInterface $root, $recurseKey = '', $recurseFolder = null)
 {
     static $folderNames;
     if ($recurseFolder) {
         if ($recurseFolder->isData($data)) {
             $folderNames = $recurseKey;
             return true;
         }
         foreach ($recurseFolder->getFolders() as $folderName => $folderValue) {
             if (Folder::dataBelongsTo($data, $root, $folderName, $folderValue)) {
                 $folderNames = $recurseKey . '/' . $folderNames;
                 return true;
             }
         }
         return false;
     } else {
         $folderNames = '';
         foreach ($root->getFolders() as $folderKey => $folderValue) {
             Folder::dataBelongsTo($data, $root, $folderKey, $folderValue);
         }
         $folderNames = $root->getIdentifier() . '/' . $folderNames;
         return $folderNames;
     }
 }