commit
220bc3e883
1
AUTHORS
1
AUTHORS
@ -35,3 +35,4 @@ msanders
|
||||
Povilas Balzaravičius Pawka
|
||||
Dmitry Dementev
|
||||
Travis Holton
|
||||
Chrisyue
|
||||
|
@ -21,6 +21,7 @@ to maintain snippets for a language, please get in touch.
|
||||
* HTML Django - [honza](http://github.com/honza)
|
||||
* Markdown - [honza](http://github.com/honza)
|
||||
* Ruby - [taq](http://github.com/taq)
|
||||
* PHP - [chrisyue](http://github.com/chrisyue)
|
||||
|
||||
Contributing notes
|
||||
------------------
|
||||
|
@ -1,13 +1,92 @@
|
||||
snippet php
|
||||
snippet <?
|
||||
<?php
|
||||
|
||||
${1}
|
||||
?>
|
||||
snippet phpil
|
||||
<?php ${1} ?>
|
||||
snippet ec
|
||||
echo "${1:string}"${2};
|
||||
snippet ethis
|
||||
<?php echo $this->${1:something}; ?>
|
||||
echo ${1};
|
||||
snippet <?e
|
||||
<?php echo ${1} ?>
|
||||
# this one is for php5.4
|
||||
snippet <?=
|
||||
<?=${1}?>
|
||||
snippet ns
|
||||
namespace ${1:Foo\Bar\Baz};
|
||||
${2}
|
||||
snippet use
|
||||
use ${1:Foo\Bar\Baz};
|
||||
${2}
|
||||
snippet c
|
||||
${1:abstract }class ${2:`Filename()`}
|
||||
{
|
||||
${3}
|
||||
}
|
||||
snippet i
|
||||
interface ${1:`Filename()`}
|
||||
{
|
||||
${2}
|
||||
}
|
||||
snippet t.
|
||||
$this->${1}
|
||||
snippet f
|
||||
function ${1:foo}(${2:array }${3:$bar})
|
||||
{
|
||||
${4}
|
||||
}
|
||||
# method
|
||||
snippet m
|
||||
${1:abstract }${2:protected}${3: static} function ${4:foo}(${5:array }${6:$bar})
|
||||
{
|
||||
${7}
|
||||
}
|
||||
# setter method
|
||||
# I think vim's functions will not be called at the snipMate's runtime
|
||||
# but `compile` time
|
||||
# so `tolower` here won't work
|
||||
# but it would be wonderful if we could make the property and parameter to lower case
|
||||
snippet sm
|
||||
${1:public} function set${2:Foo}(${3:$2 }$${4:`tolower('$2')`})
|
||||
{
|
||||
$this->${5:$4} = $$4;
|
||||
${6}
|
||||
return $this;
|
||||
}
|
||||
# getter method
|
||||
snippet gm
|
||||
${1:public} function get${2:Foo}()
|
||||
{
|
||||
return $this->${3:$2};
|
||||
}
|
||||
#setter
|
||||
snippet $s
|
||||
${1:$foo}->set${2:Bar}(${3});
|
||||
#getter
|
||||
snippet $g
|
||||
${1:$foo}->get${2:Bar}();
|
||||
|
||||
# Tertiary conditional
|
||||
snippet =?:
|
||||
$${1:foo} = ${2:true} ? ${3:a} : ${4};
|
||||
snippet ?:
|
||||
${1:true} ? ${2:a} : ${3}
|
||||
|
||||
snippet C
|
||||
$_COOKIE['${1:variable}']${2}
|
||||
snippet E
|
||||
$_ENV['${1:variable}']${2}
|
||||
snippet F
|
||||
$_FILES['${1:variable}']${2}
|
||||
snippet G
|
||||
$_GET['${1:variable}']${2}
|
||||
snippet P
|
||||
$_POST['${1:variable}']${2}
|
||||
snippet R
|
||||
$_REQUEST['${1:variable}']${2}
|
||||
snippet S
|
||||
$_SERVER['${1:variable}']${2}
|
||||
snippet SS
|
||||
$_SESSION['${1:variable}']${2}
|
||||
|
||||
# the following are old ones
|
||||
snippet inc
|
||||
include '${1:file}';${2}
|
||||
snippet inc1
|
||||
@ -16,27 +95,6 @@ snippet req
|
||||
require '${1:file}';${2}
|
||||
snippet req1
|
||||
require_once '${1:file}';${2}
|
||||
# $GLOBALS['...']
|
||||
snippet globals
|
||||
$GLOBALS['${1:variable}']${2: = }${3:something}${4:;}${5}
|
||||
snippet G
|
||||
$GLOBALS['${1:variable}']
|
||||
snippet $_ COOKIE['...']
|
||||
$_COOKIE['${1:variable}']${2}
|
||||
snippet $_ ENV['...']
|
||||
$_ENV['${1:variable}']${2}
|
||||
snippet $_ FILES['...']
|
||||
$_FILES['${1:variable}']${2}
|
||||
snippet $_ Get['...']
|
||||
$_GET['${1:variable}']${2}
|
||||
snippet $_ POST['...']
|
||||
$_POST['${1:variable}']${2}
|
||||
snippet $_ REQUEST['...']
|
||||
$_REQUEST['${1:variable}']${2}
|
||||
snippet $_ SERVER['...']
|
||||
$_SERVER['${1:variable}']${2}
|
||||
snippet $_ SESSION['...']
|
||||
$_SESSION['${1:variable}']${2}
|
||||
# Start Docblock
|
||||
snippet /*
|
||||
/**
|
||||
@ -130,7 +188,7 @@ snippet doc_h
|
||||
*/
|
||||
|
||||
# Interface
|
||||
snippet doc_i
|
||||
snippet interface
|
||||
/**
|
||||
* ${2:undocumented class}
|
||||
*
|
||||
@ -138,8 +196,9 @@ snippet doc_i
|
||||
* @author ${4:`g:snips_author`}
|
||||
*/
|
||||
interface ${1:}
|
||||
{${5}
|
||||
} // END interface $1
|
||||
{
|
||||
${5}
|
||||
}
|
||||
# class ...
|
||||
snippet class
|
||||
/**
|
||||
@ -148,9 +207,12 @@ snippet class
|
||||
class ${2:ClassName}
|
||||
{
|
||||
${3}
|
||||
function ${4:__construct}(${5:argument})
|
||||
/**
|
||||
* ${4}
|
||||
*/
|
||||
${5:public} function ${6:__construct}(${7:argument})
|
||||
{
|
||||
${6:// code...}
|
||||
${8:// code...}
|
||||
}
|
||||
}
|
||||
# define(...)
|
||||
@ -198,9 +260,6 @@ snippet elseif
|
||||
elseif (${1:/* condition */}) {
|
||||
${2:// code...}
|
||||
}
|
||||
# Tertiary conditional
|
||||
snippet t
|
||||
$${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5}
|
||||
snippet switch
|
||||
switch ($${1:variable}) {
|
||||
case '${2:value}':
|
||||
@ -235,11 +294,6 @@ snippet foreachkil
|
||||
<?php foreach ($${1:variable} as $${2:key} => $${3:value}): ?>
|
||||
${4:<!-- html... -->}
|
||||
<?php endforeach; ?>
|
||||
snippet fun
|
||||
${1:public }function ${2:FunctionName}(${3})
|
||||
{
|
||||
${4:// code...}
|
||||
}
|
||||
# $... = array (...)
|
||||
snippet array
|
||||
$${1:arrayName} = array('${2}' => ${3});${4}
|
||||
@ -274,9 +328,9 @@ snippet getset
|
||||
*
|
||||
* @return ${2}
|
||||
*/
|
||||
function get$1()
|
||||
public function get$1()
|
||||
{
|
||||
return $this->_$1;
|
||||
return $this->$1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -284,9 +338,10 @@ snippet getset
|
||||
*
|
||||
* @param mixed $$1 ${3}
|
||||
*/
|
||||
function set$1($$1)
|
||||
public function set$1($$1)
|
||||
{
|
||||
$this->_$1 = $$1;
|
||||
$this->$1 = $$1;
|
||||
return $this;
|
||||
}
|
||||
snippet rett
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user