84 lines
1.8 KiB
Text
84 lines
1.8 KiB
Text
# Python
|
|
#
|
|
# `mbutils` is a collection of tooling I've built to do some intelligent
|
|
# stuff around PHP tooling.
|
|
# Found in lib/python/mbutils.py
|
|
global !p
|
|
from mbutils import get_namespace, format_method, map_type, prepare_arguments
|
|
import os
|
|
|
|
def full_path(filename):
|
|
cwd = os.getcwd()
|
|
filepath = os.path.join(cwd, filename)
|
|
|
|
return os.path.dirname(filepath)
|
|
endglobal
|
|
|
|
# @param
|
|
#
|
|
# To make param generation a little easier.
|
|
snippet @param
|
|
@param ${1:Type}${2:|null} ${3:name} ${4:Description}
|
|
endsnippet
|
|
|
|
# Public method.
|
|
#
|
|
# Forces me to write a really good docblock.
|
|
post_jump "if (snip.tabstop == 0): format_method(snip)"
|
|
snippet pubf
|
|
/**
|
|
* ${2:Short description...}
|
|
*
|
|
* ${3:A slightly longer description of what you want to do. This will automatically be wrapped}
|
|
*
|
|
* ${4:@api}
|
|
* ${5:@params}
|
|
* @return ${6:ReturnType}
|
|
* ${7:@throws ${8:ExceptionType}}
|
|
*/
|
|
public function ${1:methodName}(
|
|
...\$args
|
|
): `!p snip.rv = map_type(t[6])` \{
|
|
$0
|
|
\}
|
|
endsnippet
|
|
|
|
# Private method. As public.
|
|
post_jump "if (snip.tabstop == 0): format_method(snip)"
|
|
snippet prif
|
|
/**
|
|
* ${2:Short description...}
|
|
*
|
|
* ${3:A slightly longer description of what you want to do. This will automatically be wrapped}
|
|
*
|
|
* ${4:@api}
|
|
* ${5:@params}
|
|
* @return ${6:ReturnType}
|
|
* ${7:@throws ${8:ExceptionType}}
|
|
*/
|
|
private function ${1:methodName}(
|
|
...\$args
|
|
): `!p snip.rv = map_type(t[6])` \{
|
|
$0
|
|
\}
|
|
endsnippet
|
|
|
|
# Protected method. As public.
|
|
post_jump "if (snip.tabstop == 0): format_method(snip)"
|
|
snippet prof
|
|
/**
|
|
* ${2:Short description...}
|
|
*
|
|
* ${3:A slightly longer description of what you want to do. This will automatically be wrapped}
|
|
*
|
|
* ${4:@api}
|
|
* ${5:@params}
|
|
* @return ${6:ReturnType}
|
|
* ${7:@throws ${8:ExceptionType}}
|
|
*/
|
|
protected function ${1:methodName}(
|
|
...\$args
|
|
): `!p snip.rv = map_type(t[6])` \{
|
|
$0
|
|
\}
|
|
endsnippet
|