Beispiel #1
0
}
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 "    Retrieve As Array (root topFolder) -> ";
$success = true;
$folders = null;
try {
    $folders = File\Folder::getAsArray($top);
} catch (\Exception $e) {
    $success = false;
}
if ($success) {
    echo "Success!\n\n";
} else {
    echo "Failure...\n\n";
}
var_dump($folders);
echo "\n    Retrieve Using Data (data2) -> ";
$success = true;
$ret = null;
try {
    $ret = File\Folder::dataBelongsTo('data2', $top);
} catch (\Exception $e) {
Beispiel #2
0
 /**
  * Return Modules structure from root as array
  * 
  * See above, does the reverse.  This is a good way
  * to see how the above is formatted.
  * 
  * @param Falcraft\Data\Components\File\Resource\DirectoryInterface $rootModule The root to start at
  * 
  * @return array
  * 
  */
 public static function getAsArray(LoaderResource\ModuleInterface $rootModule)
 {
     return File\Folder::getAsArray($rootModule);
 }
Beispiel #3
0
 /**
  * Return Folder structure from root as array
  * 
  * See above, does the reverse.  This is a good way
  * to see how the above is formatted.
  * 
  * @param Falcraft\Data\Components\File\Resource\DirectoryInterface
  *              $root The root to start at
  * 
  * @return array
  * 
  */
 public static function getAsArray(FileResource\FolderInterface $root)
 {
     if (!$root->getFolders()) {
         return array('data' => $root->getData(), 'folders' => array());
     }
     $ret = array();
     foreach ($root->getFolders() as $folder) {
         $ret['data'] = $root->getData();
         $ret['folders'][$folder->getIdentifier()] = Folder::getAsArray($folder);
     }
     return $ret;
 }