/** * @param <samp>File</samp>, <samp>URL</samp> or <samp>string</samp> * @param string * @throws IOException */ protected function open($file, $mode) { try { $this->fd = fopen(File::valueOf($file)->toString(), $mode); } catch (PHPException $e) { $e->rethrow('IOException', 'fopen'); } }
/** * @param mixed string or <samp>File</samp> * @param bool * @param int * @param bool * @param string Filename match filter of files to skip. Only applies to recursive copy. * @return void * @throws IllegalArgumentException on protocol mismatch * @throws IOException */ public function copyTo($where, $recursive = false, $recDirMode = 0775, $recOverwrite = false, $excludeFilter = null) { $where = File::valueOf($where); $from = $this->toString(); $to = $where->toString(); try { if (!$recursive) { copy($from, $to); } else { if ($this->isDir()) { if (!$where->exists()) { $where->mkdirs($recDirMode); } $from = rtrim($from, '/'); $to = rtrim($to, '/'); $this->_copyDir($from, $to, $recOverwrite, $recDirMode, $excludeFilter); } else { try { $where->getParent()->mkdirs($recDirMode); } catch (Exception $e) { } copy($from, $to); } } } catch (PHPException $e) { throw new IOException($e, 'Copy failed'); } }