Code Duplication    Length = 13-14 lines in 2 locations

src/Charcoal/Loader/FileLoader.php 1 location

@@ 113-126 (lines=14) @@
110
     * @throws InvalidArgumentException If the base path parameter is not a string.
111
     * @return self
112
     */
113
    public function setBasePath($basePath)
114
    {
115
        if (!is_string($basePath)) {
116
            throw new InvalidArgumentException(
117
                'Base path must be a string'
118
            );
119
        }
120
121
        $basePath = realpath($basePath);
122
123
        $this->basePath = rtrim($basePath, '/\\').DIRECTORY_SEPARATOR;
124
125
        return $this;
126
    }
127
128
    /**
129
     * Returns the content of the first file found in search path.

src/Charcoal/Model/Service/MetadataLoader.php 1 location

@@ 224-236 (lines=13) @@
221
     * @throws InvalidArgumentException If the base path parameter is not a string.
222
     * @return self
223
     */
224
    private function setBasePath($basePath)
225
    {
226
        if (!is_string($basePath)) {
227
            throw new InvalidArgumentException(
228
                'Base path must be a string'
229
            );
230
        }
231
232
        $basePath = realpath($basePath);
233
        $this->basePath = rtrim($basePath, '/\\').DIRECTORY_SEPARATOR;
234
235
        return $this;
236
    }
237
238
    /**
239
     * Retrieve the base path for relative search paths.