105 lines
2 KiB
Text
105 lines
2 KiB
Text
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
|
|
|
|
snippet class
|
|
<?php
|
|
/**
|
|
* @copyright Copyright 2017 ${1:Redbox Digital}
|
|
*/
|
|
|
|
namespace ${2:`!p snip.rv = get_namespace(full_path(path))`};
|
|
|
|
${3:// Use...}
|
|
|
|
class ${4:`!p snip.rv = snip.basename`}${5: extends ${6:ParentClass}}${7: implements ${8:SomeInterface, OtherInterface}}
|
|
\{
|
|
${0:// Implementation...}
|
|
\}
|
|
endsnippet
|
|
|
|
snippet interface
|
|
<?php
|
|
/**
|
|
* @copyright Copyright 2017 ${1:Redbox Digital}
|
|
*/
|
|
|
|
namespace ${2:`!p snip.rv = get_namespace(full_path(path))`};
|
|
|
|
${3:// Use...}
|
|
|
|
interface ${4:`!p snip.rv = snip.basename`}${5: extends ${6:ParentInterface}}
|
|
\{
|
|
${0:// Interface...}
|
|
\}
|
|
endsnippet
|
|
|
|
snippet f
|
|
function ${1}(
|
|
${2}
|
|
) \{
|
|
$0
|
|
\}
|
|
endsnippet
|
|
|
|
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
|
|
|
|
snippet prof
|
|
/**
|
|
* ${2:Short description...}
|
|
*
|
|
* ${3:A slightly longer description of what you want to do. This will automatically be wrapped}
|
|
*
|
|
* ${4:@api}
|
|
* ${5:@tags}
|
|
* @return ${6:ReturnType}
|
|
* ${7:@throws ${8:ExceptionType}}
|
|
*/
|
|
protected function ${1:methodName}(`!p snip.rv = prepare_arguments(t[5])`): `!p snip.rv = map_type(t[6])` \{
|
|
$0
|
|
\}
|
|
endsnippet
|
|
|
|
snippet prif
|
|
/**
|
|
* ${2:Short description...}
|
|
*
|
|
* ${3:A slightly longer description of what you want to do. This will automatically be wrapped}
|
|
*
|
|
* ${4:@api}
|
|
* ${5:@tags}
|
|
* @return ${6:ReturnType}
|
|
*/
|
|
private function ${1:methodName}(
|
|
...\$args
|
|
): `!p snip.rv = map_type(t[6])` \{
|
|
$0
|
|
endsnippet
|
|
|
|
snippet @param
|
|
@param ${1:Type}${2:|null} ${3:name} ${4:Description}
|
|
endsnippet
|