Code Duplication    Length = 18-18 lines in 2 locations

src/Console/Commands/Generate.php 2 locations

@@ 284-301 (lines=18) @@
281
     *
282
     * @throws FileException
283
     */
284
    private function checkRepositoryPermissions()
285
    {
286
        // Get full path of repository directory.
287
        $repositoryPath = $this->repositoryPath();
288
289
        // Get parent directory of repository path.
290
        $repositoryParentPath = $this->parentPath('repository');
291
292
        // Check parent of repository directory is writable.
293
        if (! file_exists($repositoryPath) && ! is_writable($repositoryParentPath)) {
294
            throw FileException::notWritableDirectory($repositoryParentPath);
295
        }
296
297
        // Check repository directory permissions.
298
        if (file_exists($repositoryPath) && ! is_writable($repositoryPath)) {
299
            throw FileException::notWritableDirectory($repositoryPath);
300
        }
301
    }
302
303
    /**
304
     * Check interface folder permissions.
@@ 308-325 (lines=18) @@
305
     *
306
     * @throws FileException
307
     */
308
    private function checkInterfacePermissions()
309
    {
310
        // Get full path of interface directory.
311
        $interfacePath = $this->interfacePath();
312
313
        // Get parent directory of interface path.
314
        $interfaceParentPath = $this->parentPath('interface');
315
316
        // Check parent of interface directory is writable.
317
        if (! file_exists($interfacePath) && ! is_writable($interfaceParentPath)) {
318
            throw FileException::notWritableDirectory($interfaceParentPath);
319
        }
320
321
        // Check repository directory permissions.
322
        if (file_exists($interfacePath) && ! is_writable($interfacePath)) {
323
            throw FileException::notWritableDirectory($interfacePath);
324
        }
325
    }
326
327
    private function createFolder($folder)
328
    {