]> git.r.bdr.sh - rbdr/dotfiles/blame_incremental - vim/snippets/php.snippets
Merge branch 'master' of gitlab.com:rbdr/dotfiles
[rbdr/dotfiles] / vim / snippets / php.snippets
... / ...
CommitLineData
1snippet php
2 <?php
3 ${1}
4 ?>
5snippet ec
6 echo "${1:string}"${2};
7snippet inc
8 include '${1:file}';${2}
9snippet inc1
10 include_once '${1:file}';${2}
11snippet req
12 require '${1:file}';${2}
13snippet req1
14 require_once '${1:file}';${2}
15# $GLOBALS['...']
16snippet globals
17 $GLOBALS['${1:variable}']${2: = }${3:something}${4:;}${5}
18snippet $_ COOKIE['...']
19 $_COOKIE['${1:variable}']${2}
20snippet $_ ENV['...']
21 $_ENV['${1:variable}']${2}
22snippet $_ FILES['...']
23 $_FILES['${1:variable}']${2}
24snippet $_ Get['...']
25 $_GET['${1:variable}']${2}
26snippet $_ POST['...']
27 $_POST['${1:variable}']${2}
28snippet $_ REQUEST['...']
29 $_REQUEST['${1:variable}']${2}
30snippet $_ SERVER['...']
31 $_SERVER['${1:variable}']${2}
32snippet $_ SESSION['...']
33 $_SESSION['${1:variable}']${2}
34# Start Docblock
35snippet /*
36 /**
37 * ${1}
38 **/
39# Class - post doc
40snippet doc_cp
41 /**
42 * ${1:undocumented class}
43 *
44 * @package ${2:default}
45 * @author ${3:`g:snips_author`}
46 **/${4}
47# Class Variable - post doc
48snippet doc_vp
49 /**
50 * ${1:undocumented class variable}
51 *
52 * @var ${2:string}
53 **/${3}
54# Class Variable
55snippet doc_v
56 /**
57 * ${3:undocumented class variable}
58 *
59 * @var ${4:string}
60 **/
61 ${1:var} $${2};${5}
62# Class
63snippet doc_c
64 /**
65 * ${3:undocumented class}
66 *
67 * @packaged ${4:default}
68 * @author ${5:`g:snips_author`}
69 **/
70 ${1:}class ${2:}
71 {${6}
72 } // END $1class $2
73# Constant Definition - post doc
74snippet doc_dp
75 /**
76 * ${1:undocumented constant}
77 **/${2}
78# Constant Definition
79snippet doc_d
80 /**
81 * ${3:undocumented constant}
82 **/
83 define(${1}, ${2});${4}
84# Function - post doc
85snippet doc_fp
86 /**
87 * ${1:undocumented function}
88 *
89 * @return ${2:void}
90 * @author ${3:`g:snips_author`}
91 **/${4}
92# Function signature
93snippet doc_s
94 /**
95 * ${4:undocumented function}
96 *
97 * @return ${5:void}
98 * @author ${6:`g:snips_author`}
99 **/
100 ${1}function ${2}(${3});${7}
101# Function
102snippet doc_f
103 /**
104 * ${4:undocumented function}
105 *
106 * @return ${5:void}
107 * @author ${6:`g:snips_author`}
108 **/
109 ${1}function ${2}(${3})
110 {${7}
111 }
112# Header
113snippet doc_h
114 /**
115 * ${1}
116 *
117 * @author ${2:`g:snips_author`}
118 * @version ${3:$Id$}
119 * @copyright ${4:$2}, `strftime('%d %B, %Y')`
120 * @package ${5:default}
121 **/
122
123 /**
124 * Define DocBlock
125 *//
126# Interface
127snippet doc_i
128 /**
129 * ${2:undocumented class}
130 *
131 * @package ${3:default}
132 * @author ${4:`g:snips_author`}
133 **/
134 interface ${1:}
135 {${5}
136 } // END interface $1
137# class ...
138snippet class
139 /**
140 * ${1}
141 **/
142 class ${2:ClassName}
143 {
144 ${3}
145 function ${4:__construct}(${5:argument})
146 {
147 ${6:// code...}
148 }
149 }
150# define(...)
151snippet def
152 define('${1}'${2});${3}
153# defined(...)
154snippet def?
155 ${1}defined('${2}')${3}
156snippet wh
157 while (${1:/* condition */}) {
158 ${2:// code...}
159 }
160# do ... while
161snippet do
162 do {
163 ${2:// code... }
164 } while (${1:/* condition */});
165snippet if
166 if (${1:/* condition */}) {
167 ${2:// code...}
168 }
169snippet ife
170 if (${1:/* condition */}) {
171 ${2:// code...}
172 } else {
173 ${3:// code...}
174 }
175 ${4}
176snippet else
177 else {
178 ${1:// code...}
179 }
180snippet elseif
181 elseif (${1:/* condition */}) {
182 ${2:// code...}
183 }
184# Tertiary conditional
185snippet t
186 $${1:retVal} = (${2:condition}) ? ${3:a} : ${4:b};${5}
187snippet switch
188 switch ($${1:variable}) {
189 case '${2:value}':
190 ${3:// code...}
191 break;
192 ${5}
193 default:
194 ${4:// code...}
195 break;
196 }
197snippet case
198 case '${1:value}':
199 ${2:// code...}
200 break;${3}
201snippet for
202 for ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {
203 ${4: // code...}
204 }
205snippet foreach
206 foreach ($${1:variable} as $${2:key}) {
207 ${3:// code...}
208 }
209snippet fun
210 ${1:public }function ${2:FunctionName}(${3})
211 {
212 ${4:// code...}
213 }
214# $... = array (...)
215snippet array
216 $${1:arrayName} = array('${2}' => ${3});${4}