Code Duplication    Length = 10-13 lines in 4 locations

src/Phossa2/Storage/Path.php 4 locations

@@ 109-119 (lines=11) @@
106
    /**
107
     * {@inheritDoc}
108
     */
109
    public function getContent(/*# bool */ $stream = false)
110
    {
111
        // not exists or filesystem not readable
112
        if (!$this->exists() || !$this->isFilesystemReadable()) {
113
            return null;
114
        }
115
116
        $res = $this->getFilesystem()->getDriver()->getContent($this->path, $stream);
117
        $this->copyError($this->getFilesystem()->getDriver());
118
        return $res;
119
    }
120
121
    /**
122
     * {@inheritDoc}
@@ 154-163 (lines=10) @@
151
    /**
152
     * {@inheritDoc}
153
     */
154
    public function setContent($content)/*# : bool */
155
    {
156
        if ($this->isFilesystemWritable()) {
157
            $res = $this->getFilesystem()->getDriver()
158
                ->setContent($this->path, $content);
159
            $this->copyError($this->getFilesystem()->getDriver());
160
            return $res;
161
        }
162
        return false;
163
    }
164
165
    /**
166
     * {@inheritDoc}
@@ 168-180 (lines=13) @@
165
    /**
166
     * {@inheritDoc}
167
     */
168
    public function setMeta(array $meta)/*# : bool */
169
    {
170
        if (!$this->exists()) {
171
            return false;
172
        }
173
174
        if (!empty($meta)) {
175
            $res = $this->getFilesystem()->getDriver()->setMeta($this->path, $meta);
176
            $this->copyError($this->getFilesystem()->getDriver());
177
            return $res;
178
        }
179
        return true;
180
    }
181
182
    /**
183
     * {@inheritDoc}
@@ 223-234 (lines=12) @@
220
     * @return bool
221
     * @access protected
222
     */
223
    protected function action(
224
        /*# string */ $destination,
225
        /*# string */ $action
226
    )/*# : bool */ {
227
        if (!$this->exists() || !$this->isFilesystemWritable()) {
228
            return false;
229
        }
230
231
        $res = $this->getFilesystem()->getDriver()->{$action}($this->path, $destination);
232
        $this->copyError($this->getFilesystem()->getDriver());
233
        return (bool) $res;
234
    }
235
236
    /**
237
     * Check filesystem readable or not