Example #1
0
 /**
  * Determine file/directory statistics for input item.
  *
  * @param DirectoryIterator $item Item passed from a DirectoryIterator
  * @return array Listing with stats
  */
 private static function _getItemStats(DirectoryIterator $item)
 {
     $list = array();
     // add filename
     $list['name'] = (string) $item;
     // add directory/file type
     $list['type'] = $item->getType();
     // add modification time
     $list['modified'] = date('Y-m-d H:i:s', $item->getMTime());
     // get permissions
     $list['permissions'] = $item->getPerms();
     // is writable?
     $list['writable'] = $item->isWritable() ? 1 : 0;
     // add path
     $list['path'] = $item->getPathName();
     $list['real_path'] = $item->getRealPath();
     // add size
     $list['size'] = Fari_Format::bytes($item->getSize());
     return $list;
 }