dotfiles/vim/vim.symlink/UltiSnips/php.snippets

74 lines
1.1 KiB
Text

global !p
from mbutils import get_namespace
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
snippet pubf
public function ${1}(
${2}
) \{
$0
\}
endsnippet
snippet prof
protected function ${1}(
${2}
) \{
$0
\}
endsnippet
snippet prif
private function ${1}(
${2}
) \{
$0
\}
endsnippet