Skip to content

Commit b37b82f

Browse files
committed
Allow custom visibilies for method extracting.
1 parent 270121b commit b37b82f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

plugin/php-refactoring-toolbox.vim

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ function! PhpExtractMethod() range " {{{
196196
return
197197
endif
198198
let l:name = inputdialog("Name of new method: ")
199+
let l:visibility = inputdialog("Visibility (default is private): ")
200+
if empty(l:visibility)
201+
let l:visibility = 'private'
202+
endif
199203
normal gv"xdmr
200204
let l:middleLine = line('.')
201205
call search(s:php_regex_func_line, 'bW')
@@ -234,7 +238,7 @@ function! PhpExtractMethod() range " {{{
234238
exec "normal! Olist(" . join(l:output, ", ") . ") = $this->" . l:name . "(" . join(l:parameters, ", ") . ");\<ESC>=3="
235239
let l:return = "return array(" . join(l:output, ", ") . ");\<CR>"
236240
endif
237-
call s:PhpInsertMethod("private", l:name, l:parametersSignature, @x . l:return)
241+
call s:PhpInsertMethod(l:visibility, l:name, l:parametersSignature, @x . l:return)
238242
normal `r
239243
endfunction
240244
" }}}

0 commit comments

Comments
 (0)