Code Duplication    Length = 15-15 lines in 2 locations

legacy/File.php 2 locations

@@ 20-34 (lines=15) @@
17
        }
18
    }
19
20
    public function move($target)
21
    {
22
        $dir = dirname($target);
23
        if (!is_dir($target)) {
24
            mkdir($dir, 0755, true);
25
        }
26
27
        if (rename($this->getPath(), $target)) {
28
            $this->setPath($target);
29
        } else {
30
            throw new Nip_File_Exception("Cannot move $this->_path file to $target");
31
        }
32
33
        return $this;
34
    }
35
36
    public function copy($target)
37
    {
@@ 36-50 (lines=15) @@
33
        return $this;
34
    }
35
36
    public function copy($target)
37
    {
38
        $dir = dirname($target);
39
        if (!is_dir($target)) {
40
            mkdir($dir, 0755, true);
41
        }
42
43
        if (copy($this->getPath(), $target)) {
44
            $this->setPath($target);
45
        } else {
46
            throw new Nip_File_Exception("Cannot copy $this->_path file to $target");
47
        }
48
49
        return $this;
50
    }
51
52
    /**
53
     * @param string $target