diff --git a/plugin/php-refactoring-toolbox.vim b/plugin/php-refactoring-toolbox.vim index ef2b9eb..e4245df 100644 --- a/plugin/php-refactoring-toolbox.vim +++ b/plugin/php-refactoring-toolbox.vim @@ -181,7 +181,11 @@ function! PhpExtractClassProperty() " {{{ normal mr let l:name = expand('') call s:PhpReplaceInCurrentFunction('$' . l:name . '\>', '$this->' . l:name) - call s:PhpInsertProperty(l:name, "private") + let l:visibility = inputdialog("Visibility (default is private): ") + if empty(l:visibility) + let l:visibility = 'private' + endif + call s:PhpInsertProperty(l:name, l:visibility) normal `r endfunction " }}} @@ -192,6 +196,10 @@ function! PhpExtractMethod() range " {{{ return endif let l:name = inputdialog("Name of new method: ") + let l:visibility = inputdialog("Visibility (default is private): ") + if empty(l:visibility) + let l:visibility = 'private' + endif normal gv"xdmr let l:middleLine = line('.') call search(s:php_regex_func_line, 'bW') @@ -230,14 +238,18 @@ function! PhpExtractMethod() range " {{{ exec "normal! Olist(" . join(l:output, ", ") . ") = $this->" . l:name . "(" . join(l:parameters, ", ") . ");\=3=" let l:return = "return array(" . join(l:output, ", ") . ");\" endif - call s:PhpInsertMethod("private", l:name, l:parametersSignature, @x . l:return) + call s:PhpInsertMethod(l:visibility, l:name, l:parametersSignature, @x . l:return) normal `r endfunction " }}} function! PhpCreateProperty() " {{{ let l:name = inputdialog("Name of new property: ") - call s:PhpInsertProperty(l:name, "private") + let l:visibility = inputdialog("Visibility (default is private): ") + if empty(l:visibility) + let l:visibility = 'private' + endif + call s:PhpInsertProperty(l:name, l:visibility) endfunction " }}}