Merge pull request #195 from MichaelThessel/master

Improved PHP snippets
This commit is contained in:
Honza Pokorny 2013-04-19 12:23:33 -07:00
commit 40479af955

View File

@ -28,9 +28,9 @@ snippet use
use ${1:Foo\Bar\Baz}; use ${1:Foo\Bar\Baz};
${2} ${2}
snippet c snippet c
${1:abstract }class ${2:`Filename()`} class ${1:`Filename()`}
{ {
${3} ${2}
} }
snippet i snippet i
interface ${1:`Filename()`} interface ${1:`Filename()`}
@ -46,12 +46,12 @@ snippet f
} }
# method # method
snippet m snippet m
${1:abstract }${2:protected}${3: static} function ${4:foo}(${5:array }${6:$bar}) ${1:protected} function ${2:foo}()
{ {
${7} ${3}
} }
# setter method # setter method
snippet sm snippet sm
/** /**
* Sets the value of ${1:foo} * Sets the value of ${1:foo}
* *
@ -104,7 +104,7 @@ snippet S
$_SERVER['${1:variable}']${2} $_SERVER['${1:variable}']${2}
snippet SS snippet SS
$_SESSION['${1:variable}']${2} $_SESSION['${1:variable}']${2}
# the following are old ones # the following are old ones
snippet inc snippet inc
include '${1:file}';${2} include '${1:file}';${2}
@ -205,7 +205,7 @@ snippet doc_h
* @copyright ${4:$2}, `strftime('%d %B, %Y')` * @copyright ${4:$2}, `strftime('%d %B, %Y')`
* @package ${5:default} * @package ${5:default}
*/ */
# Interface # Interface
snippet interface snippet interface
/** /**
@ -344,8 +344,8 @@ snippet vd
snippet vdd snippet vdd
var_dump(${1}); die(${2:}); var_dump(${1}); die(${2:});
snippet http_redirect snippet http_redirect
header ("HTTP/1.1 301 Moved Permanently"); header ("HTTP/1.1 301 Moved Permanently");
header ("Location: ".URL); header ("Location: ".URL);
exit(); exit();
# Getters & Setters # Getters & Setters
snippet gs snippet gs
@ -375,7 +375,7 @@ snippet gs
snippet ags snippet ags
/** /**
* ${1:description} * ${1:description}
* *
* @${7} * @${7}
*/ */
${2:protected} $${3:foo}; ${2:protected} $${3:foo};
@ -394,3 +394,12 @@ snippet rett
return true; return true;
snippet retf snippet retf
return false; return false;
snippet am
$${1:foo} = array_map(function($${2:v}) {
${3}
return $$2;
}, $$1);
snippet aw
array_walk($${1:foo}, function(&$${2:v}, $${3:k}) {
$$2 = ${4};
});