From 270121b365bf36ae041696f53248b7aa7ad330fd Mon Sep 17 00:00:00 2001 From: Jrean Date: Mon, 6 Apr 2015 12:33:00 +0800 Subject: [PATCH 1/2] Allow custom visibilities for inserting class properties and/or extracting class properties. Default value privated is keept. --- plugin/php-refactoring-toolbox.vim | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugin/php-refactoring-toolbox.vim b/plugin/php-refactoring-toolbox.vim index ef2b9eb..c0307d2 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 " }}} @@ -237,7 +241,11 @@ 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 " }}} From b37b82fe7d00f74226c6ff1a7fa896f6363af3c4 Mon Sep 17 00:00:00 2001 From: Jrean Date: Mon, 6 Apr 2015 13:43:49 +0800 Subject: [PATCH 2/2] Allow custom visibilies for method extracting. --- plugin/php-refactoring-toolbox.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugin/php-refactoring-toolbox.vim b/plugin/php-refactoring-toolbox.vim index c0307d2..e4245df 100644 --- a/plugin/php-refactoring-toolbox.vim +++ b/plugin/php-refactoring-toolbox.vim @@ -196,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') @@ -234,7 +238,7 @@ 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 " }}}