Issues (32)

System/FoldersPermissionsComposer.php (2 issues)

Labels
Severity
1
<?php namespace Arcanesoft\Foundation\ViewComposers\System;
2
3
use Illuminate\View\View;
0 ignored issues
show
The type Illuminate\View\View was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
4
5
/**
6
 * Class     FoldersPermissionsComposer
7
 *
8
 * @package  Arcanesoft\Foundation\ViewComposers\System
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class FoldersPermissionsComposer
12
{
13
    /* -----------------------------------------------------------------
14
     |  Constants
15
     | -----------------------------------------------------------------
16
     */
17
18
    const VIEW = 'foundation::admin.system.information._includes.folders-permissions';
19
20
    /* -----------------------------------------------------------------
21
     |  Main Methods
22
     | -----------------------------------------------------------------
23
     */
24
25
    /**
26
     * Compose the view.
27
     *
28
     * @param  \Illuminate\View\View  $view
29
     */
30
    public function compose(View $view)
31
    {
32
        $view->with('permissions', $this->prepare([
33
            'storage/app/',
34
            'storage/framework/',
35
            'storage/logs/',
36
            'bootstrap/cache/',
37
        ]));
38
    }
39
40
    /* -----------------------------------------------------------------
41
     |  Other Methods
42
     | -----------------------------------------------------------------
43
     */
44
45
    /**
46
     * Prepare the permissions.
47
     *
48
     * @param  array  $folders
49
     *
50
     * @return \Illuminate\Support\Collection
51
     */
52
    private function prepare(array $folders)
53
    {
54
        return collect($folders)->mapWithKeys(function ($folder) {
55
            $path = base_path($folder);
0 ignored issues
show
The function base_path was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

55
            $path = /** @scrutinizer ignore-call */ base_path($folder);
Loading history...
56
57
            return [
58
                $folder => [
59
                    'chmod'    => (int) substr(sprintf('%o', fileperms($path)), -4),
60
                    'writable' => is_writable($path),
61
                ],
62
            ];
63
        });
64
    }
65
}
66