original_string: public function chdir($dir) {
  		$this->connectIfNeeded();
  		$this->handle->chdir($dir);
  		$this->onFolderChanged(new Event(['sender' => $this, 'data' => $dir]));
  		try {
  			$cwd = $this->pwd();
  		} catch (FtpException $ex) {
  			$cwd = $dir;	
  		}
  		return $cwd;
  	}
code: public function chdir($dir) {
  		$this->connectIfNeeded();
  		$this->handle->chdir($dir);
  		$this->onFolderChanged(new Event(['sender' => $this, 'data' => $dir]));
  		try {
  			$cwd = $this->pwd();
  		} catch (FtpException $ex) {
  			$cwd = $dir;	
  		}
  		return $cwd;
  	}
code_tokens: public function chdir ( $ dir ) { $ this -> connectIfNeeded ( ) ; $ this -> handle -> chdir ( $ dir ) ; $ this -> onFolderChanged ( new Event ( [ 'sender' => $ this , 'data' => $ dir ] ) ) ; try { $ cwd = $ this -> pwd ( ) ; } catch ( FtpException $ ex ) { $ cwd = $ dir ; } return $ cwd ; }
docstring: Changes current folder.
  
  @param string    $dir           Folder to move on (relative or absolute path).
  
  @return string Current folder on FTP server.
  
  @throws FtpException If folder deletion failed.
docstring_tokens: Changes current folder .