2013-07-31 09:56:59 -04:00
|
|
|
snippet <? "php open tag" b
|
|
|
|
<?php
|
2013-03-17 15:13:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
endsnippet
|
|
|
|
|
2013-08-02 10:12:04 -04:00
|
|
|
snippet vdd "php var_dump and die"
|
2013-08-01 10:42:37 -04:00
|
|
|
var_dump(${1}); die();
|
2013-03-17 15:13:47 -04:00
|
|
|
endsnippet
|
|
|
|
|
2013-07-31 09:56:59 -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('/', '\\')
|
|
|
|
`};
|
2013-08-02 10:12:04 -04:00
|
|
|
|
2013-03-17 15:13:47 -04:00
|
|
|
endsnippet
|
|
|
|
|
2013-08-18 23:58:09 -04:00
|
|
|
snippet nc "php namespace and class or interface" b
|
2013-07-31 09:56:59 -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-03-17 15:13:47 -04:00
|
|
|
|
2013-07-31 09:56:59 -04:00
|
|
|
/**
|
2013-08-02 10:12:04 -04:00
|
|
|
* ${3:@author `whoami`}${4}
|
2013-03-17 15:13:47 -04:00
|
|
|
*/
|
2013-08-18 23:58:09 -04:00
|
|
|
`!p
|
|
|
|
m = re.search(r'Abstract', path)
|
|
|
|
if m:
|
|
|
|
snip.rv = 'abstract '
|
|
|
|
``!p
|
2013-08-20 23:28:30 -04:00
|
|
|
if re.search(r'Interface', path):
|
2013-08-18 23:58:09 -04:00
|
|
|
snip.rv = 'interface'
|
2013-08-20 23:28:30 -04:00
|
|
|
elif re.search(r'Trait', path):
|
|
|
|
snip.rv = 'trait'
|
2013-08-18 23:58:09 -04:00
|
|
|
else:
|
|
|
|
snip.rv = 'class'
|
|
|
|
` ${2:`!p
|
2013-08-01 10:42:37 -04:00
|
|
|
snip.rv = re.match(r'.*(?=\.)', fn).group()
|
2013-07-31 09:56:59 -04:00
|
|
|
`}
|
2013-03-17 15:13:47 -04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2013-07-31 09:56:59 -04:00
|
|
|
snippet st "php static function" b
|
|
|
|
${1:public} static function $2($3)
|
2013-03-17 15:13:47 -04:00
|
|
|
{
|
2013-07-31 09:56:59 -04:00
|
|
|
${4}
|
2013-03-17 15:13:47 -04:00
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2013-07-31 09:56:59 -04:00
|
|
|
snippet __ "php constructor" b
|
|
|
|
${1:public} function __construct($2)
|
2013-03-17 15:13:47 -04:00
|
|
|
{
|
2013-07-31 09:56:59 -04:00
|
|
|
${3}
|
2013-03-17 15:13:47 -04:00
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2013-07-31 09:56:59 -04:00
|
|
|
snippet sg "Setter and Getter" b
|
2013-03-17 15:13:47 -04:00
|
|
|
|
|
|
|
/**
|
2013-07-31 09:56:59 -04:00
|
|
|
* @var ${3:`!p snip.rv = t[2].capitalize()`}${4}
|
2013-03-17 15:13:47 -04:00
|
|
|
*/
|
2013-07-31 09:56:59 -04:00
|
|
|
${1:protected} $$2;
|
|
|
|
|
|
|
|
public function set`!p snip.rv = t[2].capitalize()`(`!p
|
|
|
|
if re.match(r'[A-Z].*', t[3]):
|
|
|
|
snip.rv = t[3] + ' '
|
|
|
|
else:
|
|
|
|
snip.rv = ''
|
|
|
|
`$$2)
|
2013-03-17 15:13:47 -04:00
|
|
|
{
|
2013-07-31 09:56:59 -04:00
|
|
|
$this->$2 = $$2;
|
2013-03-17 15:13:47 -04:00
|
|
|
|
2013-07-31 09:56:59 -04:00
|
|
|
return $this;
|
2013-03-17 15:13:47 -04:00
|
|
|
}
|
2013-08-02 10:12:04 -04:00
|
|
|
|
|
|
|
public function get`!p snip.rv = t[2].capitalize()`()
|
|
|
|
{
|
|
|
|
return $this->$2;
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
|
|
|
snippet if "php if" !b
|
|
|
|
if (${1}) {
|
|
|
|
${2}
|
|
|
|
}
|
2013-03-17 15:13:47 -04:00
|
|
|
endsnippet
|
2013-08-18 23:58:09 -04:00
|
|
|
|
2013-08-26 09:11:23 -04:00
|
|
|
snippet ife "php ife" !b
|
|
|
|
if (${1}) {
|
|
|
|
${2}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
}
|
|
|
|
endsnippet
|
|
|
|
|
2013-08-18 23:58:09 -04:00
|
|
|
snippet /** "php comment block" b
|
|
|
|
/**
|
|
|
|
* @${1}
|
|
|
|
*/
|
|
|
|
endsnippet
|