1
0
Fork 0
mirror of synced 2024-12-22 23:18:56 -05:00
ultimate-vim/sources_non_forked/vim-snippets/UltiSnips/php.snippets

109 lines
1.6 KiB
Text
Raw Normal View History

2013-08-03 08:50:12 -04:00
snippet <? "php open tag" b
<?php
endsnippet
2013-08-03 08:50:12 -04:00
snippet vdd "php var_dump and die"
var_dump(${1}); die();
endsnippet
2013-08-03 08:50:12 -04:00
snippet ns "php namespace" b
namespace ${1:`!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
if m:
snip.rv = m.group().replace('/', '\\')
`};
endsnippet
snippet nc "php namespace and class or interface" b
2013-08-03 08:50:12 -04:00
namespace ${1:`!p
abspath = os.path.abspath(path)
m = re.search(r'[A-Z].+(?=/)', abspath)
if m:
snip.rv = m.group().replace('/', '\\')
`};
2013-08-03 08:50:12 -04:00
/**
* ${3:@author `whoami`}${4}
*/
`!p
m = re.search(r'Abstract', path)
if m:
snip.rv = 'abstract '
``!p
if re.search(r'Interface', path):
snip.rv = 'interface'
elif re.search(r'Trait', path):
snip.rv = 'trait'
else:
snip.rv = 'class'
` ${2:`!p
2013-08-03 08:50:12 -04:00
snip.rv = re.match(r'.*(?=\.)', fn).group()
`}
{
}
endsnippet
2013-08-03 08:50:12 -04:00
snippet st "php static function" b
${1:public} static function $2($3)
{
2013-08-03 08:50:12 -04:00
${4}
}
endsnippet
2013-08-03 08:50:12 -04:00
snippet __ "php constructor" b
${1:public} function __construct($2)
{
2013-08-03 08:50:12 -04:00
${3}
}
endsnippet
2013-08-03 08:50:12 -04:00
snippet sg "Setter and Getter" b
/**
* @var ${3:`!p snip.rv = t[2][0:1].upper() + t[2][1:]`}
*
* ${4}
2013-08-03 08:50:12 -04:00
*/
${1:protected} $${2};
2013-08-03 08:50:12 -04:00
public function set`!p snip.rv = t[2][0:1].upper() + t[2][1:]`(`!p
if re.match(r'^(\\|[A-Z]).*', t[3]):
2013-08-03 08:50:12 -04:00
snip.rv = t[3] + ' '
else:
snip.rv = ''
`$$2)
{
2013-08-03 08:50:12 -04:00
$this->$2 = $$2;
2013-08-03 08:50:12 -04:00
return $this;
}
public function get`!p snip.rv = t[2][0:1].upper() + t[2][1:]`()
{
2013-08-03 08:50:12 -04:00
return $this->$2;
}
endsnippet
2013-08-03 08:50:12 -04:00
snippet if "php if" !b
if (${1}) {
${2}
}
endsnippet
snippet ife "php ife" !b
if (${1}) {
${2}
} else {
}
endsnippet
snippet /** "php comment block" b
/**
* @${1}
*/
endsnippet