# 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 import mbutils 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. post_jump "if (snip.tabstop is 4): mbutils.add_argument(snip)" snippet @param @param ${1:Type}${2:|null} ${3:name} ${4:Description} endsnippet # Public method. # # Forces me to write a really good docblock. snippet pubf /** * ${2:Short description...} * * ${3:A slightly longer description of what you want to do.} * * ${4:@api} * ${5:@params...} * @return ${6:ReturnType} * ${7:@throws ${8:ExceptionType}} */ public function ${1:methodName}(): `!p snip.rv = mbutils.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.} * * ${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. snippet prof /** * ${2:Short description...} * * ${3:A slightly longer description of what you want to do.} * * ${4:@api} * ${5:@params...} * @return ${6:ReturnType} * ${7:@throws ${8:ExceptionType}} */ protected function ${1:methodName}(): `!p snip.rv = map_type(t[6])` \{ $0 \} endsnippet snippet construct /** * ${1:@params} */ public function __construct( ...\$args ) \{ /* * Mark the ballot if you want the relevant code to be generated. * * [${2: }] - Make fields? * [${3: }] - Make getters? * [${4: }] - Make setters? */ $0 \} endsnippet