Code Duplication    Length = 15-16 lines in 2 locations

src/Backup/Collector.php 1 location

@@ 106-120 (lines=15) @@
103
     * @param  string $path
104
     * @param  int    $time
105
     */
106
    protected function setPath($path, $time = null)
107
    {
108
        // remove trailing slashes
109
        $path                  = rtrim($path, DIRECTORY_SEPARATOR);
110
        $this->pathRaw         = $path;
111
        $this->pathNotChanging = $path;
112
113
        if (Util\Path::isContainingPlaceholder($path)) {
114
            $this->detectPathNotChanging($path);
115
            // replace potential date placeholder
116
            $path = Util\Path::replaceDatePlaceholders($path, $time);
117
        }
118
119
        $this->path = $path;
120
    }
121
122
    /**
123
     * Find path elements that can't change because of placeholder usage.

src/Backup/Target.php 1 location

@@ 146-161 (lines=16) @@
143
     * @param  string $path
144
     * @param  int    $time
145
     */
146
    public function setPath($path, $time = null)
147
    {
148
        // remove trailing slashes
149
        $path                  = rtrim($path, DIRECTORY_SEPARATOR);
150
        $this->pathRaw         = $path;
151
        $this->pathNotChanging = $path;
152
153
        if (Util\Path::isContainingPlaceholder($path)) {
154
            $this->pathIsChanging = true;
155
            $this->detectPathNotChanging($path);
156
            // replace potential date placeholder
157
            $path = Util\Path::replaceDatePlaceholders($path, $time);
158
        }
159
160
        $this->path = $path;
161
    }
162
163
    /**
164
     * Return path element at given index.