$this->_tmp = array();
}
- public function copy($from, $to)
+ public function copy($from, $to, $prepend = false)
{
if (!file_exists($from)) {
throw new \Exception(sprintf('File %s doesn\'t exist (to %s)', $from, $to));
if (!$realto) {
return $this;
}
- $this->_copy[$realto] = $from;
+ if ($prepend) {
+ $this->_copy = array_merge([$realto => $from], $this->_copy);
+ } else {
+ $this->_copy[$realto] = $from;
+ }
return $this;
}
if (!$path) {
continue;
}
- $this->copy($path, $this->relativePath($to) . '/' . ltrim($dest, '/'));
+ $this->copy($path, $this->relativePath($to) . '/' . ltrim($dest, '/'), true);
}
}