Completed
Push — ezp25676-flysystem_1_x_update ( 31e494...f57e3a )
by
unknown
39:00 queued 12:14
created

LocalAdapterFactory::setDirectoriesPermissions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 9.4285
1
<?php
2
/**
3
 * This file is part of the ezplatform package.
4
 *
5
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
6
 * @license For full copyright and license information view LICENSE file distributed with this source code.
7
 */
8
namespace eZ\Bundle\EzPublishIOBundle\DependencyInjection\Factory;
9
10
use League\Flysystem\Adapter\Local;
11
12
/**
13
 * Builds a Local Flysystem Adapter instance with the given permissions configuration.
14
 */
15
class LocalAdapterFactory
16
{
17
    /**
18
     * @param string $rootDir
19
     * @param int $filesPermissions Permissions used when creating files. Example: 0640.
20
     * @param int $directoriesPermissions Permissions when creating directories. Example: 0750.
21
     * @return Local
22
     */
23
    public function build($rootDir, $filesPermissions, $directoriesPermissions)
24
    {
25
        return new Local(
26
            $rootDir,
27
            LOCK_EX,
28
            Local::DISALLOW_LINKS,
29
            ['file' => ['public' => $filesPermissions], 'dir' => ['public' => $directoriesPermissions]]
30
        );
31
    }
32
}
33