Esempio n. 1
0
try {
    $ret = File\Folder::dataBelongsTo('data4', $top);
} catch (\Exception $e) {
    $success = false;
}
if ($success) {
    echo "Success! Identifier: {$ret}\n";
} else {
    echo "Failure...\n";
}
echo "    Get From Path (topFolder/childFolder2) -> ";
$success = true;
unset($ret);
$ret = null;
try {
    $ret = File\Folder::getFromFolderIdentityPath($top, 'topFolder/childFolder2');
} catch (\Exception $e) {
    $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');
Esempio n. 2
0
 /**
  * Retrieve a Module using a path and a root
  * 
  * This starts at a given root Module, and then
  * parses the path (delimited by '/'s) until it reaches
  * the intended Module.  The path refers to identifiers
  * as stored in the identifier array of the actual Module
  * 
  * @param Falcraft\Data\Components\File\Resource\DirectoryInterface $rootModule The Module to begin at
  * @param string $path The path to the desired Module (this/is/a/path)
  * 
  * @return Falcraft\Data\Components\File\Module|Falcraft\Data\Types\Null A reference, null on failure
  * 
  */
 public static function &getFromModuleIdentityPath(LoaderResource\ModuleInterface $rootModule, $path)
 {
     return File\Folder::getFromFolderIdentityPath($rootModule, $path);
 }
Esempio n. 3
0
 /**
  * Take a root Folder, parse the path, and add the given Folder
  * 
  * Takes a root Folder, calls getFromFolderIdentityPath, and then adds
  * the new Folder to the resulting Folder.
  * 
  * @param Falcraft\Data\Components\File\Resource\FolderInterface $root
  * @param string $path
  * @param Falcraft\Data\Components\File\Resource\FolderInterface
  *              $newFolder
  * 
  */
 public static function addToFolderIdentityPath(FileResource\FolderInterface $root, $path, FileResource\FolderInterface $newFolder, $newFolderIdentifier = '')
 {
     $branch = Folder::getFromFolderIdentityPath($root, $path);
     $branch->addFolder($newFolder, $newFolderIdentifier);
 }