original_string: 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);
                  }
              }
          }
      }
code: 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);
                  }
              }
          }
      }
code_tokens: 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 ) ; } } } }
docstring: Change CHMOD permission.
  
  @param  string  $path
  @param  int  $mode
  @param  bool  $recursively
  
  @return void
docstring_tokens: Change CHMOD permission .