original_string: private function canRemoveSymlink($source, $target, $mode)
      {
          if (!file_exists($target)) {
              return false;
          }
  
          if (!is_link($target)
              || $this->filesystem->normalizePath($source) !== $this->filesystem->normalizePath(realpath($target))
          ) {
              if (self::INVALID_IGNORE === $mode) {
                  return false;
              }
  
              if (self::INVALID_FAIL === $mode) {
                  throw new \RuntimeException(
                      sprintf(
                          '"%s" is not a link to "%s" (expected "%s" but got "%s")',
                          $target,
                          $source,
                          $this->filesystem->normalizePath($source),
                          $this->filesystem->normalizePath(realpath($target))
                      )
                  );
              }
          }
  
          return true;
      }
code: private function canRemoveSymlink($source, $target, $mode)
      {
          if (!file_exists($target)) {
              return false;
          }
  
          if (!is_link($target)
              || $this->filesystem->normalizePath($source) !== $this->filesystem->normalizePath(realpath($target))
          ) {
              if (self::INVALID_IGNORE === $mode) {
                  return false;
              }
  
              if (self::INVALID_FAIL === $mode) {
                  throw new \RuntimeException(
                      sprintf(
                          '"%s" is not a link to "%s" (expected "%s" but got "%s")',
                          $target,
                          $source,
                          $this->filesystem->normalizePath($source),
                          $this->filesystem->normalizePath(realpath($target))
                      )
                  );
              }
          }
  
          return true;
      }
code_tokens: private function canRemoveSymlink ( $ source , $ target , $ mode ) { if ( ! file_exists ( $ target ) ) { return false ; } if ( ! is_link ( $ target ) || $ this -> filesystem -> normalizePath ( $ source ) !== $ this -> filesystem -> normalizePath ( realpath ( $ target ) ) ) { if ( self :: INVALID_IGNORE === $ mode ) { return false ; } if ( self :: INVALID_FAIL === $ mode ) { throw new \ RuntimeException ( sprintf ( '"%s" is not a link to "%s" (expected "%s" but got "%s")' , $ target , $ source , $ this -> filesystem -> normalizePath ( $ source ) , $ this -> filesystem -> normalizePath ( realpath ( $ target ) ) ) ) ; } } return true ; }
docstring: Check if the target exists, is a symlink and the symlink points to the target and therefore shall get removed.
  
  @param string $source The source path.
  
  @param string $target The target path.
  
  @param int    $mode   The invalid file handling mode.
  
  @return bool
  
  @throws \RuntimeException When a file entry is not a symlink to the expected target and mode is INVALID_FAIL.
docstring_tokens: Check if the target exists is a symlink and the symlink points to the target and therefore shall get removed .