protected function changePermission(string $path, $mode = 0755, bool $recursively = false): void
    {
        $filesystem = $this->getContainer()['files'];

        $filesystem->chmod($path, $mode);

        if ($recursively === false) {
            return;
        }

        $lists = $filesystem->allFiles($path);

        $ignoredPath = function ($dir) {
            return (\substr($dir, -3) === '/..' || \substr($dir, -2) === '/.');
        };

        // this is to check if return value is just a single file,
        // avoiding infinite loop when we reach a file.
        if ($lists !== [$path]) {
            foreach ($lists as $dir) {
                // Not a file or folder, ignore it.
                if (! $ignoredPath($dir)) {
                    $this->changePermission($dir, $mode, true);
                }
            }
        }
    }
protected function changePermission(string $path, $mode = 0755, bool $recursively = false): void
    {
        $filesystem = $this->getContainer()['files'];

        $filesystem->chmod($path, $mode);

        if ($recursively === false) {
            return;
        }

        $lists = $filesystem->allFiles($path);

        $ignoredPath = function ($dir) {
            return (\substr($dir, -3) === '/..' || \substr($dir, -2) === '/.');
        };

        // this is to check if return value is just a single file,
        // avoiding infinite loop when we reach a file.
        if ($lists !== [$path]) {
            foreach ($lists as $dir) {
                // Not a file or folder, ignore it.
                if (! $ignoredPath($dir)) {
                    $this->changePermission($dir, $mode, true);
                }
            }
        }
    }
protected function changePermission ( string $ path , $ mode = 0755 , bool $ recursively = false ) : void { $ filesystem = $ this -> getContainer ( ) [ 'files' ] ; $ filesystem -> chmod ( $ path , $ mode ) ; if ( $ recursively === false ) { return ; } $ lists = $ filesystem -> allFiles ( $ path ) ; $ ignoredPath = function ( $ dir ) { return ( \ substr ( $ dir , - 3 ) === '/..' || \ substr ( $ dir , - 2 ) === '/.' ) ; } ; // this is to check if return value is just a single file, // avoiding infinite loop when we reach a file. if ( $ lists !== [ $ path ] ) { foreach ( $ lists as $ dir ) { // Not a file or folder, ignore it. if ( ! $ ignoredPath ( $ dir ) ) { $ this -> changePermission ( $ dir , $ mode , true ) ; } } } }
Change CHMOD permission.

@param  string  $path
@param  int  $mode
@param  bool  $recursively

@return void
Change CHMOD permission .