Skip to content

Commit 4f148fb

Browse files
committed
Code cleaning
1 parent 68a97bb commit 4f148fb

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed

plugin/php-refactoring-toolbox.vim

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -353,30 +353,27 @@ endfunction
353353
" }}}
354354

355355
function! s:PhpInsertProperty(name, visibility) " {{{
356-
let l:regex = '\%(' . join([s:php_regex_member_line, s:php_regex_const_line, s:php_regex_class_line], '\)\|\(') .'\)'
357-
if search(l:regex, 'beW') > 0
358-
let l:line = getbufline("%", line('.'))[0]
359-
if match(l:line, s:php_regex_class_line) > -1
360-
call search('{', 'W')
361-
call append(line('.'), "")
362-
let l:insertLine = line('.')
363-
else
364-
call append(line('.'), "")
365-
let l:insertLine = line('.') + 1
366-
endif
367-
else
368-
call append(line('.'), "")
369-
let l:insertLine = line('.')
370-
endif
371-
call s:PhpInsertPropertyExtended(a:name, a:visibility, l:insertLine)
356+
let l:regex = '\%(' . join([s:php_regex_member_line, s:php_regex_const_line, s:php_regex_class_line], '\)\|\(') .'\)'
357+
if search(l:regex, 'beW') > 0
358+
let l:line = getbufline("%", line('.'))[0]
359+
if match(l:line, s:php_regex_class_line) > -1
360+
call search('{', 'W')
361+
call s:PhpInsertPropertyExtended(a:name, a:visibility, line('.'), 0)
362+
else
363+
call s:PhpInsertPropertyExtended(a:name, a:visibility, line('.'), 1)
364+
endif
365+
else
366+
call s:PhpInsertPropertyExtended(a:name, a:visibility, line('.'), 0)
367+
endif
372368
endfunction
373369
" }}}
374370

375-
function! s:PhpInsertPropertyExtended(name, visibility, insertLine) " {{{
376-
call append(a:insertLine, '/**')
377-
call append(a:insertLine+1, '* @var mixed')
378-
call append(a:insertLine+2, '*/')
379-
call append(a:insertLine+3, a:visibility . " $" . a:name . ';')
371+
function! s:PhpInsertPropertyExtended(name, visibility, insertLine, emptyLineBefore) " {{{
372+
call append(a:insertLine, '')
373+
call append(a:insertLine + a:emptyLineBefore, '/**')
374+
call append(a:insertLine + a:emptyLineBefore + 1, '* @var mixed')
375+
call append(a:insertLine + a:emptyLineBefore + 2, '*/')
376+
call append(a:insertLine + a:emptyLineBefore + 3, a:visibility . " $" . a:name . ';')
380377
normal j=5=
381378
endfunction
382379
" }}}

0 commit comments

Comments
 (0)