original_string: public function rm(string $fileOrDirectory, array $options = []): SystemService
      {
          $options = array_replace(
              [
                  'force'                 => false,
                  'recursive'             => false,
                  'context'               => null,
                  'skipIfAlreadyRemoved'  => true
              ],
              $options
          );
  
          if (!file_exists($fileOrDirectory) && $options['skipIfAlreadyRemoved']) {
              return $this;
          }
  
          $args = [
              $fileOrDirectory
          ];
  
          if ($options['context'] !== null) {
              $args[] = $options['context'];
          }
  
          if (is_dir($fileOrDirectory) && !is_link($fileOrDirectory)) {
              if (!$options['force']) {
                  throw CantRemoveDirectoryException::create(
                      '"' . $fileOrDirectory . '" is a directory. If you really want to remove it, ' .
                      'set the "force" option to "true".'
                  );
              }
  
              if ($options['recursive']) {
                  $elements = $this->scandir(
                      $fileOrDirectory,
                      [
                          'recursive'         => true,
                          'context'           => $options['context'],
                          'skipDots'          => true,
                          'skipSymlinks'      => true
                      ]
                  );
  
                  foreach ($elements as $e) {
                      $this->rm($e, $options);
                  }
              }
  
              if (!@rmdir(...$args)) {
                  throw IOException::create(
                      'Couldn\'t remove directory "'.$fileOrDirectory.'". Last PHP Error: '.
                      print_r($this->getLastPhpError(), true)
                  );
              }
          } else if (!@unlink(...$args)) {
              throw IOException::create(
                  'Couldn\'t remove file or symlink "'.$fileOrDirectory.'". Last PHP Error: '.
                  print_r($this->getLastPhpError(), true)
              );
          }
  
          return $this;
      }
code: public function rm(string $fileOrDirectory, array $options = []): SystemService
      {
          $options = array_replace(
              [
                  'force'                 => false,
                  'recursive'             => false,
                  'context'               => null,
                  'skipIfAlreadyRemoved'  => true
              ],
              $options
          );
  
          if (!file_exists($fileOrDirectory) && $options['skipIfAlreadyRemoved']) {
              return $this;
          }
  
          $args = [
              $fileOrDirectory
          ];
  
          if ($options['context'] !== null) {
              $args[] = $options['context'];
          }
  
          if (is_dir($fileOrDirectory) && !is_link($fileOrDirectory)) {
              if (!$options['force']) {
                  throw CantRemoveDirectoryException::create(
                      '"' . $fileOrDirectory . '" is a directory. If you really want to remove it, ' .
                      'set the "force" option to "true".'
                  );
              }
  
              if ($options['recursive']) {
                  $elements = $this->scandir(
                      $fileOrDirectory,
                      [
                          'recursive'         => true,
                          'context'           => $options['context'],
                          'skipDots'          => true,
                          'skipSymlinks'      => true
                      ]
                  );
  
                  foreach ($elements as $e) {
                      $this->rm($e, $options);
                  }
              }
  
              if (!@rmdir(...$args)) {
                  throw IOException::create(
                      'Couldn\'t remove directory "'.$fileOrDirectory.'". Last PHP Error: '.
                      print_r($this->getLastPhpError(), true)
                  );
              }
          } else if (!@unlink(...$args)) {
              throw IOException::create(
                  'Couldn\'t remove file or symlink "'.$fileOrDirectory.'". Last PHP Error: '.
                  print_r($this->getLastPhpError(), true)
              );
          }
  
          return $this;
      }
code_tokens: public function rm ( string $ fileOrDirectory , array $ options = [ ] ) : SystemService { $ options = array_replace ( [ 'force' => false , 'recursive' => false , 'context' => null , 'skipIfAlreadyRemoved' => true ] , $ options ) ; if ( ! file_exists ( $ fileOrDirectory ) && $ options [ 'skipIfAlreadyRemoved' ] ) { return $ this ; } $ args = [ $ fileOrDirectory ] ; if ( $ options [ 'context' ] !== null ) { $ args [ ] = $ options [ 'context' ] ; } if ( is_dir ( $ fileOrDirectory ) && ! is_link ( $ fileOrDirectory ) ) { if ( ! $ options [ 'force' ] ) { throw CantRemoveDirectoryException :: create ( '"' . $ fileOrDirectory . '" is a directory. If you really want to remove it, ' . 'set the "force" option to "true".' ) ; } if ( $ options [ 'recursive' ] ) { $ elements = $ this -> scandir ( $ fileOrDirectory , [ 'recursive' => true , 'context' => $ options [ 'context' ] , 'skipDots' => true , 'skipSymlinks' => true ] ) ; foreach ( $ elements as $ e ) { $ this -> rm ( $ e , $ options ) ; } } if ( ! @ rmdir ( ... $ args ) ) { throw IOException :: create ( 'Couldn\'t remove directory "' . $ fileOrDirectory . '". Last PHP Error: ' . print_r ( $ this -> getLastPhpError ( ) , true ) ) ; } } else if ( ! @ unlink ( ... $ args ) ) { throw IOException :: create ( 'Couldn\'t remove file or symlink "' . $ fileOrDirectory . '". Last PHP Error: ' . print_r ( $ this -> getLastPhpError ( ) , true ) ) ; } return $ this ; }
docstring: Removes a file, symlink or directory. It removes directories, if option "force" is true.
  If it's a directory and option "force" is false, it throws an exception.
  Also, it removes directories recursively. If file, symlink or directory already does not
  exist, it does NOT throw an exception.
  
  Options:
  
  - force:         If $fileOrDirectory is a directory, you need to set this option to "true"
  to be able to remove it. By default, it's set to "false".
  - recursive:     If this option is "true" and $fileOrDirectory is a directory, then we'll
  traverse it and remove every file and directory found on it as well. By
  default, it's set to "false".
  
  @param string $fileOrDirectory - File, symlink or directory.
  @param array  $options         - Options.
  
  @throws IOException
  
  @return SystemService
docstring_tokens: Removes a file symlink or directory . It removes directories if option force is true . If it s a directory and option force is false it throws an exception . Also it removes directories recursively . If file symlink or directory already does not exist it does NOT throw an exception .