| @@ 26-39 (lines=14) @@ | ||
| 23 | * @return $this |
|
| 24 | * @throws Nip_File_Exception |
|
| 25 | */ |
|
| 26 | public function move($target) |
|
| 27 | {
|
|
| 28 | $dir = dirname($target); |
|
| 29 | if (!is_dir($target)) {
|
|
| 30 | mkdir($dir, 0755, true); |
|
| 31 | } |
|
| 32 | ||
| 33 | if (rename($this->getPath(), $target)) {
|
|
| 34 | $this->setPath($target); |
|
| 35 | } else {
|
|
| 36 | throw new Nip_File_Exception("Cannot move $this->_path file to $target");
|
|
| 37 | } |
|
| 38 | return $this; |
|
| 39 | } |
|
| 40 | ||
| 41 | public function getPath() |
|
| 42 | {
|
|
| @@ 59-72 (lines=14) @@ | ||
| 56 | * @return $this |
|
| 57 | * @throws Nip_File_Exception |
|
| 58 | */ |
|
| 59 | public function copy($target) |
|
| 60 | {
|
|
| 61 | $dir = dirname($target); |
|
| 62 | if (!is_dir($target)) {
|
|
| 63 | mkdir($dir, 0755, true); |
|
| 64 | } |
|
| 65 | ||
| 66 | if (copy($this->getPath(), $target)) {
|
|
| 67 | $this->setPath($target); |
|
| 68 | } else {
|
|
| 69 | throw new Nip_File_Exception("Cannot copy $this->_path file to $target");
|
|
| 70 | } |
|
| 71 | return $this; |
|
| 72 | } |
|
| 73 | ||
| 74 | /** |
|
| 75 | * @param string $target |
|